/// <summary> /// Save the game /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Save(object sender, RoutedEventArgs e) { this.dtClockTime.Stop(); this.board.IsWhiteTurn = this.isWhiteTurn; this.board.TimerBlack = this.playerBlack.Timer; this.board.TimerWhite = this.playerWhite.Timer; ToolsOthello.SerializeObject(this.board); this.dtClockTime.Start(); }
/// <summary> /// Upload a old game with the format *.heroes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Upload(object sender, RoutedEventArgs e) { this.dtClockTime.Stop(); Board uploadBoard = ToolsOthello.DeSerializeObject <Board>(); if (uploadBoard != null) { this.board = uploadBoard; this.playerBlack.Timer = uploadBoard.TimerBlack; this.playerWhite.Timer = uploadBoard.TimerWhite; this.isWhiteTurn = uploadBoard.IsWhiteTurn; UpdateGridGUI(); ToggleTurnUi(); ShowThePlayableCell(); } else { MessageBox.Show("Erreur, fichier pas valide"); } this.dtClockTime.Start(); }