コード例 #1
0
        private static void OnColorNullPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LED led = (LED)d;

            led.ColorOff = (Color)e.NewValue;
            if (led.IsActive == null)
            {
                led.backgroundColor.Color = led.ColorNull;
            }
        }
コード例 #2
0
        private static void IsActivePropertyChanced(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LED led = (LED)d;

            if (led.IsActive == null)
            {
                led.backgroundColor.Color = led.ColorNull;
            }
            else if (led.IsActive == true)
            {
                led.backgroundColor.Color = led.ColorOn;
            }
            else
            {
                led.backgroundColor.Color = led.ColorOff;
            }
        }
コード例 #3
0
        private static void OnFlashingPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LED led = (LED)d;

            if (led.timer.IsEnabled)
            {
                led.timer.Stop();
                if (led.backgroundColor.Color == led.ColorNull)
                {
                    led.timer_Tick(null, new EventArgs());
                }
            }
            else
            {
                led.timer.Start();
            }
        }
コード例 #4
0
        private static void OnFlashingPeriodPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            LED led = (LED)d;

            led.timer.Interval = TimeSpan.FromMilliseconds((int)e.NewValue);
        }