嘿伙计们,我是 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();
}