コード例 #1
0
        public Completion Execute(ExecutionEnvironment environment)
        {
            ExecutionEnterEventArgs args = new ExecutionEnterEventArgs(this);

            environment.FireEnterNode(args);
            try
            {
                var c = this.ExecuteImpl(environment);
                environment.FireLeaveNode(new ExecutionLeaveEventArgs(this, c));
                return(c);
            }
            catch (Exception e)
            {
                environment.FireLeaveNode(new ExecutionLeaveEventArgs(this, Completion.Exception(e.Message, this)));
                return(Completion.Exception(e.Message, this));
            }
        }
コード例 #2
0
 private void Engine_EnterNode(object obj, ExecutionEnterEventArgs arg)
 {
     if (IsStackMonitored)
     {
         stackTrace.Push(arg.Location);
         if (stackTrace.Count > 1000)
         {
             MessageBox.Show(Properties.Resources.StackMessage, Properties.Resources.StackTitle, MessageBoxButton.OK, MessageBoxImage.Error);
             engine.Stop();
         }
     }
     if (IsHighlightStep && arg.Location != null && arg.Location is Statement)
     {
         Control editor = null;
         double  cycle  = 100;
         Dispatcher.Invoke(() =>
         {
             try
             {
                 cycle  = 100 - SliderSpeeder.Value;
                 editor = Editor.FindEditorFor(arg.Location);
                 if (editor != null)
                 {
                     Editor.Highlight(editor);
                 }
             }
             catch (Exception e)
             {
                 Console.WriteLine(e.Message);
                 Console.WriteLine(e.StackTrace);
             }
         });
         if (editor != null)
         {
             Thread.Sleep((int)(3000 * cycle / 100));
             Dispatcher.Invoke(() =>
             {
                 Editor.ClearHighlight();
             });
         }
     }
 }