Пример #1
0
        public SettingsPageViewModel(
            IMonitorsService monitorsService,
            IBellService bellService,
            IOptionsService optionsService,
            ISnackbarService snackbarService,
            ICountdownTimerTriggerService countdownTimerService)
        {
            // subscriptions...
            Messenger.Default.Register <ShutDownMessage>(this, OnShutDown);
            Messenger.Default.Register <BellStatusChangedMessage>(this, OnBellChanged);

            _optionsService        = optionsService;
            _snackbarService       = snackbarService;
            _monitorsService       = monitorsService;
            _bellService           = bellService;
            _countdownTimerService = countdownTimerService;

            _monitors            = GetSystemMonitors();
            _languages           = GetSupportedLanguages();
            _operatingModes      = GetOperatingModes();
            _screenLocationItems = GetScreenLocationItems();
            _autoMeetingTimes    = GetAutoMeetingTimes();
            _clockHourFormats    = GetClockHourFormats();
            _adaptiveModes       = GetAdaptiveModes();
            _timeOfDayModes      = GetTimeOfDayModes();
            _ports = GetPorts().ToArray();
            _persistDurationItems = optionsService.Options.GetPersistDurationItems();
            _loggingLevels        = GetLoggingLevels();

            // commands...
            NavigateOperatorCommand = new RelayCommand(NavigateOperatorPage);
            TestBellCommand         = new RelayCommand(TestBell, IsNotPlayingBell);
            OpenPortCommand         = new RelayCommand(ReserveAndOpenPort);
            WebClockUrlLinkCommand  = new RelayCommand(OpenWebClockLink);
        }
Пример #2
0
        public MainViewModel(
            IOptionsService optionsService,
            ITalkTimerService timerService,
            ISnackbarService snackbarService,
            IHttpServer httpServer,
            ICommandLineService commandLineService,
            ICountdownTimerTriggerService countdownTimerTriggerService,
            IDateTimeService dateTimeService,
            ITimerOutputDisplayService timerOutputDisplayService,
            ICountdownOutputDisplayService countdownDisplayService)
        {
            _commandLineService        = commandLineService;
            _dateTimeService           = dateTimeService;
            _timerOutputDisplayService = timerOutputDisplayService;
            _countdownDisplayService   = countdownDisplayService;

            if (commandLineService.NoGpu || ForceSoftwareRendering())
            {
                // disable hardware (GPU) rendering so that it's all done by the CPU...
                RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
            }

            _snackbarService = snackbarService;
            _optionsService  = optionsService;
            _httpServer      = httpServer;
            _timerService    = timerService;
            _countdownTimerTriggerService = countdownTimerTriggerService;

            _httpServer.RequestForTimerDataEvent += OnRequestForTimerData;

            // subscriptions...
            Messenger.Default.Register <NavigateMessage>(this, OnNavigate);
            Messenger.Default.Register <TimerMonitorChangedMessage>(this, OnTimerMonitorChanged);
            Messenger.Default.Register <CountdownMonitorChangedMessage>(this, OnCountdownMonitorChanged);
            Messenger.Default.Register <AlwaysOnTopChangedMessage>(this, OnAlwaysOnTopChanged);
            Messenger.Default.Register <HttpServerChangedMessage>(this, OnHttpServerChanged);
            Messenger.Default.Register <StopCountDownMessage>(this, OnStopCountdown);

            InitHttpServer();

            // should really create a "page service" rather than create views in the main view model!
            _pages.Add(OperatorPageViewModel.PageName, new OperatorPage());

            Messenger.Default.Send(new NavigateMessage(null, OperatorPageViewModel.PageName, null));

            // (fire and forget)
            Task.Run(LaunchTimerWindowAsync);

            InitHeartbeatTimer();
        }
Пример #3
0
        public MainViewModel(
            IOptionsService optionsService,
            IMonitorsService monitorsService,
            ITalkTimerService timerService,
            IHttpServer httpServer,
            IBellService bellService,
            ICountdownTimerTriggerService countdownTimerTriggerService)
        {
            _optionsService  = optionsService;
            _monitorsService = monitorsService;
            _bellService     = bellService;
            _httpServer      = httpServer;
            _timerService    = timerService;
            _countdownTimerTriggerService = countdownTimerTriggerService;

            // subscriptions...
            Messenger.Default.Register <NavigateMessage>(this, OnNavigate);
            Messenger.Default.Register <TimerMonitorChangedMessage>(this, OnTimerMonitorChanged);
            Messenger.Default.Register <AlwaysOnTopChangedMessage>(this, OnAlwaysOnTopChanged);
            Messenger.Default.Register <OvertimeMessage>(this, OnTalkOvertime);
            Messenger.Default.Register <HttpServerChangedMessage>(this, OnHttpServerChanged);
            Messenger.Default.Register <StopCountDownMessage>(this, OnStopCountdown);

            InitHttpServer();

            // should really create a "page service" rather than create views in the main view model!
            _pages.Add(OperatorPageViewModel.PageName, new OperatorPage());

            _timerWindowViewModel     = new TimerOutputWindowViewModel(_optionsService);
            _countdownWindowViewModel = new CountdownTimerViewModel();

            Messenger.Default.Send(new NavigateMessage(null, OperatorPageViewModel.PageName, null));

#pragma warning disable 4014
            // (fire and forget)
            LaunchTimerWindowAsync();
#pragma warning restore 4014
        }