public void Connect_Click(object sender, RoutedEventArgs e)
 {
     CheckersGameClient client = new CheckersGameClient();
     client.SendAndReceiveUserInfo();
 }
 public void CheckWin()
 {
     int totalBlack = 0, totalRed = 0;
     for (int row = 1; row < 9; row++)
     {
         for (int column = 0; column < 8; column++)
         {
             StackPanel stackPanel = (StackPanel)GetGridElement(CheckersGrid, row, column);
             if (stackPanel.Children.Count > 0)
             {
                 Button button = (Button)stackPanel.Children[0];
                 if (button.Name.Contains("Red"))
                     totalRed++;
                 if (button.Name.Contains("Black"))
                     totalBlack++;
             }
         }
     }
     if (totalBlack == 0)
     {
         winner = "Red";
         CheckersGameClient client = new CheckersGameClient();
         client.SendAndReceiveGameInfo(winner);
     }
     if (totalRed == 0)
     {
         winner = "Black";
         CheckersGameClient client = new CheckersGameClient();
         client.SendAndReceiveGameInfo(winner);
     }
     if (winner != null)
     {
         for (int row = 1; row < 9; row++)
         {
             for (int column = 0; column < 8; column++)
             {
                 StackPanel stackPanel = (StackPanel)GetGridElement(CheckersGrid, row, column);
                 if (stackPanel.Children.Count > 0)
                 {
                     Button button = (Button)stackPanel.Children[0];
                     button.Click -= new RoutedEventHandler(button_Click);
                 }
             }
         }
         MessageBoxResult result = MessageBox.Show(winner + " is the winner. Would you like to play again?", "Winner", MessageBoxButton.YesNo);
         if (result == MessageBoxResult.Yes)
             NewGame();
     }
 }