Example #1
0
 private void commandHandler(string command)
 {
     PythonExecuting.Invoke(this, new EventArgs());
     try
     {
         pe.Execute(command);
     }
     catch (Exception err)
     {
         if (err.Message != null && err.Message.Length > 0)
         {
             LogText(err.Message + "\n", ErrColor);
         }
         else
         {
             LogText(err.ToString() + "\n", ErrColor);
         }
     }
     PythonFinished.Invoke(this, new EventArgs());
 }
Example #2
0
 /// <summary>
 /// Handler for the Command port.  ExecuteCommandInteractive and ExecuteCommandSilently
 /// post commands to this port.
 /// </summary>
 /// <param name="cmd"></param>
 private void commandHandler(Command cmd)
 {
     PythonExecuting.Invoke(this, new EventArgs());
     Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new ThreadStart(
                           delegate() { commandLineBox.IsEnabled = false; }));
     try
     {
         if (cmd.IsInteractive)
         {
             pe.ExecuteToConsole(cmd.CommandString);
         }
         else
         {
             pe.Execute(cmd.CommandString);
         }
     }
     catch (Exception err)
     {
         LogText(Strings.FromExceptionMessage(err) + "\n", ErrColor);
     }
     Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new ThreadStart(
                           delegate() { commandLineBox.IsEnabled = true; commandLineBox.Focus(); }));
     PythonFinished.Invoke(this, new EventArgs());
 }