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; } }
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; } }
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(); } }
private static void OnFlashingPeriodPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { LED led = (LED)d; led.timer.Interval = TimeSpan.FromMilliseconds((int)e.NewValue); }