コード例 #1
0
        /// <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();
        }
コード例 #2
0
        /// <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();
        }