Mono C# gtk# GUI Gnome-terminal

  • Thread starter Thread starter DedeTuga
  • Start date Start date
D

DedeTuga

Guest
I'm trying do an Gui terminal on MonoDevelop using Gtk project and c# (csharp), but I cant find a sample that works on mono so i start building my own. this is my actual code:

using System;
using System.Diagnostics;

using Gtk;

public partial class MainWindow : Gtk.Window
{
public MainWindow() : base(Gtk.WindowType.Toplevel)
{
Build();
}

protected void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
a.RetVal = true;
}

protected void OnEntry3KeyReleaseEvent(object o, KeyReleaseEventArgs args)
{
}

protected void OnButton1Clicked(object sender, EventArgs e)
{
//ExecuteCommand("gnome-terminal -x bash -ic 'cd $HOME; ls; bash'");

ExecuteCommand(entry3.Text.ToString());
//textview1.Buffer.Text = textview1.Buffer.Text + "\r\n" + entry3.Text.ToString();
entry3.Text = "";

}

protected void ExecuteCommand(string command)
{
Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "gnome-terminal";
//proc.StartInfo.Arguments = "-c \" " + command + " \"";
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();


while (!proc.StandardOutput.EndOfStream)
{
textview1.Buffer.Text = proc.StandardOutput.ReadToEnd();
}
}
}


The Idea is have a gui terminal with text input and output.

Can you help?

Thanks


Continue reading...
 
Back
Top