示例#1
0
        public OperatorPageViewModel(
            ITalkTimerService timerService,
            ITalkScheduleService scheduleService,
            IAdaptiveTimerService adaptiveTimerService,
            IOptionsService optionsService)
        {
            _scheduleService                 = scheduleService;
            _optionsService                  = optionsService;
            _adaptiveTimerService            = adaptiveTimerService;
            _timerService                    = timerService;
            _timerService.TimerChangedEvent += TimerChangedHandler;

            SelectFirstTalk();

            _talkTitle = _unknownTalkTitle;

            StartCommand            = new RelayCommand(StartTimer, () => IsNotRunning);
            StopCommand             = new RelayCommand(StopTimer, () => IsRunning);
            SettingsCommand         = new RelayCommand(NavigateSettings, () => IsNotRunning);
            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);

            // subscriptions...
            Messenger.Default.Register <OperatingModeChangedMessage>(this, OnOperatingModeChanged);
            Messenger.Default.Register <AutoMeetingChangedMessage>(this, OnAutoMeetingChanged);
        }
        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();
        }