Skip to content

Commit 9b08237

Browse files
committed
add missing timer stop
1 parent 9658240 commit 9b08237

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

Microsoft.Toolkit.Uwp.UI.Controls/InAppNotification/InAppNotification.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,6 @@ protected override void OnApplyTemplate()
8080
/// <param name="duration">Displayed duration of the notification in ms (less or equal 0 means infinite duration)</param>
8181
public void Show(int duration = 0)
8282
{
83-
_dismissTimer.Stop();
84-
85-
var eventArgs = new InAppNotificationOpeningEventArgs();
86-
Opening?.Invoke(this, eventArgs);
87-
88-
if (eventArgs.Cancel)
89-
{
90-
return;
91-
}
92-
9383
// We keep our current content
9484
var notificationOptions = new NotificationOptions
9585
{
@@ -258,6 +248,14 @@ private void UpdateContent(NotificationOptions notificationOptions)
258248
/// <param name="notificationOptions">Information about the notification to display</param>
259249
private void Show(NotificationOptions notificationOptions)
260250
{
251+
var eventArgs = new InAppNotificationOpeningEventArgs();
252+
Opening?.Invoke(this, eventArgs);
253+
254+
if (eventArgs.Cancel)
255+
{
256+
return;
257+
}
258+
261259
var shouldDisplayImmediately = true;
262260
switch (StackMode)
263261
{
@@ -288,6 +286,10 @@ private void Show(NotificationOptions notificationOptions)
288286
_dismissTimer.Interval = TimeSpan.FromMilliseconds(notificationOptions.Duration);
289287
_dismissTimer.Start();
290288
}
289+
else
290+
{
291+
_dismissTimer.Stop();
292+
}
291293
}
292294
}
293295
}

0 commit comments

Comments
 (0)