private void LoadUIFromConfig(LoadFromConfigDelegateArgs args) { // Check the selected custom-sensors. List <ThresholdSettings.PanelAndSensor> customSensors = ThresholdSettings.GetCustomSensors(); for (int sensor = 0; sensor < 4; ++sensor) { SensorSelectionButtons[sensor].IsChecked = IsSensorEnabled(customSensors, sensor); } }
private void RefreshSliderActiveProperty() { if (Type == "custom-sensors") { SliderActive = ThresholdSettings.GetCustomSensors().Count > 0; } else { SliderActive = ThresholdEnabled; } }
private void ClickedSensorButton(int sensor) { // Toggle the clicked sensor. Console.WriteLine("Clicked sensor " + sensor); List <ThresholdSettings.PanelAndSensor> customSensors = ThresholdSettings.GetCustomSensors(); bool enabled = !IsSensorEnabled(customSensors, sensor); if (enabled) { customSensors.Add(new ThresholdSettings.PanelAndSensor(Panel, sensor)); } else { customSensors.Remove(new ThresholdSettings.PanelAndSensor(Panel, sensor)); } ThresholdSettings.SetCustomSensors(customSensors); // Sync thresholds after changing custom sensors. ThresholdSettings.SyncSliderThresholds(); CurrentSMXDevice.singleton.FireConfigurationChanged(this); }