protected override void OnRenderMouseOverChanged(ButtonChrome d, DependencyPropertyChangedEventArgs e) { var chrome = (AeroButtonChrome)d; if (chrome.Animates) { if (!chrome.RenderPressed) { if ((bool)e.NewValue) { if (chrome._localResources == null) { chrome._localResources = new OverlayResources(); chrome.InvalidateVisual(); } Duration duration = new Duration(TimeSpan.FromSeconds(0.3)); DoubleAnimation animation = new DoubleAnimation(1.0, duration); chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, animation); chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, animation); } else if (chrome._localResources == null) { chrome.InvalidateVisual(); } else if (chrome.RenderDefaulted) { double opacity = chrome.BackgroundOverlay.Opacity; double num2 = (1.0 - opacity) * 0.5; DoubleAnimationUsingKeyFrames timeline = new DoubleAnimationUsingKeyFrames(); timeline.KeyFrames.Add(new LinearDoubleKeyFrame(1.0, TimeSpan.FromSeconds(num2))); timeline.KeyFrames.Add(new DiscreteDoubleKeyFrame(1.0, TimeSpan.FromSeconds(num2 + 0.25))); timeline.KeyFrames.Add(new LinearDoubleKeyFrame(0.0, TimeSpan.FromSeconds(num2 + 1.5))); timeline.KeyFrames.Add(new LinearDoubleKeyFrame(opacity, TimeSpan.FromSeconds(2.0))); timeline.RepeatBehavior = RepeatBehavior.Forever; Timeline.SetDesiredFrameRate(timeline, 10); chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, timeline); chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, timeline); } else { Duration duration2 = new Duration(TimeSpan.FromSeconds(0.2)); DoubleAnimation animation2 = new DoubleAnimation(); animation2.Duration = duration2; chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, animation2); chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, animation2); } } } else { chrome._localResources = null; chrome.InvalidateVisual(); } }
protected override void OnRenderDefaultedChanged(ButtonChrome d, DependencyPropertyChangedEventArgs e) { var chrome = (AeroButtonChrome)d; if (chrome.Animates) { if (!chrome.RenderPressed) { if ((bool)e.NewValue) { if (chrome._localResources == null) { chrome._localResources = new OverlayResources(); chrome.InvalidateVisual(); } Duration duration = new Duration(TimeSpan.FromSeconds(0.3)); ColorAnimation animation = new ColorAnimation(Color.FromArgb(249, 0, 204, 255), duration); GradientStopCollection gradientStops = ((LinearGradientBrush)chrome.InnerBorderPen.Brush).GradientStops; gradientStops[0].BeginAnimation(GradientStop.ColorProperty, animation); gradientStops[1].BeginAnimation(GradientStop.ColorProperty, animation); DoubleAnimationUsingKeyFrames timeline = new DoubleAnimationUsingKeyFrames(); timeline.KeyFrames.Add(new LinearDoubleKeyFrame(1.0, TimeSpan.FromSeconds(0.5))); timeline.KeyFrames.Add(new DiscreteDoubleKeyFrame(1.0, TimeSpan.FromSeconds(0.75))); timeline.KeyFrames.Add(new LinearDoubleKeyFrame(0.0, TimeSpan.FromSeconds(2.0))); timeline.RepeatBehavior = RepeatBehavior.Forever; Timeline.SetDesiredFrameRate(timeline, 10); chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, timeline); chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, timeline); } else if (chrome._localResources == null) { chrome.InvalidateVisual(); } else { Duration duration2 = new Duration(TimeSpan.FromSeconds(0.2)); DoubleAnimation animation2 = new DoubleAnimation(); animation2.Duration = duration2; chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, animation2); chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, animation2); ColorAnimation animation3 = new ColorAnimation(); animation3.Duration = duration2; GradientStopCollection stops2 = ((LinearGradientBrush)chrome.InnerBorderPen.Brush).GradientStops; stops2[0].BeginAnimation(GradientStop.ColorProperty, animation3); stops2[1].BeginAnimation(GradientStop.ColorProperty, animation3); } } } else { chrome._localResources = null; chrome.InvalidateVisual(); } }
protected override void OnRenderPressedChanged(ButtonChrome d, DependencyPropertyChangedEventArgs e) { var chrome = (AeroButtonChrome)d; if (chrome.Animates) { if ((bool)e.NewValue) { if (chrome._localResources == null) { chrome._localResources = new OverlayResources(); chrome.InvalidateVisual(); } Duration duration = new Duration(TimeSpan.FromSeconds(0.1)); DoubleAnimation animation = new DoubleAnimation(1.0, duration); chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, animation); chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, animation); chrome.LeftDropShadowBrush.BeginAnimation(Brush.OpacityProperty, animation); chrome.TopDropShadowBrush.BeginAnimation(Brush.OpacityProperty, animation); animation = new DoubleAnimation(0.0, duration); chrome.InnerBorderPen.Brush.BeginAnimation(Brush.OpacityProperty, animation); ColorAnimation animation2 = new ColorAnimation(Color.FromRgb(194, 228, 246), duration); GradientStopCollection gradientStops = ((LinearGradientBrush)chrome.BackgroundOverlay).GradientStops; gradientStops[0].BeginAnimation(GradientStop.ColorProperty, animation2); gradientStops[1].BeginAnimation(GradientStop.ColorProperty, animation2); animation2 = new ColorAnimation(Color.FromRgb(171, 218, 243), duration); gradientStops[2].BeginAnimation(GradientStop.ColorProperty, animation2); animation2 = new ColorAnimation(Color.FromRgb(144, 203, 235), duration); gradientStops[3].BeginAnimation(GradientStop.ColorProperty, animation2); animation2 = new ColorAnimation(Color.FromRgb(44, 98, 139), duration); chrome.BorderOverlayPen.Brush.BeginAnimation(SolidColorBrush.ColorProperty, animation2); } else if (chrome._localResources == null) { chrome.InvalidateVisual(); } else { bool renderMouseOver = chrome.RenderMouseOver; Duration duration2 = new Duration(TimeSpan.FromSeconds(0.1)); DoubleAnimation animation3 = new DoubleAnimation(); animation3.Duration = duration2; chrome.LeftDropShadowBrush.BeginAnimation(Brush.OpacityProperty, animation3); chrome.TopDropShadowBrush.BeginAnimation(Brush.OpacityProperty, animation3); chrome.InnerBorderPen.Brush.BeginAnimation(Brush.OpacityProperty, animation3); if (!renderMouseOver) { chrome.BorderOverlayPen.Brush.BeginAnimation(Brush.OpacityProperty, animation3); chrome.BackgroundOverlay.BeginAnimation(Brush.OpacityProperty, animation3); } ColorAnimation animation4 = new ColorAnimation(); animation4.Duration = duration2; chrome.BorderOverlayPen.Brush.BeginAnimation(SolidColorBrush.ColorProperty, animation4); GradientStopCollection stops2 = ((LinearGradientBrush)chrome.BackgroundOverlay).GradientStops; stops2[0].BeginAnimation(GradientStop.ColorProperty, animation4); stops2[1].BeginAnimation(GradientStop.ColorProperty, animation4); stops2[2].BeginAnimation(GradientStop.ColorProperty, animation4); stops2[3].BeginAnimation(GradientStop.ColorProperty, animation4); } } else { chrome._localResources = null; chrome.InvalidateVisual(); } }
protected virtual void OnRenderPressedChanged(ButtonChrome chrome, DependencyPropertyChangedEventArgs args) { }
protected virtual void OnRenderMouseOverChanged(ButtonChrome chrome, DependencyPropertyChangedEventArgs args) { }
protected virtual void OnRenderDefaultedChanged(ButtonChrome chrome, DependencyPropertyChangedEventArgs args) { }