/// <summary>
        /// This method is called when someone closes the window. We are using this method to clear all the resources.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Closing(object sender, CancelEventArgs e)
        {
            if (_Handlers != null)
            {
                _Handlers = new Collection <PropertyChangedEventHandler>();
            }

            if (_ladderNumbers != null)
            {
                _ladderNumbers.Clear();
            }

            if (_snakeNumbers != null)
            {
                _snakeNumbers.Clear();
            }

            if (_ladders != null)
            {
                _ladders.Clear();
            }

            if (_snakes != null)
            {
                _snakes.Clear();
            }

            if (_tokens != null)
            {
                _tokens.Clear();
            }

            if (GameDice != null && GameDice.DiceAnimation != null)
            {
                GameDice.DiceAnimation.Completed -= DiceAnimation_Completed;
            }

            _winText           = null;
            _LadderSnakeRandom = null;

            Properties.Settings.Default.SnakeTailBoxColor   = _SnakeTailBoxColor.ToString();
            Properties.Settings.Default.SnakeHeadBoxColor   = _SnakeHeadBoxColor.ToString();
            Properties.Settings.Default.LadderEndBoxColor   = _LadderEndBoxColor.ToString();
            Properties.Settings.Default.LadderStartBoxColor = _LadderStartBoxColor.ToString();
            Properties.Settings.Default.SnakeColor          = _SnakeColor.ToString();
            Properties.Settings.Default.LadderColor         = _LadderColor.ToString();

            Properties.Settings.Default.MaxLadderLength              = _intMaxLadderLength;
            Properties.Settings.Default.MaxSnakeLength               = _intMaxSnakeLength;
            Properties.Settings.Default.SnakeThicknessFactor         = _dbSnakeThicknessFactor;
            Properties.Settings.Default.NumberOfSnakes               = _intNumberOfSnakes;
            Properties.Settings.Default.NumberOfLadders              = _intNumberOfLadders;
            Properties.Settings.Default.CanSnakesAndLaddersIntersect = _bCanSnakesAndLaddersIntersect;

            Properties.Settings.Default.Save();
        }
        /// <summary>
        /// This method is used to Start the win game animation.
        /// </summary>
        void DoWinAmination()
        {
            (new System.Media.SoundPlayer(Properties.Resources.WinAudio)).Play();

            GameBoard.Opacity = 0.4;
            foreach (Ladder ladder in _ladders)
            {
                ladder.Opacity = 0.4;
            }
            foreach (Snake snake in _snakes)
            {
                snake.Opacity = 0.4;
            }

            (new System.Media.SoundPlayer(Properties.Resources.Applause)).Play();
            _winText             = new WinText(_currentToken);
            _winText.CanvasWidth = GameBoard.ActualWidth;
            if (_numOfPlayersLeft == (int)_enGameType)
            {
                _winText.Text = _currentToken.ToString() + " won the game!!!";
            }
            else if (_numOfPlayersLeft == (int)_enGameType - 1 && _numOfPlayersLeft > 1)
            {
                _winText.Text = "Second winner is " + _currentToken.ToString() + "!!!";
            }
            else if (_numOfPlayersLeft == (int)_enGameType - 2 && _numOfPlayersLeft > 1)
            {
                _winText.Text = "Third winner is " + _currentToken.ToString() + "!!!";
            }

            _winText.WinAnimation.Completed += WinAnimation_Completed;
            Canvas.SetLeft(_winText, (GameBoard.ActualWidth / 2) - (GameBoard.ActualWidth / 5));
            Canvas.SetTop(_winText, (GameBoard.ActualHeight / 2) - (GameBoard.ActualHeight / 15));
            BoardCanvas.Children.Add(_winText);

            _winText.StartAnimation();
        }