public TeamControlsViewModel(IMainReduxDispatcher dispatcher, TeamType teamType) { this.dispatcher = dispatcher; dispatcher.StateChanged += Dispatcher_StateChanged; TeamType = teamType; EnabledEditCommand = new RelayCommand(() => dispatcher.Dispatch(new StartTeamEditAction())); DisableEditCommand = new RelayCommand(() => dispatcher.Dispatch(new EndTeamEditAction())); ChangeScoreCommand = new RelayCommand <string>(i => dispatcher.Dispatch(new ChangeScoreAction(teamType, int.Parse(i)))); ChangeFoulsCommand = new RelayCommand <string>(i => dispatcher.Dispatch(new ChangeFoulsAction(teamType, int.Parse(i)))); }
public MainViewModel(IMainReduxDispatcher dispatcher, Func <TeamType, TeamControlsViewModel> teamControlsViewModelFactory, RoosterViewModel rooster) { this.dispatcher = dispatcher; RoosterViewModel = rooster; dispatcher.StateChanged += UpdateReduxState; HomeTeamControls = teamControlsViewModelFactory(TeamType.Home); AwayTeamControls = teamControlsViewModelFactory(TeamType.Away); AdvancePeriodCommand = new RelayCommand(() => dispatcher.Dispatch(new ChangePeriodAction(+1))); BackPeriodCommand = new RelayCommand(() => dispatcher.Dispatch(new ChangePeriodAction(-1))); ResetCommand = new RelayCommand(() => dispatcher.Dispatch(new ResetAction())); EndGameCommand = new RelayCommand(() => dispatcher.Dispatch(new EndGameAction())); ToggleTeamEditCommand = new RelayCommand(() => dispatcher.Dispatch(new ToggleTeamEditAction())); persistenceFileName = Path.Combine(Path.GetDirectoryName(typeof(MainViewModel).Assembly.Location), "persistence.json"); }
public RoosterViewModel(IMainReduxDispatcher dispatcher) { this.dispatcher = dispatcher; dispatcher.StateChanged += Dispatcher_StateChanged; }