/** Called when we click slot 3. The method loads the saved game in slot 3 for us to play. * @param sender - The button we clicked * @param e - Contains state information * @author Thomas Hooper * @date April 2019 */ private void Slot3_Click(object sender, RoutedEventArgs e) { Game game = new Game(); game = Save.LoadGame(@"C:\Users\thoop\source\repos\ChessApp\ChessApp\Saves\SaveGame3.xml"); ChessGame c = new ChessGame(game); this.NavigationService.Navigate(c); ChessBoard.Refresh(c.chessBoard.LocationGrid); c.chessBoard.SetPieces(); if (c.chessBoard.Game.HumanPlayer.Color == Color.Black) { c.Flip(); } }
/** Called when we want to start a game over a connection with a friend * @param sender - The button we clicked * @param e - Contains state information * @author Thomas Hooper * @date August 2019 */ private void ConnectButton_Click(object sender, RoutedEventArgs e) { DataTransfer d = null; try { d = new DataTransfer(Convert.ToInt32(portNumberBox1.Text), Convert.ToInt32(portNumberBox2.Text)); } catch (Exception) { MessageBox.Show("Enter Port Numbers"); return; } d.StartConnection(); ChessGame c = new ChessGame(d, m_color); this.NavigationService.Navigate(c); }