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()); }
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); }
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; }