private void OnResetGame() { if (GameOfLifeWorld != null) { GameOfLifeWorld.ResetGame(); } }
private void OnStopGame() { if (GameOfLifeWorld != null) { GameOfLifeWorld.StopGame(); } }
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); }
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()); }
private void OnStartGame() { GameOfLifeWorld.StartGame(); }
private void OnNextGen() { GameOfLifeWorld.NextGeneration(); }
private void OnPopulateRandom() { GameOfLifeWorld.PopulateRandom(); }