bool IJob.Initialize(IServiceProvider serviceProvider) { _settings = serviceProvider.GetService <ISettingsServiceInternal>(); string settingString = _settings.GetSetting("DisplayWakeUpJob", "DisplayConfiguration").GetValue <string>(); _configurations.AddRange(DisplayConfiguration.ParseSettingString(settingString)); if (_configurations.Count == 0) { Logger.Instance.LogFormat(LogType.Error, this, Properties.Resources.NoConfigurationsFoundError); return(false); } _autoSleepAfterMinutes = _settings.GetSetting("DisplayWakeUpJob", "TurnOffTimeout").GetValue <int>(); if (_autoSleepAfterMinutes > 0) { _autoSleepTimerThread = new Thread(AutoSleepTimerThread); _autoSleepTimerThread.Name = "Auto-sleep timer thread"; _autoSleepTimerThread.Priority = ThreadPriority.BelowNormal; _autoSleepTimerThread.IsBackground = true; _autoSleepTimerThread.Start(); } _ignoreErrorInResponse = _settings.GetSetting("DisplayWakeUpJob", "IgnoreErrorInResponse").GetValue <bool>(); return(true); }
bool IJob.Initialize() { string settingString = SettingsManager.Instance.GetSetting("DisplayWakeUpJob", "DisplayConfiguration").GetString(); _configurations.AddRange(DisplayConfiguration.ParseSettingString(settingString)); if (_configurations.Count == 0) { Logger.Instance.LogFormat(LogType.Error, this, Properties.Resources.NoConfigurationsFoundError); return(false); } int turnOffTimeout = SettingsManager.Instance.GetSetting("DisplayWakeUpJob", "TurnOffTimeout").GetInt32(); if (turnOffTimeout > 0) { // TODO: Start background thread which checks all 60 seconds for automatically turning } return(true); }