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,8 +27,12 @@ namespace WorldOfPeacecraft
private void doReceive () private void doReceive ()
{ {
this.Reader = new StreamReader (Client.GetStream ()); this.Reader = new StreamReader (Client.GetStream ());
while (true) { try {
ReceiverBuffer.AddLine(Receive()); while (true) {
ReceiverBuffer.AddLine (Receive ());
}
} catch (ObjectDisposedException e) {
// Nothing to do
} }
} }
@@ -36,10 +40,5 @@ namespace WorldOfPeacecraft
{ {
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();
} }
} }
} }