예제 #1
0
        public MainWindowViewModel(HexBoardViewModel hexBoard)
        {
            this.hexBoard = hexBoard;
            this.hexBoard.OnCellPlayed += this.HexBoardCellPlayed;

            this.clearCommand         = new ActionCommand <MainWindowViewModel>(vm => vm.ClearBoard());
            this.clearCommand.Enabled = false;

            this.showDebugBoardCommand = new ShowDebugBoardCommand();

            this.computerMoveCommand = new ActionCommand <MainWindowViewModel>(vm => vm.DoComputerMove());
        }
예제 #2
0
        private void MoveCompleted(ComputerMoveData computerMoveData)
        {
            HexBoardViewModel hexBoard   = this.currentViewModel.HexBoard;
            HexCellViewModel  cellToPlay = hexBoard.GetCellAtLocation(computerMoveData.Move);

            if (cellToPlay != null)
            {
                cellToPlay.PlayCell();

                this.canExecute = !computerMoveData.IsGameWon;
            }

            hexBoard.GetDebugDataCommand.Execute(hexBoard);
        }
예제 #3
0
        public override void ExecuteOnValue(MainWindowViewModel value)
        {
            HexBoardViewModel boardViewModel = new HexBoardViewModel(value.HexBoard);

            boardViewModel.ShowDebugData = true;
            boardViewModel.CanPlay       = false;
            boardViewModel.GetDebugDataCommand.Execute(boardViewModel);

            DebugBoardWindowViewModel debugWindowViewModel = new DebugBoardWindowViewModel();

            debugWindowViewModel.HexBoard = boardViewModel;

            DebugBoardWindow debugBoard = new DebugBoardWindow();

            debugBoard.DataContext = debugWindowViewModel;

            debugBoard.Show();
        }
예제 #4
0
 public MainWindowViewModel(HexBoardViewModel hexBoard)
 {
     this.hexBoard = hexBoard;
     this.hexBoard.OnCellPlayed += this.HexBoardCellPlayed;
 }