File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Microsoft.Toolkit.Uwp.UI.Controls.Core/InAppNotification Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -160,16 +160,17 @@ public void Show(object content, int duration = 0)
160160 /// <summary>
161161 /// Dismiss the notification
162162 /// </summary>
163- public void Dismiss ( )
163+ public void Dismiss ( bool dismissAll = false )
164164 {
165- Dismiss ( InAppNotificationDismissKind . Programmatic ) ;
165+ Dismiss ( InAppNotificationDismissKind . Programmatic , dismissAll ) ;
166166 }
167167
168168 /// <summary>
169169 /// Dismiss the notification
170170 /// </summary>
171171 /// <param name="dismissKind">Kind of action that triggered dismiss event</param>
172- private void Dismiss ( InAppNotificationDismissKind dismissKind )
172+ /// <param name="dismissAll">Indicates if one or all notifications should be dismissed.</param>
173+ private void Dismiss ( InAppNotificationDismissKind dismissKind , bool dismissAll = false )
173174 {
174175 if ( _stackedNotificationOptions . Count == 0 )
175176 {
@@ -179,8 +180,17 @@ private void Dismiss(InAppNotificationDismissKind dismissKind)
179180
180181 _dismissTimer . Stop ( ) ;
181182
183+ // Dismiss all if requested
184+ if ( dismissAll )
185+ {
186+ _stackedNotificationOptions . Clear ( ) ;
187+ }
188+ else
189+ {
190+ _stackedNotificationOptions . RemoveAt ( 0 ) ;
191+ }
192+
182193 // Continue to display notification if on remaining stacked notification
183- _stackedNotificationOptions . RemoveAt ( 0 ) ;
184194 if ( _stackedNotificationOptions . Any ( ) )
185195 {
186196 var notificationOptions = _stackedNotificationOptions [ 0 ] ;
You can’t perform that action at this time.
0 commit comments