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());
 }
예제 #2
0
        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);
                    };
        }
예제 #3
0
        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);
                                                         }
                                                     };
        }
예제 #4
0
        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)
 {
 }