Пример #1
0
        public JeopardyViewModel(IEventAggregator eventAggregator)
        {
            State = GameState.Jeopardy;
            this.eventAggregator = eventAggregator;
            eventAggregator.GetEvent <PubSubEvent <GameState> >().Subscribe(s => State = s);

            kb = ServiceLocator.Current.GetInstance <IKeyboardCapture>();
            kb.KeyboardNotification += Kb_KeyboardNotification;
        }
Пример #2
0
        public AddPlayersPage()
        {
            InitializeComponent();
            DataContext = this;
            Users       = new ObservableCollection <UserViewModel>();
            kb          = ServiceLocator.Current.GetInstance <IKeyboardCapture>();

            var container = ServiceLocator.Current.GetInstance <CompositionContainer>();

            container.ComposeExportedValue("Players", Users);

            eventAggregator      = ServiceLocator.Current.GetInstance <IEventAggregator>();
            NextButton.IsEnabled = false;
        }
        public PresenterFacingWindow(IEventAggregator eventAggregator)
        {
            InitializeComponent();

            kb = ServiceLocator.Current.GetInstance <IKeyboardCapture>();
            kb.RegisterWindow(this);

            //var contianer = ServiceLocator.Current.GetInstance<CompositionContainer>();
            //contianer.ComposeExportedValue(kb);

            eventAggregator.GetEvent <PubSubEvent <JeopardyViewModel> >().Subscribe((vm) =>
            {
                if (Content != null)
                {
                    var oldContent  = Content as PresenterFacingGameMain;
                    var mainControl = oldContent?.MainContent?.Content as PlayMainControl;
                    mainControl?.Dispose();
                }
                Content = new PresenterFacingGameMain(vm);
            });

            this.eventAggregator = eventAggregator;
        }