Thursday, 19 September 2013

How would I get output from system call to textview

How would I get output from system call to textview

Hey guys I am new to the C#/Mono programming side of things, but I would
like to get the output from a system call to be direct to the textview.
How would I do that? Here is what I have for far:
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();
}

No comments:

Post a Comment