void HandleConsoleInput(object sender, ConsoleInputEventArgs e)
 {
     if (isPrompting)
     {
         isPrompting = false;
         session     = null;
         SendCommand("", "");
     }
     else
     {
         SendCommand("", e.Text);
     }
 }
        void SendCommand(string echo, string line)
        {
            if (string.IsNullOrWhiteSpace(line))
            {
                return;
            }

            if (session == null)
            {
                session = SetupSession();
            }

            var text = line.EndsWith("\n", StringComparison.Ordinal) ? line : line + "\n";

            var tv = view.Child as Gtk.TextView;

            if (tv != null && !string.IsNullOrEmpty(echo))
            {
                var iter = tv.Buffer.EndIter;
                tv.Buffer.Insert(ref iter, echo + "\n");
            }

            session.SendCommand(text);
        }
 public CSharpInteractivePad()
 {
     view    = new ConsoleView();
     session = SetupSession();
 }
 public CSharpInteractivePad()
 {
     view = new ConsoleView ();
     session = SetupSession ();
 }
        void SendCommand(string echo, string line)
        {
            if (string.IsNullOrWhiteSpace (line))
                return;

            if (session == null) {
                session = SetupSession ();
            }

            var text = line.EndsWith ("\n", StringComparison.Ordinal) ? line : line + "\n";

            var tv = view.Child as Gtk.TextView;
            if (tv != null && !string.IsNullOrEmpty (echo)) {
                var iter = tv.Buffer.EndIter;
                tv.Buffer.Insert (ref iter, echo + "\n");
            }

            session.SendCommand (text);
        }
 void HandleConsoleInput(object sender, ConsoleInputEventArgs e)
 {
     if (isPrompting) {
         isPrompting = false;
         session = null;
         SendCommand ("", "");
     } else {
         SendCommand ("", e.Text);
     }
 }