/// <summary>
        /// Loads a new game into the model.
        /// Does nothing if the model is null.
        /// </summary>
        public void LoadNewGame()
        {
            if (model == null)
            {
                return;
            }

            // build the event args
            CancelEventArgs emptyArgs = new CancelEventArgs();

            // raise the Loading event on the model
            model.OnLoading(emptyArgs);

            // if the operation was cancelled
            if (emptyArgs.Cancel)
            {
                return;
            }

            // set the starting board
            model.CurrentBoard = Board.GetStartingBoard();

            // raise the ConfigurationLoaded event on the model
            model.OnBoardConfigurationLoaded(EventArgs.Empty);
        }
        /// <summary>
        /// Initializes the model from PGN tag pair section.
        /// Throws ArgumentException if the board configuration is not valid.
        /// </summary>
        /// <param name="tr">The text reader which is read from</param>
        private void InitializeGameFromPGNTagPairs(TextReader tr)
        {
            string line;

            // skip the empty lines
            do
            {
                line = tr.ReadLine();
            }while (line != null && line.Length == 0);

            // read the tag pair section
            // we are interested only if the game is not from the starting position
            // in which case the game is initialized with the FEN
            while (line != null && line.Length > 0 && line[0] == '[' && line[line.Length - 1] == ']')
            {
                if (line.Length > 8 && line[1] == 'F' && line[2] == 'E' && line[3] == 'N' && line[4] == ' ' && line[5] == '"' && line[line.Length - 2] == '"')
                {
                    model.CurrentBoard = Utils.GetFENBoard(line.Substring(6, line.Length - 8));
                    return;
                }
                line = tr.ReadLine();
            }

            // if there was no FEN
            // initialize the model with the starting position
            model.CurrentBoard = Board.GetStartingBoard();
        }