Example #1
0
        private void HexBoardDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            HexBoardViewModel viewModel = this.DataContext as HexBoardViewModel;

            if (viewModel != null)
            {
                viewModel.SetActualBoardSize(new Size(this.ActualWidth, this.ActualHeight));
            }
        }
Example #2
0
        private void HexBoardSizeChanged(object sender, SizeChangedEventArgs e)
        {
            HexBoardViewModel viewModel = this.DataContext as HexBoardViewModel;

            if (viewModel != null)
            {
                viewModel.SetActualBoardSize(e.NewSize);
            }
        }
Example #3
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());
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
 public HexCellViewModel(HexBoardViewModel board)
 {
     this.board       = board;
     this.PlayerBrush = this.CalculatePlayerBrush();
 }
Example #7
0
 public HexCellViewModel(HexBoardViewModel board)
 {
     this.board = board;
     this.PlayerBrush = this.CalculatePlayerBrush();
 }
Example #8
0
 private void HexBoardDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     HexBoardViewModel viewModel = this.DataContext as HexBoardViewModel;
 }