Exemple #1
0
 public PdfTimingReport(
     MeetingTimes data,
     HistoricalMeetingTimes?historicalASummary,
     IQueryWeekendService queryWeekendService,
     bool weekendIncludesFriday,
     string outputFolder)
 {
     _data = data;
     _historicalASummary    = historicalASummary;
     _queryWeekendService   = queryWeekendService;
     _weekendIncludesFriday = weekendIncludesFriday;
     _outputFolder          = outputFolder;
 }
        public OptionsService(
            ICommandLineService commandLineService,
            ILogLevelSwitchService logLevelSwitchService,
            IMonitorsService monitorsService,
            IDateTimeService dateTimeService,
            IQueryWeekendService queryWeekendService)
        {
            _commandLineService    = commandLineService;
            _logLevelSwitchService = logLevelSwitchService;
            _monitorsService       = monitorsService;
            _dateTimeService       = dateTimeService;
            _queryWeekendService   = queryWeekendService;

            WeakReferenceMessenger.Default.Register <LogLevelChangedMessage>(this, OnLogLevelChanged);
        }
        // generate report and return file path (or null)
        public static Task <string?> ExecuteAsync(
            ILocalTimingDataStoreService dataService,
            IDateTimeService dateTimeService,
            IQueryWeekendService queryWeekendService,
            bool weekendIncludesFriday,
            string?commandLineIdentifier)
        {
            return(Task.Run(() =>
            {
                if (!dataService.ValidCurrentMeetingTimes())
                {
                    dataService.PurgeCurrentMeetingTimes();
                    Log.Logger.Warning("Meeting times invalid so not stored");
                    return null;
                }

                var outputFolder = FileUtils.GetTimingReportsFolder(commandLineIdentifier);
                Log.Logger.Debug($"Timer report output folder = {outputFolder}");

                if (string.IsNullOrEmpty(outputFolder) || !Directory.Exists(outputFolder))
                {
                    return null;
                }

                var yearFolder = GetDatedOutputFolder(outputFolder, dateTimeService.Now());
                Directory.CreateDirectory(yearFolder);

                if (Directory.Exists(yearFolder))
                {
                    var data = dataService.GetCurrentMeetingTimes();
                    if (data != null)
                    {
                        var historicalTimes = dataService.GetHistoricalMeetingTimes();

                        var report = new PdfTimingReport(
                            data,
                            historicalTimes,
                            queryWeekendService,
                            weekendIncludesFriday,
                            yearFolder);

                        return report.Execute();
                    }
                }

                return null;
            }));
        }
Exemple #4
0
        private void WriteReport(
            DateTimeServiceForTests dateTimeService,
            IQueryWeekendService queryWeekendService,
            MeetingTimes lastMtgTimes)
        {
            var service         = new LocalTimingDataStoreService(null, dateTimeService);
            var historicalTimes = service.GetHistoricalMeetingTimes();

            var report = new PdfTimingReport(
                lastMtgTimes,
                historicalTimes,
                queryWeekendService,
                false,
                Path.GetTempPath());

            report.Execute();
        }
Exemple #5
0
        public OperatorPageViewModel(
            ITalkTimerService timerService,
            ITalkScheduleService scheduleService,
            IAdaptiveTimerService adaptiveTimerService,
            IOptionsService optionsService,
            ICommandLineService commandLineService,
            IBellService bellService,
            ILocalTimingDataStoreService timingDataService,
            ISnackbarService snackbarService,
            IDateTimeService dateTimeService,
            IQueryWeekendService queryWeekendService)
        {
            _scheduleService      = scheduleService;
            _optionsService       = optionsService;
            _adaptiveTimerService = adaptiveTimerService;
            _commandLineService   = commandLineService;
            _bellService          = bellService;
            _timerService         = timerService;
            _snackbarService      = snackbarService;
            _timingDataService    = timingDataService;
            _dateTimeService      = dateTimeService;
            _queryWeekendService  = queryWeekendService;

            _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);
            Messenger.Default.Register <AutoBellSettingChangedMessage>(this, OnAutoBellSettingChanged);
            Messenger.Default.Register <RefreshScheduleMessage>(this, OnRefreshSchedule);

            if (IsInDesignMode)
            {
                IsNewVersionAvailable = true;
            }

            GetVersionData();

            if (commandLineService.Automate)
            {
#if DEBUG
                var automationService = new AutomateService(
                    _optionsService,
                    _timerService,
                    scheduleService,
                    dateTimeService);

                automationService.Execute();
#endif
            }
        }