Terminate application after window close

This commit is contained in:
2014-05-01 00:57:00 +02:00
parent 3be391802a
commit 3b6f407e1c
4 changed files with 16 additions and 1 deletions

View File

@@ -110,5 +110,12 @@ namespace WorldOfPeacecraft
{ {
Gui.PerformRefresh(); Gui.PerformRefresh();
} }
public void Stop() {
Parse.Stop ();
Send.Stop ();
Rec.Stop ();
System.Windows.Forms.Application.Exit ();
}
} }
} }

View File

@@ -42,6 +42,12 @@ namespace WorldOfPeacecraft
this.PerformLayout(); this.PerformLayout();
} }
protected override void OnClosing (System.ComponentModel.CancelEventArgs e)
{
base.OnClosing (e);
Backend.Stop ();
}
public void DoPaint (object source, PaintEventArgs args) public void DoPaint (object source, PaintEventArgs args)
{ {
BufferedGraphics buffer = BufferedGraphicsManager.Current.Allocate (Board.CreateGraphics (), Board.DisplayRectangle); BufferedGraphics buffer = BufferedGraphicsManager.Current.Allocate (Board.CreateGraphics (), Board.DisplayRectangle);

View File

@@ -4,5 +4,7 @@ namespace WorldOfPeacecraft
public interface IBackend public interface IBackend
{ {
ITile[,] GetMap(); ITile[,] GetMap();
void Stop();
} }
} }

View File

@@ -34,7 +34,7 @@ namespace WorldOfPeacecraft
} }
} }
public void stop() public void Stop()
{ {
SenderThread.Abort(); SenderThread.Abort();
} }