Example #1
0
        static void ChessboardPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChessControl chineseChessboard = d as ChessControl;

            if (e.OldValue != null)
            {
                (e.OldValue as Chessboard).ChessMoved -= chineseChessboard.chessboard_ChessMoved;
            }
        }
Example #2
0
        static object ChessboardCoerceValueCallback(DependencyObject d, object baseValue)
        {
            ChessControl chineseChessboard = d as ChessControl;

            if (baseValue != null)
            {
                (baseValue as Chessboard).ChessMoved += chineseChessboard.chessboard_ChessMoved;
            }
            return(baseValue);
        }
Example #3
0
        static void IsRedTurnPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChessControl chineseChessboard = d as ChessControl;

            if (e.NewValue.Equals(chineseChessboard.IsRedSelected))
            {
                chineseChessboard._dispatcherTimer.Start();
            }
            else
            {
                chineseChessboard._dispatcherTimer.Stop();
            }
        }
Example #4
0
        static void IsRedReadyPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ChessControl chineseChessboard = d as ChessControl;

            if (e.NewValue.Equals(true))
            {
                chineseChessboard.ReadForRedChessman();
            }
            else
            {
                if (chineseChessboard._dispatcherTimer != null)
                {
                    chineseChessboard._dispatcherTimer.Stop();
                }
            }
        }