protected override void OnFormClosing(FormClosingEventArgs e) { base.OnFormClosing(e); // Does this prevent windows from shutting down? if (e.CloseReason == CloseReason.WindowsShutDown) { return; } // Final Confirm user wants to close, if connected to ssh. if (ProcessInterface.IsProcessRunning) { switch (MessageBox.Show(this, "The server is still active!\n\nAre you sure you want to kill the server?\n\nPerforming this action will hard-stop the server, without allowing it too shutdown properly\n\nPlease click on the Cancel button below and use the shutdown command, before closing the application.\n\n*WARNING: AFTER CLICKING OK DATA LOSS MAY OCCUR*", "Active Server Exit Warning", MessageBoxButtons.OKCancel)) { case DialogResult.Cancel: e.Cancel = true; break; default: // Disables connection watcher, allowing thread to exit ProcessInterface.StopProcess(); exitingApplication = true; ACEManager.Log.AddLogLine("Exiting..."); break; } } else { ACEManager.Log.AddLogLine("Exiting..."); } }
private void BtnKill_Click(object sender, EventArgs e) { if (consoleControl1.IsProcessRunning) { EchoCommand("Killing process..."); ProcessInterface.StopProcess(); UpdateStatus(); } }
/// <summary> /// Stops the process. /// </summary> public void StopProcess() { // Stop the interface. _processInteface.StopProcess(); }