コード例 #1
0
ファイル: MainWindow.cs プロジェクト: pinfib/AcademItsDorosh
        public void OpenSurroundingCells(int column, int row)
        {
            int sideLength = _gameField.ColumnCount;

            int sideWidth  = column + 1;
            int sideHeight = row + 1;

            for (int i = row - 1; i <= sideHeight; i++)
            {
                for (int j = column - 1; j <= sideWidth; j++)
                {
                    if (i < 0 || j < 0 || i >= sideLength || j >= sideLength)
                    {
                        continue;
                    }

                    CellButton button = _gameField.GetControlFromPosition(j, i) as CellButton;

                    if (button != null && !button.IsFlagged())
                    {
                        _presenter.FieldButtonLeftClick(button, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
                    }
                }
            }
        }