Example #1
0
        private void moveGame(GameButton button, string sign)
        {
            button.Content = sign;
            button.IsEnabled = false;

            isWinner = c.IfWinner(sign, button.row, button.col);
            if (isWinner)
            {
                MessageBox.Show(sign + " is winner");
                resetGame();
            }
        }
Example #2
0
        private GameButton[,] CreateButtons()
        {
            GameButton[,] buttons = new GameButton[boardSize, boardSize];
            for (int row = 0; row < boardSize; row++)
            {
                for (int col = 0; col < boardSize; col++)
                {
                    buttons[row, col] = new GameButton(boardSize, row, col);
                    buttons[row, col].VerticalAlignment = VerticalAlignment.Center;
                    buttons[row, col].Click += Button_Click;

                }
            }
            return buttons;
        }