Ejemplo n.º 1
0
 private void OnResetGame()
 {
     if (GameOfLifeWorld != null)
     {
         GameOfLifeWorld.ResetGame();
     }
 }
Ejemplo n.º 2
0
 private void OnStopGame()
 {
     if (GameOfLifeWorld != null)
     {
         GameOfLifeWorld.StopGame();
     }
 }
Ejemplo n.º 3
0
        private void OnToggleCellState(object arg)
        {
            Point  pointer           = Mouse.GetPosition((IInputElement)arg);
            double gridWidthInPixel  = ((ItemsControl)arg).ActualWidth;
            double gridHeightInPixel = ((ItemsControl)arg).ActualHeight;

            GameOfLifeWorld.ToggleCellState(pointer, gridWidthInPixel, gridHeightInPixel);
        }
Ejemplo n.º 4
0
        public GameOfLifeVM()
        {
            GameOfLifeWorld = new GameOfLifeWorld(_initialTotalRows, _initialTotalColumns);
            GameOfLifeWorld.PropertyChanged += OnGameOfLifeWorldPropertyChanged;

            //initialize Commands
            ToggleCellStateCommand = new RelayCommand(OnToggleCellState, canExecute => OnCanExecute());
            StartGameCommand       = new RelayCommand(param => OnStartGame(), canExecute => OnCanExecute());
            ResetGameCommand       = new RelayCommand(param => OnResetGame(), canExecute => true);
            StopGameCommand        = new RelayCommand(param => OnStopGame(), canExecute => true);
            NextGenCommand         = new RelayCommand(param => OnNextGen(), canExecute => OnCanExecute());
            NavigateToWiki         = new RelayCommand(param => OnNavigateToWiki(), canExecute => true);
            PopulateRandom         = new RelayCommand(param => OnPopulateRandom(), canExecute => OnCanExecute());
        }
Ejemplo n.º 5
0
 private void OnStartGame()
 {
     GameOfLifeWorld.StartGame();
 }
Ejemplo n.º 6
0
 private void OnNextGen()
 {
     GameOfLifeWorld.NextGeneration();
 }
Ejemplo n.º 7
0
 private void OnPopulateRandom()
 {
     GameOfLifeWorld.PopulateRandom();
 }