Skip to content

Commit

Permalink
added the check if the window is already closed
Browse files Browse the repository at this point in the history
  • Loading branch information
baradgur committed Feb 1, 2020
1 parent 70869c3 commit 2595630
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/EyesGuard/Views/Animations/ShowAndFadeAnimations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
});
Expand Down

0 comments on commit 2595630

Please sign in to comment.