示例#1
0
        public SettingsPageViewModel(
            IMonitorsService monitorsService,
            IBellService bellService,
            IOptionsService optionsService)
        {
            // subscriptions...
            Messenger.Default.Register <ShutDownMessage>(this, OnShutDown);
            Messenger.Default.Register <BellStatusChangedMessage>(this, OnBellChanged);

            _optionsService  = optionsService;
            _monitorsService = monitorsService;
            _bellService     = bellService;

            _monitors         = GetSystemMonitors().ToArray();
            _operatingModes   = GetOperatingModes().ToArray();
            _autoMeetingTimes = GetAutoMeetingTimes().ToArray();
            _clockHourFormats = GetClockHourFormats().ToArray();
            _adaptiveModes    = GetAdaptiveModes().ToArray();
            _timeOfDayModes   = GetTimeOfDayModes().ToArray();
            _ports            = GetPorts().ToArray();

            // commands...
            NavigateOperatorCommand = new RelayCommand(NavigateOperatorPage);
            TestBellCommand         = new RelayCommand(TestBell, IsNotPlayingBell);
            OpenPortCommand         = new RelayCommand(ReserveAndOpenPort);
            WebClockUrlLinkCommand  = new RelayCommand(OpenWebClockLink);
        }
示例#2
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);
        }
示例#3
0
        public ApiRouter(
            ApiThrottler apiThrottler,
            IOptionsService optionsService,
            IBellService bellService,
            ITalkTimerService timerService,
            ITalkScheduleService talksService,
            IDateTimeService dateTimeService)
        {
            _apiThrottler    = apiThrottler;
            _optionsService  = optionsService;
            _dateTimeService = dateTimeService;

            _timersApiController = new Lazy <TimersApiController>(() =>
                                                                  new TimersApiController(timerService, talksService, _optionsService, _apiThrottler));

            _dateTimeApiController = new Lazy <DateTimeApiController>(() =>
                                                                      new DateTimeApiController(_apiThrottler));

            _bellApiController = new Lazy <BellApiController>(() =>
                                                              new BellApiController(_optionsService, bellService, _apiThrottler));

            _systemApiController = new Lazy <SystemApiController>(() =>
                                                                  new SystemApiController(_optionsService, _apiThrottler));

            _webHooksApiController = new Lazy <WebHooksApiController>(() =>
                                                                      new WebHooksApiController());
        }
示例#4
0
        public MainViewModel(
            IOptionsService optionsService,
            IMonitorsService monitorsService,
            ITalkTimerService timerService,
            IBellService bellService)
        {
            _optionsService  = optionsService;
            _monitorsService = monitorsService;
            _bellService     = bellService;
            _timerService    = timerService;

            // 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);

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

            _timerWindowViewModel = new TimerOutputWindowViewModel(_optionsService);

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

#pragma warning disable 4014
            // (fire and forget)
            LaunchTimerWindowAsync();
#pragma warning restore 4014
        }
示例#5
0
 public BellApiController(
     IOptionsService optionsService,
     IBellService bellService,
     ApiThrottler apiThrottler)
 {
     _optionsService = optionsService;
     _bellService    = bellService;
     _apiThrottler   = apiThrottler;
 }
示例#6
0
        public HttpServer(
            IOptionsService optionsService,
            IBellService bellService,
            ITalkTimerService timerService,
            ITalkScheduleService talksService)
        {
            _optionsService = optionsService;

            _apiThrottler = new ApiThrottler(optionsService);

            _apiRouter = new ApiRouter(_apiThrottler, _optionsService, bellService, timerService, talksService);
        }
示例#7
0
        public HttpServer(
            IOptionsService optionsService,
            IBellService bellService,
            ITalkTimerService timerService,
            ITalkScheduleService talksService)
        {
            _optionsService = optionsService;

            _clock24Hour  = new DateTime(1, 1, 1, 23, 1, 1).ToShortTimeString().Contains("23");
            _apiThrottler = new ApiThrottler(optionsService);

            _apiRouter = new ApiRouter(_apiThrottler, _optionsService, bellService, timerService, talksService);
        }
        public OperatorPageViewModel(
            ITalkTimerService timerService,
            ITalkScheduleService scheduleService,
            IAdaptiveTimerService adaptiveTimerService,
            IOptionsService optionsService,
            ICommandLineService commandLineService,
            IBellService bellService)
        {
            _scheduleService                 = scheduleService;
            _optionsService                  = optionsService;
            _adaptiveTimerService            = adaptiveTimerService;
            _commandLineService              = commandLineService;
            _bellService                     = bellService;
            _timerService                    = timerService;
            _timerService.TimerChangedEvent += TimerChangedHandler;
            _countUp = _optionsService.Options.CountUp;

            SelectFirstTalk();

            _timerService.TimerStartStopFromApiEvent += HandleTimerStartStopFromApi;

            // commands...
            StartCommand            = new RelayCommand(StartTimer, () => IsNotRunning && IsValidTalk, true);
            StopCommand             = new RelayCommand(StopTimer, () => IsRunning);
            SettingsCommand         = new RelayCommand(NavigateSettings, () => IsNotRunning && !_commandLineService.NoSettings);
            HelpCommand             = new RelayCommand(LaunchHelp);
            NewVersionCommand       = new RelayCommand(DisplayNewVersionPage);
            IncrementTimerCommand   = new RelayCommand(IncrementTimer, CanIncreaseTimerValue);
            IncrementTimer15Command = new RelayCommand(IncrementTimer15Secs, CanIncreaseTimerValue);
            IncrementTimer5Command  = new RelayCommand(IncrementTimer5Mins, CanIncreaseTimerValue);
            DecrementTimerCommand   = new RelayCommand(DecrementTimer, CanDecreaseTimerValue);
            DecrementTimer15Command = new RelayCommand(DecrementTimer15Secs, CanDecreaseTimerValue);
            DecrementTimer5Command  = new RelayCommand(DecrementTimer5Mins, CanDecreaseTimerValue);
            BellToggleCommand       = new RelayCommand(BellToggle);
            CountUpToggleCommand    = new RelayCommand(CountUpToggle);
            CloseCountdownCommand   = new RelayCommand(CloseCountdownWindow);

            // subscriptions...
            Messenger.Default.Register <OperatingModeChangedMessage>(this, OnOperatingModeChanged);
            Messenger.Default.Register <AutoMeetingChangedMessage>(this, OnAutoMeetingChanged);
            Messenger.Default.Register <CountdownWindowStatusChangedMessage>(this, OnCountdownWindowStatusChanged);
            Messenger.Default.Register <ShowCircuitVisitToggleChangedMessage>(this, OnShowCircuitVisitToggleChanged);

            if (IsInDesignMode)
            {
                IsNewVersionAvailable = true;
            }

            GetVersionData();
        }