Exemple #1
0
 public CountdownOutputDisplayService(
     IMonitorsService monitorsService,
     IOptionsService optionsService,
     IDateTimeService dateTimeService,
     ITimerOutputDisplayService timerOutputDisplayService,
     ISnackbarService snackbarService)
     : base(optionsService)
 {
     _monitorsService           = monitorsService;
     _optionsService            = optionsService;
     _dateTimeService           = dateTimeService;
     _timerOutputDisplayService = timerOutputDisplayService;
     _snackbarService           = snackbarService;
 }
Exemple #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();
        }