From cf70450d0fc1123a812c83f7cf836f3ebb704b2c Mon Sep 17 00:00:00 2001 From: Huajiang Wei Date: Sat, 3 Feb 2018 00:19:42 +0800 Subject: [PATCH] Update MainWindow.xaml.cs add tag, group to notification when closing, remove the notification --- DesktopToast.Wpf/MainWindow.xaml.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DesktopToast.Wpf/MainWindow.xaml.cs b/DesktopToast.Wpf/MainWindow.xaml.cs index a2c0482..6b88341 100644 --- a/DesktopToast.Wpf/MainWindow.xaml.cs +++ b/DesktopToast.Wpf/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.ComponentModel; using System.IO; @@ -42,11 +42,16 @@ protected override void OnSourceInitialized(EventArgs e) protected override void OnClosing(CancelEventArgs e) { + ToastManager.Remove("abcd","group", "DesktopToast.Wpf"); base.OnClosing(e); // For Action Center of Windows 10 NotificationActivator.UnregisterComType(); } + protected override void OnClosed(EventArgs e) + { + base.OnClosed(e); + } private const string MessageId = "Message"; @@ -165,7 +170,7 @@ private async Task ShowInteractiveToastAsync() ActivatorId = typeof(NotificationActivator).GUID }; - var result = await ToastManager.ShowAsync(request); + var result = await ToastManager.ShowAsync(request,"abcd","group"); return result.ToString(); } @@ -204,7 +209,6 @@ private string ComposeInteractiveToast() { Visual = toastVisual, Actions = toastAction, - Duration = ToastDuration.Long, Audio = new NotificationsExtensions.Toasts.ToastAudio { Loop = true, @@ -215,4 +219,4 @@ private string ComposeInteractiveToast() return toastContent.GetContent(); } } -} \ No newline at end of file +}