From 68a8461a77b9534fa9bab6a8684f19661a23d89e Mon Sep 17 00:00:00 2001 From: Ionite Date: Sun, 25 Jun 2023 19:34:59 -0400 Subject: [PATCH] Catch notification errors from upstream Uwp issue --- StabilityMatrix/ViewModels/LaunchViewModel.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/StabilityMatrix/ViewModels/LaunchViewModel.cs b/StabilityMatrix/ViewModels/LaunchViewModel.cs index 272bd9de..04e6a7f8 100644 --- a/StabilityMatrix/ViewModels/LaunchViewModel.cs +++ b/StabilityMatrix/ViewModels/LaunchViewModel.cs @@ -226,10 +226,20 @@ public partial class LaunchViewModel : ObservableObject { webUiUrl = url; ShowWebUiButton = true; - new ToastContentBuilder() - .AddText("Stable Diffusion Web UI ready to go!") - .AddButton("Open Web UI", ToastActivationType.Foreground, url) - .Show(); + // Uwp toasts has upstream issues on some machines + // https://github.com/CommunityToolkit/WindowsCommunityToolkit/issues/4858 + try + { + new ToastContentBuilder() + .AddText("Stable Diffusion Web UI ready to go!") + .AddButton("Open Web UI", ToastActivationType.Foreground, url) + .Show(); + } + catch (Exception e) + { + logger.LogWarning("Failed to show Windows notification: {Message}", e.Message); + } + } public void OnLoaded()