Beispiel #1
0
        /// <summary>
        /// Starts this instance.
        /// </summary>
        /// <exception cref="System.NotImplementedException"></exception>
        public void Start()
        {
            if (IsDisposed)
            {
                Logger.Warn("Cannot Start DataReporter - it has been Disposed.");
                return;
            }

            if (IsStarted)
            {
                Logger.Info("Cannot Start DataReporter - it has already been started.");
                return;
            }

            Logger.Debug($"Starting DataReporter - DataExporter is a {DataExporter.GetType()}");

            lock (_locker)
            {
                IsStarted = true;

                // Set up timers for triggering push of data to HMS Cloud service.
                CasinoDataReportTimer             = new CHGTimer();
                CasinoDataReportTimer.TimerEvent += GetEgmDataForReport;
                CasinoDataReportTimer.Start(TimeSpan.FromMinutes(Settings.Default.CloudReportStartupDelay),
                                            TimeSpan.FromMinutes(Settings.Default.CloudReportInterval));

                // Note that if DoReportToCloud configuration parameter is set to False,
                // we set the DataBackup timers such that they never trigger
                DataBackupTimer             = new CHGTimer();
                DataBackupTimer.TimerEvent += GetWeeklyDataBackupFiles;
                DataBackupTimer.Start(Settings.Default.DoReportToCloud
                        ? TimeSpan.FromMinutes(Settings.Default.DataBackupStartupDelay)
                        : CHGTimer.DisableTimer,
                                      Settings.Default.DoReportToCloud
                        ? TimeSpan.FromMinutes(Settings.Default.DataBackupInterval)
                        : CHGTimer.DisableTimer);

                // Note that if DoReportToCloud configuration parameter is set to False,
                // we set the DiagnosticFile timers such that they never trigger
                DiagnosticsTimer             = new CHGTimer();
                DiagnosticsTimer.TimerEvent += GetDiagnosticsFiles;
                DiagnosticsTimer.Start(Settings.Default.DoReportToCloud
                        ? TimeSpan.FromMinutes(Settings.Default.DiagnosticsStartupDelay)
                        : CHGTimer.DisableTimer,
                                       Settings.Default.DoReportToCloud
                        ? TimeSpan.FromMinutes(Settings.Default.DiagnosticsInterval)
                        : CHGTimer.DisableTimer);
            }
        }