private async void Grid_MouseDown(object sender, MouseButtonEventArgs e) { int row = Grid.GetRow(sender as Grid); int col = Grid.GetColumn(sender as Grid); if (client == null) { if (game.PickCell(row, col)) { UpdateGrid(); } else if (game.PlaceCell(row, col)) { UpdateGrid(); } } else { if (game.PickCell(row, col)) { if (game.PickedCellType.ToString()[0] == 'B' && red) { game.ResetPick(); } else if (game.PickedCellType.ToString()[0] == 'R' && !red) { game.ResetPick(); } else { if (game.PickedCellType.ToString()[0] == game.Turn) { row1 = row; col1 = col; UpdateGrid(); } } } else if (game.PlaceCell(row, col)) { UpdateGrid(); ChangeTurn(); await client.SendMove(row1, col1, row, col); } } if (game.Victory != null) { MessageBox.Show($"{game.Victory} team vins!"); } }