private void startToolStripMenuItem1_Click(object sender, EventArgs e) { if (runningScript == null) { var scriptManager = new Scriptmanager(_executable, Script_started, Script_stopped); scriptManager.ShowDialog(); var executableCount = scriptManager.GetRunningExecutable(); if (executableCount != 0) { runningScript = _executable.GetExecutables <IScript>()[scriptManager.GetRunningExecutable() - 1]; } } else { if (runningScript.CurrentState == Util.ScriptUtils.State.START) { if (runningScript.CurrentState == Util.ScriptUtils.State.PAUSING) { runningScript.CurrentState = Util.ScriptUtils.State.RESUME; this.Text = title + " - Script running..."; startToolStripMenuItem1.Text = "Pause"; } else { runningScript.CurrentState = Util.ScriptUtils.State.PAUSING; this.Text = title + " - Script paused..."; startToolStripMenuItem1.Text = "Resume"; } } } }
private void buttonStart_Click(object sender, EventArgs e) { if (listViewScripts.SelectedItems.Count == 1) { _executable.Bind(((ScriptItem)listViewScripts.SelectedItems[0]).script); _runningExecutables = _executable.GetExecutables <IScript>().Count; _executable.Execute(_runningExecutables); _start(); this.Close(); } }