Exemple #1
0
 private void MenuItem_NewGame(object sender, RoutedEventArgs e)
 {
     ChessMap.tSecond = -1;
     ChessMap.tMin    = 0;
     ChessMap.Reset();
     chessBoard.Update();
 }
Exemple #2
0
 void Win(string message)
 {
     ChessMap.stopTimer = true;
     MessageBox.Show(message, "Checkmate", MessageBoxButton.OK, MessageBoxImage.Information);
     ChessMap.stopTimer = false;
     ChessMap.tSecond   = -1;
     ChessMap.tMin      = 0;
     ChessMap.Reset();
 }
Exemple #3
0
        public ChessBoard(Grid grid, TextBlock UI01, TextBlock UI02, TextBlock UI03, TextBlock UI04)
        {
            ChessMap.Reset();
            this.grid = grid;
            this.UI01 = UI01;
            this.UI02 = UI02;
            this.UI03 = UI03;
            this.UI04 = UI04;

            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 8; x++)
                {
                    mapButton[y, x]        = new Button();
                    mapButton[y, x].Tag    = y * 8 + x;
                    mapButton[y, x].Click += new RoutedEventHandler(button_Click);

                    img[y, x] = new Image();
                }
            }
        }