private void HexBoardDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { HexBoardViewModel viewModel = this.DataContext as HexBoardViewModel; if (viewModel != null) { viewModel.SetActualBoardSize(new Size(this.ActualWidth, this.ActualHeight)); } }
private void HexBoardSizeChanged(object sender, SizeChangedEventArgs e) { HexBoardViewModel viewModel = this.DataContext as HexBoardViewModel; if (viewModel != null) { viewModel.SetActualBoardSize(e.NewSize); } }
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()); }
public HexBoardViewModel(HexBoardViewModel original) { this.CanPlay = true; this.BoardSize = original.BoardSize; this.hexGame = new HexGame(this.BoardSize); this.hexGame.Board.CopyStateFrom(original.hexGame.Board); this.Populate(); this.CopyCellStates(original.Cells); this.gameSummary = new GameSummary(this.hexGame, original.gameSummary.GameType); this.computerSkillLevel = original.computerSkillLevel; this.doComputerMoveCommand = new DoComputerMoveCommand(this.computerSkillLevel); }
public HexCellViewModel(HexBoardViewModel board) { this.board = board; this.PlayerBrush = this.CalculatePlayerBrush(); }
private void HexBoardDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { HexBoardViewModel viewModel = this.DataContext as HexBoardViewModel; }