private void toolStripButton4_Click(object sender, EventArgs e) { int version; if(PowershellAction.IsPowershellInstalled(out version)) { PowerShellRequiredDialog dialog = new PowerShellRequiredDialog(); dialog.PrimaryText.Text = "Windows PowerShell found on your system."; dialog.SecondaryText.Text = "Version: " + version.ToString(); dialog.DownloadButton.Visible = false; dialog.ShowDialog(); } else { PowerShellRequiredDialog dialog = new PowerShellRequiredDialog(); dialog.PrimaryText.Text = "Windows PowerShell not found on your system."; dialog.SecondaryText.Text = "PowerShell needs to be installed in order to run PowerShell scripts."; dialog.DownloadButton.Visible = true; dialog.ShowDialog(); } }
private void RunButton_Click(object sender, EventArgs e) { // check if PowerShell is is installed int version; if(PowershellAction.IsPowershellInstalled(out version) == false) { StateLabel.Visible = true; ResultsBox.Text = "PowerShell not installed."; PowerShellRequiredDialog dialog = new PowerShellRequiredDialog(); dialog.PrimaryText.Text = "Windows PowerShell not found on your system."; dialog.SecondaryText.Text = "PowerShell needs to be installed in order to run PowerShell scripts."; dialog.DownloadButton.Visible = true; dialog.ShowDialog(); return; } // wait until the executor is created executorInitialized.WaitOne(); // add bridge objects SessionControlBridge bridge = new SessionControlBridge(); scriptExecutor.BridgeList = GetBridgeObjectList(_pluginFolder); // set bridge objects to test mode logger = new BridgeLogger(); foreach(IBridge b in scriptExecutor.BridgeList) { b.TestMode = true; b.Logger = logger; } // prepare to start ExposedResultsButton.Visible = false; resultBuilder = new StringBuilder(); ResultsBox.Text = ""; appendCount = 0; StateLabel.Image = SDResources.PowershellSmall; scriptExecutor.RunScriptAsync(ScriptEditor.Text); EnterRunMode(); }