diff --git a/UI/ClientWindow.cs b/UI/ClientWindow.cs index 8e7b137..ca8e570 100644 --- a/UI/ClientWindow.cs +++ b/UI/ClientWindow.cs @@ -4,8 +4,11 @@ using System.Text; using System.Windows.Forms; using System.Drawing; +using System.Diagnostics; + using Eryan.Singleton; + namespace Eryan.UI { ///RUN button needs to be updated when mulitple instance support gets added @@ -171,7 +174,9 @@ public ClientWindow() //this.Size = new Size(700, 800); //this.AutoSize = true; - + this.FormClosing += new FormClosingEventHandler(ClientWindow_FormClosing); + this.FormClosed += new FormClosedEventHandler(ClientWindow_FormClosed); + this.tabControl1.TabPages[0].AutoScroll = true; runButton.Click += runButton_Click; mouseInput.Click += mouseInput_Click; @@ -181,6 +186,33 @@ public ClientWindow() } + private void ClientWindow_FormClosed(Object sender, FormClosedEventArgs e) + { + Console.WriteLine("Killing process"); + foreach (Bot bot in BotFetcher.getBots()) + { + Process p = Process.GetProcessById((int)bot.getPid()); + Console.WriteLine("Killing process " + bot.getPid()); + if (p != null) + p.Kill(); + } + Application.Exit(); + } + + + private void ClientWindow_FormClosing(Object sender, FormClosingEventArgs e) + { + Console.WriteLine("Killing process"); + foreach (Bot bot in BotFetcher.getBots()) + { + Process p = Process.GetProcessById((int)bot.getPid()); + Console.WriteLine("Killing process " + bot.getPid()); + if (p != null) + p.Kill(); + } + + } + /// /// Updates the location of the drawable area ///