private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get <IPowerScheduler>(); if (ps == null) { return; } PowerSetting setting = ps.Settings.GetSetting("Processes"); TvBusinessLayer layer = new TvBusinessLayer(); // Get processes to be monitored string processes = layer.GetSetting("PowerSchedulerProcesses").Value; // Split processes into processList elements List <string> processList = new List <string>(); foreach (string process in processes.Split(',')) { processList.Add(process.Trim()); } // If something has changed... if (!IsEqual(processList, setting.Get <List <string> >())) { setting.Set <List <string> >(processList); _processList = processList; Log.Debug("ProcessActiveHandler: Preventing standby for processes: {0}", processes); } // Check for MP client running? setting = ps.Settings.GetSetting("CheckForMPClientRunning"); _checkForMPClientRunning = Convert.ToBoolean(layer.GetSetting("PowerSchedulerCheckForMPClientRunning", "false").Value); if (setting.Get <bool>() != _checkForMPClientRunning) { setting.Set <bool>(_checkForMPClientRunning); Log.Debug("ProcessActiveHandler: Prevent standby when MP client is not running : {0}", _checkForMPClientRunning); } // Check if away mode should be used setting = ps.Settings.GetSetting("ProcessesAwayMode"); _useAwayMode = Convert.ToBoolean(layer.GetSetting("PowerSchedulerProcessesAwayMode", "false").Value); if (setting.Get <bool>() != _useAwayMode) { setting.Set <bool>(_useAwayMode); Log.Debug("ProcessActiveHandler: Use away mode: {0}", _useAwayMode); } break; } }
private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get <IPowerScheduler>(); if (ps == null) { return; } PowerSetting setting = ps.Settings.GetSetting("Processes"); using (Settings reader = new MPSettings()) { // Get processes to be monitored string processes = reader.GetValueAsString("psclientplugin", "Processes", String.Empty); // Split processes into processList elements List <string> processList = new List <string>(); foreach (string process in processes.Split(',')) { processList.Add(process.Trim()); } // If something has changed... if (!IsEqual(processList, setting.Get <List <string> >())) { setting.Set <List <string> >(processList); _processList = processList; Log.Debug("ProcessActiveHandler: Preventing standby for processes: {0}", processes); } // Check if away mode should be used setting = ps.Settings.GetSetting("ProcessesAwayMode"); _useAwayMode = reader.GetValueAsBool("psclientplugin", "ProcessesAwayMode", false); if (setting.Get <bool>() != _useAwayMode) { setting.Set <bool>(_useAwayMode); Log.Debug("ProcessActiveHandler: Use away mode: {0}", _useAwayMode); } break; } } }
private void ProcessActiveHandler_OnPowerSchedulerEvent(PowerSchedulerEventArgs args) { switch (args.EventType) { case PowerSchedulerEventType.Started: case PowerSchedulerEventType.Elapsed: IPowerScheduler ps = GlobalServiceProvider.Instance.Get <IPowerScheduler>(); if (ps == null) { return; } PowerSetting setting = ps.Settings.GetSetting("Processes"); TvBusinessLayer layer = new TvBusinessLayer(); string processString = layer.GetSetting("PowerSchedulerProcesses").Value; List <string> processes = new List <string>(); foreach (string process in processString.Split(',')) { processes.Add(process.Trim()); } if (!IsEqual(processes, setting.Get <List <string> >())) { setting.Set <List <string> >(processes); _processes = processes; foreach (string process in processes) { Log.Debug("PowerScheduler: preventing standby for process: {0}", process); } } break; } }