public SoundQuestionWindowViewModel(IEventAggregator eventAggregator, StandingsService standingsService, InputService inputService) : base(eventAggregator, standingsService, inputService) { _soundToken = ShowEvent.Subscribe(PauseStart); _closeEvent = eventAggregator.GetEvent<CloseEvent>(); _stopToken = _closeEvent.Subscribe((o) => Dispose()); }
public AdminAreaViewModel(IEventAggregator eventAggregator, QuestionGridViewModel questionGridViewModel, RoundService roundService, StandingsService standingsService, InputService inputService) { _eventAggregator = eventAggregator; _roundService = roundService; _standingsService = standingsService; _inputService = inputService; QuestionGridViewModel = questionGridViewModel; _round = 1; ChangeRoundCommand = new DelegateCommand<object>(ChangedRound); ShowScoresCommand = new DelegateCommand(() => _standingsService.ToggleShowScores()); IsSelecting = _standingsService.Players[new Random().Next(0, 4)]; _eventAggregator.GetEvent<CategoryClickedEvent>().Subscribe(DisplayQuestion); _eventAggregator.GetEvent<ActivePlayerChangedEvent>().Subscribe(ActivePlayerChangedEventHandler); _eventAggregator.GetEvent<NewSelectorEvent>().Subscribe((i) => { IsSelecting = _standingsService.Players[i - 1]; }); _inputService.PropertyChanged += (s, e) => { if(e.PropertyName.Equals("ActiveController")) RaisePropertyChanged(() => CurrentActive); }; _standingsService.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("TimeLeft")) RaisePropertyChanged(() => TimeLeft); }; }
public MainViewModel(Window owner, IEventAggregator eventAggregator, RoundService roundService, StandingsService standingsService, InputService inputService) { _owner = owner; _eventAggregator = eventAggregator; _roundService = roundService; _standingsService = standingsService; _inputService = inputService; _roundService.PropertyChanged += (s, e) => { if (e.PropertyName.Equals("CurrentRound")) { RaisePropertyChanged(() => Category1); RaisePropertyChanged(() => Category2); RaisePropertyChanged(() => Category3); RaisePropertyChanged(() => Category4); RaisePropertyChanged(() => Category5); } }; _standingsService.PropertyChanged += (s, e) => { if(e.PropertyName.Equals("IsScoresShown")) { RaisePropertyChanged(() => IsScoresShown); } }; }
public QuestionGridViewModel(IEventAggregator eventAggregator, RoundService roundService, StandingsService standingsService) { _eventAggregator = eventAggregator; _roundService = roundService; _standingsService = standingsService; AddCommand = new DelegateCommand<object>(AddPoints); SubstractCommand = new DelegateCommand<object>(Substract); StartCommand = new DelegateCommand(Start); StopCommand = new DelegateCommand(Stop); BonusCommand = new DelegateCommand(Bonus); WrongCommand = new DelegateCommand(Wrong); CorrectCommand = new DelegateCommand(Correct); CloseCommand = new DelegateCommand(Close); BonusAddCommand = new DelegateCommand<object>(AddBonusPoints); _showEvent = _eventAggregator.GetEvent<ShowEvent>(); _activateEvent = _eventAggregator.GetEvent<ActivateEvent>(); _stopEvent = _eventAggregator.GetEvent<StopEvent>(); _bonusEvent = _eventAggregator.GetEvent<BonusEvent>(); _closeEvent = _eventAggregator.GetEvent<CloseEvent>(); _newSelectorEvent = _eventAggregator.GetEvent<NewSelectorEvent>(); }
public InputService(EventAggregator eventAggregator, StandingsService standingsService) { _eventAggregator = eventAggregator; _standingsService = standingsService; _showEvent = _eventAggregator.GetEvent<ShowEvent>(); _activePlayerChangedEvent = _eventAggregator.GetEvent<ActivePlayerChangedEvent>(); _eventAggregator.GetEvent<ActivateEvent>().Subscribe(Activate); _eventAggregator.GetEvent<CloseEvent>().Subscribe(Reset); _buzz = new BuzzIOWrite.BuzzIOWrite(); _buzz.FindTheHid(); _players = new[] { false, false, false, false, false }; _pressed = new[] { false, false, false, false, false }; _used = new[] { false, false, false, false, false }; _timeleft = TimeAvailable; _timer = new Timer(1000) { AutoReset = false }; _timer.Elapsed += new ElapsedEventHandler(OnTimerEnd); }
public Window1() { InitializeComponent(); var eventAggregator = new EventAggregator(); _standingsService = new StandingsService(5); _roundService = new RoundService(); //var names = new List<string> {"Emil", "CJ", "Rune", "Andreas", "Kristoffer"}; var counter = 1; foreach (var p in _standingsService.Players) { p.Name = "P" + counter++; //p.Name = names[counter - 1]; //p.Points = counter*100; //counter++; } _inputService = new InputService(eventAggregator, _standingsService); _questionGridViewModel = new QuestionGridViewModel(eventAggregator, _roundService, _standingsService); _adminAreaViewModel = new AdminAreaViewModel(eventAggregator, _questionGridViewModel, _roundService, _standingsService, _inputService); _adminArea = new AdminAreaView(_adminAreaViewModel); _adminArea.Show(); var mainViewModel = new MainViewModel(this, eventAggregator, _roundService, _standingsService, _inputService); MainView.DataContext = mainViewModel; this.PreviewKeyDown += _inputService.ButtonDownEventHandler; this.PreviewKeyUp += _inputService.ButtonUpEventHandler; new System.Threading.Tasks.TaskFactory().StartNew(() => { System.Threading.Thread.Sleep(100); UIHelperService.ExecuteUIAction(() => this.WindowState = WindowState. Minimized); }); }
public MediaQuestionWindowViewModel(IEventAggregator eventAggregator, StandingsService standingsService, InputService inputService) : base(eventAggregator, standingsService, inputService) { ShowEvent = EventAggregator.GetEvent<ShowEvent>(); _activeToken = ShowEvent.Subscribe((o) => IsActive = o); }
public QuestionWindowViewModel(IEventAggregator eventAggregator, StandingsService standingsService, InputService inputService) { _eventAggregator = eventAggregator; _standingsService = standingsService; _inputService = inputService; }
public PercentageQuestionWindowViewModel(IEventAggregator eventAggregator, StandingsService standingsService, InputService inputService) : base(eventAggregator, standingsService, inputService) { }