示例#1
0
 private void OnScriptExecutionEnded()
 {
     m_mainScriptExecution.Task.CurrentStateChanged -= this.CurrentScriptExecution_CurrentStateChanged;
     m_mainScriptExecution           = null;
     toolStripButtonRun.Enabled      = true;
     toolStripButtonStop.Enabled     = false;
     toolStripButtonPause.Enabled    = false;
     toolStripButtonStepInto.Enabled = false;
     toolStripButtonStepOver.Enabled = false;
     toolStripButtonStepOut.Enabled  = false;
 }
示例#2
0
        //private void OnReadyForExecuteSelectedProcedure()
        //{
        //    if (StepBroMain.LastParsingErrorCount == 0)
        //    {
        //        this.ExecuteSelectedProcedure();
        //    }
        //    else
        //    {
        //        MessageBox.Show(
        //            this,
        //            "Could not start execution because of one or more parsing errors.",
        //            "Error starting execution", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}

        //private void OnReadyForExecuteProcedureUnderCursor()
        //{
        //    if (StepBroMain.LastParsingErrorCount == 0)
        //    {
        //        this.ExecuteProcedureUnderCursor();
        //    }
        //    else
        //    {
        //        MessageBox.Show(
        //            this,
        //            "Could not start execution because of one or more parsing errors.",
        //            "Error starting execution", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //    }
        //}

        private void ExecuteSelectedProcedure()
        {
            var selected = toolStripComboBoxExecutionTarget.SelectedItem as ComboboxItem;

            if (selected != null)
            {
                IFileElement element = Main.TryFindFileElement(selected.Value as string);
                if (element != null)
                {
                    m_mainScriptExecution = StepBro.Core.Main.StartProcedureExecution(element as IFileProcedure);
                    m_mainScriptExecution.Task.CurrentStateChanged += this.CurrentScriptExecution_CurrentStateChanged;
                }
            }
        }
示例#3
0
        private void ExecuteProcedureUnderCursor()
        {
            // Temporary solution !!!!
            // Get the file element closest to the current selection (or the cursor), and execute that.
            var active = dockPanel.ActiveDocument.DockHandler.Content;

            if (active != null && active is StepBroScriptDocView)
            {
                var          view          = active as StepBroScriptDocView;
                var          file          = view.ScriptFile;
                IFileElement element       = null;
                var          selectionLine = view.SelectionStartLine + 1; // Make line number 1-based
                foreach (var fe in file.ListElements())
                {
                    if (fe.Line <= selectionLine && (element == null || element.Line < fe.Line))
                    {
                        element = fe;
                    }
                }
                if (element != null)
                {
                    if (element is IFileProcedure)
                    {
                        m_mainScriptExecution = StepBro.Core.Main.StartProcedureExecution(element as IFileProcedure);
                        m_mainScriptExecution.Task.CurrentStateChanged += this.CurrentScriptExecution_CurrentStateChanged;
                    }
                    else
                    {
                        // TODO: Show comment in status bar
                    }
                }
                else
                {
                    // TODO: Show comment in status bar
                }
            }
        }