private void InitBoard()
        {
            BoardControl boardControl = new BoardControl();

            _form.SetMainControl(boardControl);
            _form.ClearBoard += HandleClearBoard;

            if (File.Exists(SaveFile))
            {
                try
                {
                    using (FileStream fileIn = new FileStream(SaveFile, FileMode.Open, FileAccess.Read))
                    {
                        _board = new BoardStore().Load(fileIn);
                    }
                }
                catch (Exception ex)
                {
                    LogError(ex);
                }
            }
            if (_board == null)
            {
                _board = new Board(BoardSize);
            }

            new BoardController(_board, boardControl);
        }
Beispiel #2
0
 public BoardController(Board board, BoardControl boardControl)
 {
     _board        = board;
     _boardControl = boardControl;
     _boardControl.PositionClick         += HandlePositionClick;
     _boardControl.PositionDeleteCommand += HandlePositionDeleteCommand;
     _boardControl.SetModel(board);
 }