Skip to content

Commit

Permalink
OnMessageDismissed event trigger unexpectedly when I set the Animatio…
Browse files Browse the repository at this point in the history
…nOut property with Delay. For solve this problem, I updated the 'DismissBefore' method with add listener to Animation.Completed event. With this update, OnMessageDimissed event trigger when AnimationOut fully completed
  • Loading branch information
UmutComlekci committed Oct 9, 2018
1 parent 0ac533d commit 10f951c
Showing 1 changed file with 44 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,28 @@ private static Action<INotificationMessage> DismissBefore(
{
return call =>
{
builder.Manager.Dismiss(builder.Message);
if (builder.Message is INotificationAnimation animatableMessage)
{
var animation = animatableMessage.AnimationOut;
if (animation != null &&
animatableMessage.Animates &&
animatableMessage.AnimatableElement != null &&
animatableMessage.AnimationOutDependencyProperty != null)
{
animation.Completed += (s, a) =>
{
builder.Manager.Dismiss(builder.Message);
};
}
else
{
builder.Manager.Dismiss(builder.Message);
}
}
else
{
builder.Manager.Dismiss(builder.Message);
}
callback?.Invoke(builder.Message);
};
}
Expand All @@ -251,7 +272,28 @@ private static Action<INotificationMessageButton> DismissBefore(
{
return button =>
{
builder.Manager.Dismiss(builder.Message);
if (builder.Message is INotificationAnimation animatableMessage)
{
var animation = animatableMessage.AnimationOut;
if (animation != null &&
animatableMessage.Animates &&
animatableMessage.AnimatableElement != null &&
animatableMessage.AnimationOutDependencyProperty != null)
{
animation.Completed += (s, a) =>
{
builder.Manager.Dismiss(builder.Message);
};
}
else
{
builder.Manager.Dismiss(builder.Message);
}
}
else
{
builder.Manager.Dismiss(builder.Message);
}
callback?.Invoke(button);
};
}
Expand Down

0 comments on commit 10f951c

Please sign in to comment.