From 2595630647a5ae0f266f906d4c111b36c32bdf2c Mon Sep 17 00:00:00 2001 From: Efremov Alexey Date: Sat, 1 Feb 2020 13:43:45 +0700 Subject: [PATCH] added the check if the window is already closed --- Source/EyesGuard/Views/Animations/ShowAndFadeAnimations.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/EyesGuard/Views/Animations/ShowAndFadeAnimations.cs b/Source/EyesGuard/Views/Animations/ShowAndFadeAnimations.cs index 5b76f0d..affee34 100644 --- a/Source/EyesGuard/Views/Animations/ShowAndFadeAnimations.cs +++ b/Source/EyesGuard/Views/Animations/ShowAndFadeAnimations.cs @@ -15,7 +15,7 @@ public static void HideUsingLinearAnimation( int milliSeconds = 500, IEasingFunction easingFunction = null) { - if (element == null) return; + if (element == null || !element.IsVisible) return; var anim = new DoubleAnimation() { From = 1, @@ -37,7 +37,7 @@ public static Task HideUsingLinearAnimationAsync( { return Task.Run(async () => { - if (element == null) return; + if (element == null || !element.IsVisible) return; element.Dispatcher.Invoke(() => HideUsingLinearAnimation(element, milliSeconds, easingFunction)); await Task.Delay(milliSeconds); });