嘿伙计们,我是C#/ Mono编程方面的新手,但我想将系统调用的输出直接发送到textview。我该怎么办?以下是我的目标:
protected void OnButton2Clicked (object sender, EventArgs e)
{
Application.Init ();
Window win = new Window ("System Information");
win.SetDefaultSize (600,400);
TextView view = new Gtk.TextView ();
TextBuffer buffer = view.Buffer;
win.Add (view);
win.ShowAll ();
var info = new ProcessStartInfo("dmidecode","-t system"){ RedirectStandardOutput = true, UseShellExecute = false };
var proc = new Process { StartInfo = info, EnableRaisingEvents = true };
proc.Start ();
Console.WriteLine (proc.StandardOutput.ReadToEnd ().ToString());
buffer.Text = proc.ToString();
}