Пример #1
0
 private void duktape_Status(object sender, EventArgs e)
 {
     PluginManager.Core.Invoke(new Action(async() =>
     {
         bool wantPause  = !Inferior.Running;
         bool wantResume = !Running && Inferior.Running;
         Running         = Inferior.Running;
         if (wantPause)
         {
             focusTimer.Change(Timeout.Infinite, Timeout.Infinite);
             FileName   = ResolvePath(Inferior.FileName);
             LineNumber = Inferior.LineNumber;
             if (!File.Exists(FileName))
             {
                 // filename reported by Duktape doesn't exist; walk callstack for a
                 // JavaScript call as a fallback
                 var callStack = await Inferior.GetCallStack();
                 var topCall   = callStack.First(entry => entry.Item3 != 0);
                 var callIndex = Array.IndexOf(callStack, topCall);
                 FileName      = ResolvePath(topCall.Item2);
                 LineNumber    = topCall.Item3;
                 await Panes.Inspector.SetCallStack(callStack, callIndex);
                 Panes.Inspector.Enabled = true;
             }
             else
             {
                 updateTimer.Change(500, Timeout.Infinite);
             }
         }
         if (wantResume && Inferior.Running)
         {
             focusTimer.Change(250, Timeout.Infinite);
             updateTimer.Change(Timeout.Infinite, Timeout.Infinite);
             Panes.Errors.ClearHighlight();
         }
         if (wantPause && Paused != null)
         {
             PauseReason reason = haveError ? PauseReason.Exception : PauseReason.Breakpoint;
             haveError          = false;
             Paused(this, new PausedEventArgs(reason));
         }
         if (wantResume && Resumed != null)
         {
             Resumed(this, EventArgs.Empty);
         }
     }), null);
 }