private void Window_Closed(object sender, EventArgs e) { ConnIndicator.Fill = System.Windows.Media.Brushes.Red; thr.Abort(); try { if (CloseGame == false)//the player exit in the middle of the game { Client.IQuit(Username, GameId); } } catch (TimeoutException) { MessageBox.Show(" connection unstable , it took to long to get a response this game is canceled", Username + " connection unstable"); } catch (CommunicationObjectFaultedException) { MessageBox.Show(" connection failed , this game is canceled", Username + " connection unstable"); } catch (Exception ex) { MessageBox.Show(ex.ToString(), Username + " connection unstable"); } }