static void IsStreamChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { int newVal = (int)e.NewValue; PeakLevel s = d as PeakLevel; s.stream = newVal; }
static void IsPlayingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { bool newVal = (bool)e.NewValue; PeakLevel s = d as PeakLevel; if (newVal) { s.timer.Start(); s.ChangeColor(s.Color); } else { s.timer.Stop(); s.ChangeColor(new SolidColorBrush(Colors.Transparent)); } }
static void IsColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { SolidColorBrush newVal = null; PeakLevel s = d as PeakLevel; if (e.NewValue.GetType() == typeof(SolidColorBrush)) { newVal = (SolidColorBrush)e.NewValue; } else if (e.NewValue.GetType() == typeof(LinearGradientBrush)) { LinearGradientBrush lgb = (LinearGradientBrush)e.NewValue; newVal = new SolidColorBrush(lgb.GradientStops[lgb.GradientStops.Count - 1].Color); } if (s.IsPlaying) { s.ChangeColor(newVal); } }