예제 #1
0
 /// <summary>
 /// Triggers the automation engine to stop based on a hooked key press
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void OnHookStopped(object sender, EventArgs e)
 {
     if (EngineInstance != null)
     {
         uiBtnCancel_Click(null, null);
         EngineInstance.CancelScript();
     }
     GlobalHook.HookStopped -= new EventHandler(OnHookStopped);
 }
예제 #2
0
        public void uiBtnCancel_Click(object sender, EventArgs e)
        {
            if (InvokeRequired)
            {
                var d = new uiBtnCancel_ClickDelegate(uiBtnCancel_Click);
                Invoke(d, new object[] { sender, e });
            }
            else
            {
                if (uiBtnCancel.DisplayText == "Close")
                {
                    UpdateLineNumber(0);
                    ClosingAllEngines = true;
                    Close();
                    Dispose();
                    return;
                }

                if (IsNewTaskSteppedInto || IsHiddenTaskEngine)
                {
                    IsNewTaskResumed   = false;
                    IsNewTaskCancelled = true;
                }

                uiBtnPause.Visible    = false;
                uiBtnCancel.Visible   = false;
                uiBtnStepInto.Visible = false;
                uiBtnStepOver.Visible = false;
                lblKillProcNote.Text  = "Cancelling...";
                EngineInstance.ResumeScript();

                SteppingCommandsItem commandsItem = new SteppingCommandsItem
                {
                    Text  = "[User Requested Cancellation]",
                    Color = Color.Black
                };

                lstSteppingCommands.Items.Add(commandsItem);
                lstSteppingCommands.SelectedIndex = lstSteppingCommands.Items.Count - 1;
                lblMainLogo.Text = "debug info (cancelling)";
                EngineInstance.CancelScript();
            }
        }