Skip to content

Commit

Permalink
Exit Eve on close
Browse files Browse the repository at this point in the history
  • Loading branch information
emist committed Sep 14, 2011
1 parent 5dd83a8 commit 07c6735
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion UI/ClientWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}

}

/// <summary>
/// Updates the location of the drawable area
/// </summary>
Expand Down

0 comments on commit 07c6735

Please sign in to comment.