public Backend(InstanceType instanceType, AppType appType) { settingsCollection = SettingsCollectionSerializer.DeSerialize(); trackUsage = new TrackUsage(settingsCollection.AppSettings, settingsCollection.InternalSettings, instanceType, appType); versionControl = new VersionControl(instanceType, appType, trackUsage); jiraTimerCollection = new JiraTimerCollection(settingsCollection.ExportSettings); jiraTimerCollection.exportPrompt += OnExportPromptEvent; jiraConnection = new JiraConnection(trackUsage); idleTimerCollection = new IdleTimerCollection(); ActivityChecker = new ActivityChecker(jiraTimerCollection, settingsCollection.AppSettings); ActivityChecker.NoActivityEvent += OnNoActivityEvent; hearbeat = new Timer(1800000); hearbeat.Elapsed += HearbeatOnElapsed; hearbeat.Start(); if (Settings.AppSettings.TimerRunningOnShutdown.HasValue) { var timer = jiraTimerCollection.GetTimer(Settings.AppSettings.TimerRunningOnShutdown.Value); if (timer != null && timer.DateStarted.Date == DateTime.Now.Date) { JiraTimerCollection.StartTimer(Settings.AppSettings.TimerRunningOnShutdown.Value); } Settings.AppSettings.TimerRunningOnShutdown = null; SaveSettings(false); } HearbeatOnElapsed(this, null); }
public Backend(InstanceType instanceType) { settingsCollection = SettingsCollectionSerializer.DeSerialize(); trackUsage = new TrackUsage(settingsCollection.AppSettings, settingsCollection.InternalSettings, instanceType); versionControl = new VersionControl(instanceType, trackUsage); jiraTimerCollection = new JiraTimerCollection(settingsCollection.ExportSettings, trackUsage); jiraTimerCollection.exportPrompt += OnExportPromptEvent; jiraConnection = new JiraConnection(trackUsage); idleTimerCollection = new IdleTimerCollection(); ActivityChecker = new ActivityChecker(jiraTimerCollection, settingsCollection.AppSettings); withThanksCreator = new WithThanksCreator(); premiumChecker = new PremiumChecker(); ActivityChecker.NoActivityEvent += OnNoActivityEvent; var cleanUpAndTrackingHearbeat = new Timer(TimeSpan.FromMinutes(15).TotalMilliseconds); cleanUpAndTrackingHearbeat.Elapsed += CleanUpAndTrackingHearbeatOnElapsed; cleanUpAndTrackingHearbeat.Start(); exportedHeartbeatMutex = new Mutex(false); var jiraExportHearbeat = new Timer(TimeSpan.FromMinutes(10).TotalMilliseconds); jiraExportHearbeat.Elapsed += JiraExportHearbeatHearbeatOnElapsed; jiraExportHearbeat.Start(); if (Settings.AppSettings.TimerRunningOnShutdown.HasValue) { var timer = jiraTimerCollection.GetTimer(Settings.AppSettings.TimerRunningOnShutdown.Value); if (timer != null && timer.DateStarted.Date == DateTime.Now.Date) { JiraTimerCollection.StartTimer(Settings.AppSettings.TimerRunningOnShutdown.Value); } Settings.AppSettings.TimerRunningOnShutdown = null; SaveSettings(false); } }
public Backend() { appSettings = AppSettingsSerializer.DeSerialize(); jiraConnectionSettings = JiraConnectionSettingsSerializer.DeSerialize(); jiraTimerCollection = new JiraTimerCollection(); idleTimerCollection = new IdleTimerCollection(); ActivityChecker = new ActivityChecker(jiraTimerCollection, appSettings); ActivityChecker.NoActivityEvent += OnNoActivityEvent; hearbeat = new Timer(3600000); hearbeat.Elapsed += HearbeatOnElapsed; hearbeat.Start(); }