Esempio n. 1
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            slider           = GetTemplateChild("Slider") as DoubleSlider;
            LowerLabel       = GetTemplateChild("LowerValue") as Label;
            UpperLabel       = GetTemplateChild("UpperValue") as Label;
            ThresholdWarning = GetTemplateChild("ThresholdWarning") as Image;
            SensorDisplay    = GetTemplateChild("PlatformSensorDisplay") as PlatformSensorDisplay;

            slider.ValueChanged += delegate(DoubleSlider slider) { SaveToConfig(); };

            // Show the edit button for the custom-sensors slider.
            Button EditCustomSensorsButton = GetTemplateChild("EditCustomSensorsButton") as Button;

            EditCustomSensorsButton.Visibility = Type == "custom-sensors"? Visibility.Visible:Visibility.Hidden;
            EditCustomSensorsButton.Click     += delegate(object sender, RoutedEventArgs e)
            {
                SetCustomSensors dialog = new SetCustomSensors();
                dialog.Owner = Window.GetWindow(this);
                dialog.ShowDialog();
            };

            onConfigChange = new OnConfigChange(this, delegate(LoadFromConfigDelegateArgs args) {
                LoadUIFromConfig(ActivePad.GetFirstActivePadConfig(args));
            });
        }
        private static object UpperValueCoerceValueCallback(DependencyObject target, object valueObject)
        {
            DoubleSlider slider = target as DoubleSlider;
            double       value  = (double)valueObject;

            value = slider.CoerceValueToLimits(value);
            return(value);
        }
        private static void SliderValueChangedCallback(DependencyObject target, DependencyPropertyChangedEventArgs args)
        {
            DoubleSlider slider = target as DoubleSlider;

            if (slider.ValueChanged != null)
            {
                slider.ValueChanged.Invoke(slider);
            }
        }
Esempio n. 4
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            slider     = GetTemplateChild("Slider") as DoubleSlider;
            LowerLabel = GetTemplateChild("LowerValue") as Label;
            UpperLabel = GetTemplateChild("UpperValue") as Label;

            slider.ValueChanged += delegate(DoubleSlider slider) { SaveToConfig(); };

            onConfigChange = new OnConfigChange(this, delegate(LoadFromConfigDelegateArgs args) {
                LoadUIFromConfig(ActivePad.GetFirstActivePadConfig(args));
            });
        }