private void Button_Exit_Click(object sender, RoutedEventArgs e) { MessageBoxResult message = MessageBox.Show(Properties.Resources.message_Exit, Properties.Resources.message_Wait, MessageBoxButton.YesNo, MessageBoxImage.Question); try { if (message == MessageBoxResult.Yes) { if (playerThis.UserName == gameClient.GetUserNamePlayerOne(idGame)) { chatClient.WinGamePlayerTwo(idGame, playerThis.UserName); } else { if (playerThis.UserName == gameClient.GetUserNamePlayerTwo(idGame)) { chatClient.WinGamePlayerOne(idGame, playerThis.UserName); } } } } catch (Exception ex) { Console.WriteLine(ex); } }
private void Button_Exit_Click(object sender, RoutedEventArgs e) { try { if (playerThis.UserName == gameClient.GetUserNamePlayerOne(idGame)) { startGameClient.LeftGame(playerThis.UserName, idGame); LeftGame(); } else { if (playerThis.UserName == gameClient.GetUserNamePlayerTwo(idGame)) { LeftGame(); } } } catch (Exception ex) { ServerFailed serverFailed = new ServerFailed(); serverFailed.Show(); this.Close(); } }