Programm terminiert jetzt beim schließen

This commit is contained in:
2014-05-02 11:44:52 +02:00
parent 89da875d39
commit eb52b42c60
4 changed files with 9 additions and 9 deletions

View File

@@ -135,8 +135,7 @@ namespace WorldOfPeacecraft
public void Stop() { public void Stop() {
Parse.Stop (); Parse.Stop ();
Send.Stop (); Send.Stop ();
Rec.Stop (); Client.Close ();
System.Windows.Forms.Application.Exit ();
} }
} }
} }

View File

@@ -465,6 +465,7 @@ namespace WorldOfPeacecraft
public void Stop () public void Stop ()
{ {
ParserThread.Abort (); ParserThread.Abort ();
ParserThread.Join ();
} }
private class Block private class Block

View File

@@ -27,19 +27,18 @@ namespace WorldOfPeacecraft
private void doReceive () private void doReceive ()
{ {
this.Reader = new StreamReader (Client.GetStream ()); this.Reader = new StreamReader (Client.GetStream ());
try {
while (true) { while (true) {
ReceiverBuffer.AddLine (Receive ()); ReceiverBuffer.AddLine (Receive ());
} }
} catch (ObjectDisposedException e) {
// Nothing to do
}
} }
public void Start() public void Start()
{ {
ReceiverThread.Start (); ReceiverThread.Start ();
} }
public void Stop()
{
ReceiverThread.Abort ();
}
} }
} }

View File

@@ -41,6 +41,7 @@ namespace WorldOfPeacecraft
public void Stop() public void Stop()
{ {
SenderThread.Abort(); SenderThread.Abort();
SenderThread.Join();
} }
} }
} }