Пример #1
0
 private void Engine_ExecutionCompleted(object e, object arg)
 {
     PrintLnStatement.WriteLine("");
     PrintLnStatement.WriteLine(Properties.Resources.ApplicationComplete);
     PrintLnStatement.Stop();
     Dispatcher.InvokeAsync(() =>
     {
         Editor.IsEnabled       = true;
         ButtonStart.IsEnabled  = true;
         ButtonStop.IsEnabled   = false;
         ButtonSaveAs.IsEnabled = true;
         ButtonPrint.IsEnabled  = true;
     });
 }
Пример #2
0
 private void OnStopRun(object sender, RoutedEventArgs e)
 {
     if (engine != null)
     {
         engine.EnterNode -= Engine_EnterNode;
         engine.LeaveNode -= Engine_LeaveNode;
         //Editor.IsEnabled = false;
         engine.ExecutionCompleted -= Engine_ExecutionCompleted;
         engine.ExecutionAborted   -= Engine_ExecutionAborted;
         engine.Stop();
         PrintLnStatement.Stop();
         engine = null;
         ButtonStart.IsEnabled = true;
         ButtonStop.IsEnabled  = false;
     }
 }
Пример #3
0
 private void Engine_ExecutionAborted(object sender, Completion arg)
 {
     PrintLnStatement.WriteLine("");
     PrintLnStatement.WriteLine(Properties.Resources.ApplicationAbort);
     PrintLnStatement.WriteLine(arg.ReturnValue);
     PrintLnStatement.Stop();
     if (arg != null)
     {
         Dispatcher.InvokeAsync(() =>
         {
             var ret = MessageBox.Show(Properties.Resources.ExceptionDuringRun + "\n" + arg.ReturnValue + "\n" + Properties.Resources.LocateException,
                                       Properties.Resources.Exception, MessageBoxButton.YesNo, MessageBoxImage.Error);
             if (ret == MessageBoxResult.Yes)
             {
                 var editor = Editor.FindEditorFor(arg.Location);
                 if (editor == null)
                 {
                     var parent = Editor.FindParent(arg.Location);
                     editor     = Editor.FindEditorFor(parent);
                 }
                 if (editor != null)
                 {
                     Console.WriteLine(editor);
                     Editor.Highlight(editor);
                     ButtonClearError.IsEnabled = true;
                 }
             }
             //var p = Editor.FindParent(arg.Location);
             // var pe = Editor.FindEditorFor(p);
         });
     }
     Dispatcher.InvokeAsync(() =>
     {
         Editor.IsEnabled       = true;
         ButtonStart.IsEnabled  = true;
         ButtonStop.IsEnabled   = false;
         ButtonSaveAs.IsEnabled = true;
         ButtonPrint.IsEnabled  = true;
     });
 }