Example #1
0
        static void IsColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            SolidColorBrush newVal = null;

            SpectrumAnalyzer s = d as SpectrumAnalyzer;

            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);
            }

            s._color = System.Drawing.Color.FromArgb(newVal.Color.A, newVal.Color.R, newVal.Color.G, newVal.Color.B);

            Func <int, int, int> funcDarken = new Func <int, int, int>((color, dark) => {
                int val = color - dark;
                return(val < 0 ? 0 : val);
            });

            s._color2 = System.Drawing.Color.FromArgb(
                funcDarken(newVal.Color.A, 128),
                funcDarken(newVal.Color.R, 128),
                funcDarken(newVal.Color.G, 128),
                funcDarken(newVal.Color.B, 128));
        }
Example #2
0
        static void IsStreamChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            int newVal         = (int)e.NewValue;
            SpectrumAnalyzer s = d as SpectrumAnalyzer;

            //s._stream = newVal;

            s.CheckOnStateChanged();
        }
Example #3
0
        static void IsPlayingChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            bool             newVal = (bool)e.NewValue;
            SpectrumAnalyzer s      = d as SpectrumAnalyzer;

            //s._isStreamPlaying = newVal;

            s.CheckOnStateChanged();
        }
Example #4
0
        static void OnDisplayChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            DISPLAY newVal = (DISPLAY)e.NewValue;

            SpectrumAnalyzer s = d as SpectrumAnalyzer;

            //s._display = newVal;

            s.CheckOnStateChanged();
        }
Example #5
0
        static void SpectrumAnalyzer_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            SpectrumAnalyzer s = sender as SpectrumAnalyzer;

            s.CheckOnStateChanged();
        }