diff --git a/WinUIGallery/App.xaml.cs b/WinUIGallery/App.xaml.cs
index 0b1edaa04..c7c6052cb 100644
--- a/WinUIGallery/App.xaml.cs
+++ b/WinUIGallery/App.xaml.cs
@@ -57,10 +57,13 @@ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs ar
EnsureWindow();
- MainWindow.Closed += (s, e) =>
+ if (NativeMethods.IsAppPackaged)
{
- BadgeNotificationManager.Current.ClearBadge();
- };
+ MainWindow.Closed += (s, e) =>
+ {
+ BadgeNotificationManager.Current.ClearBadge();
+ };
+ }
}
private void DebugSettings_BindingFailed(object sender, BindingFailedEventArgs e)
@@ -131,17 +134,20 @@ private async void EnsureWindow()
/// Details about the exception.
private void HandleExceptions(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e)
{
- e.Handled = true; //Don't crash the app.
-
- //Create the notification.
- var notification = new AppNotificationBuilder()
- .AddText("An exception was thrown.")
- .AddText($"Type: {e.Exception.GetType()}")
- .AddText($"Message: {e.Message}\r\n" +
- $"HResult: {e.Exception.HResult}")
- .BuildNotification();
-
- //Show the notification
- AppNotificationManager.Default.Show(notification);
+ if (NativeMethods.IsAppPackaged)
+ {
+ e.Handled = true; //Don't crash the app.
+
+ //Create the notification.
+ var notification = new AppNotificationBuilder()
+ .AddText("An exception was thrown.")
+ .AddText($"Type: {e.Exception.GetType()}")
+ .AddText($"Message: {e.Message}\r\n" +
+ $"HResult: {e.Exception.HResult}")
+ .BuildNotification();
+
+ //Show the notification
+ AppNotificationManager.Default.Show(notification);
+ }
}
}
diff --git a/WinUIGallery/Samples/ControlPages/BadgeNotificationManagerPage.xaml b/WinUIGallery/Samples/ControlPages/BadgeNotificationManagerPage.xaml
index d2b8a52ac..7c5886b2e 100644
--- a/WinUIGallery/Samples/ControlPages/BadgeNotificationManagerPage.xaml
+++ b/WinUIGallery/Samples/ControlPages/BadgeNotificationManagerPage.xaml
@@ -10,6 +10,7 @@
mc:Ignorable="d">
+