Пример #1
0
        protected override void OnClick()
        {
            Properties.Settings.Default.AdvancedMode = !Properties.Settings.Default.AdvancedMode;
            if (!Properties.Settings.Default.AdvancedMode)
            {
                // Sync thresholds when we exit advanced mode.  XXX: not needed since MainWindow is recreating
                // sliders anyway
                ThresholdSettings.SyncSliderThresholds();
            }

            // Refresh the UI.
            LoadUIFromConfig(ActivePad.GetFirstActivePadConfig());
        }
Пример #2
0
        private void SaveToSettings()
        {
            if (Type == "inner-sensors")
            {
                Properties.Settings.Default.UseInnerSensorThresholds = (bool)IsChecked;
            }
            else if (Type == "outer-sensors")
            {
                Properties.Settings.Default.UseOuterSensorThresholds = (bool)IsChecked;
            }

            Helpers.SaveApplicationSettings();

            // Sync thresholds after enabling or disabling a slider.
            ThresholdSettings.SyncSliderThresholds();

            CurrentSMXDevice.singleton.FireConfigurationChanged(this);
        }
        void CreateThresholdSliders()
        {
            // Remove and recreate threshold sliders.
            ThresholdSliderContainer.Children.Clear();
            foreach (string sliderName in ThresholdSettings.thresholdSliderNames)
            {
                if (!IsThresholdSliderShown(sliderName))
                {
                    continue;
                }

                ThresholdSlider slider = CreateThresholdSlider(sliderName);
                DockPanel.SetDock(slider, Dock.Top);
                slider.Margin = new Thickness(0, 8, 0, 0);
                ThresholdSliderContainer.Children.Add(slider);
            }

            ThresholdSettings.SyncSliderThresholds();
        }
        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);
        }