static void ChessboardPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { ChessControl chineseChessboard = d as ChessControl; if (e.OldValue != null) { (e.OldValue as Chessboard).ChessMoved -= chineseChessboard.chessboard_ChessMoved; } }
static object ChessboardCoerceValueCallback(DependencyObject d, object baseValue) { ChessControl chineseChessboard = d as ChessControl; if (baseValue != null) { (baseValue as Chessboard).ChessMoved += chineseChessboard.chessboard_ChessMoved; } return(baseValue); }
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(); } }
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(); } } }