Beispiel #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());
        }
Beispiel #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);
        }
Beispiel #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();
        }
 public MainWindowViewModel(HexBoardViewModel hexBoard)
 {
     this.hexBoard = hexBoard;
     this.hexBoard.OnCellPlayed += this.HexBoardCellPlayed;
 }