diff --git a/EnvyUpdate/App.xaml.cs b/EnvyUpdate/App.xaml.cs index 35ec068..0f2c184 100644 --- a/EnvyUpdate/App.xaml.cs +++ b/EnvyUpdate/App.xaml.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Toolkit.Uwp.Notifications; +using System; using System.Collections.Generic; using System.Configuration; using System.Data; @@ -6,6 +7,7 @@ using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Windows; +using Windows.Foundation.Collections; namespace EnvyUpdate { @@ -14,5 +16,23 @@ namespace EnvyUpdate /// public partial class App : Application { + protected override void OnStartup(StartupEventArgs e) + { + // Listen to notification activation + ToastNotificationManagerCompat.OnActivated += toastArgs => + { + // Obtain the arguments from the notification + ToastArguments args = ToastArguments.Parse(toastArgs.Argument); + + // Obtain any user input (text boxes, menu selections) from the notification + ValueSet userInput = toastArgs.UserInput; + + // Need to dispatch to UI thread if performing UI operations + Application.Current.Dispatcher.Invoke(delegate + { + Util.ShowMain(); + }); + }; + } } } diff --git a/EnvyUpdate/MainWindow.xaml.cs b/EnvyUpdate/MainWindow.xaml.cs index e04671f..b4346cc 100644 --- a/EnvyUpdate/MainWindow.xaml.cs +++ b/EnvyUpdate/MainWindow.xaml.cs @@ -1,4 +1,5 @@ -using System; +using Microsoft.Toolkit.Uwp.Notifications; +using System; using System.Diagnostics; using System.IO; using System.Linq; @@ -295,7 +296,10 @@ namespace EnvyUpdate private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (MessageBox.Show(Properties.Resources.exit_confirm, "", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) + { + ToastNotificationManagerCompat.Uninstall(); Application.Current.Shutdown(); + } else e.Cancel = true; } diff --git a/EnvyUpdate/Notify.cs b/EnvyUpdate/Notify.cs index 7afaecf..ac317c1 100644 --- a/EnvyUpdate/Notify.cs +++ b/EnvyUpdate/Notify.cs @@ -1,4 +1,4 @@ -using Notifications.Wpf; +using Microsoft.Toolkit.Uwp.Notifications; namespace EnvyUpdate { @@ -6,14 +6,9 @@ namespace EnvyUpdate { public static void ShowDrivUpdatePopup() { - var notificationManager = new NotificationManager(); - - notificationManager.Show(new NotificationContent - { - Title = "EnvyUpdate", - Message = Properties.Resources.update_popup_message, - Type = NotificationType.Information - }, onClick: Util.ShowMain); + var toast = new ToastContentBuilder(); + toast.AddText(Properties.Resources.update_popup_message); + toast.Show(); } } } \ No newline at end of file diff --git a/EnvyUpdate/Properties/Resources.Designer.cs b/EnvyUpdate/Properties/Resources.Designer.cs index e7f0cc3..c102a9a 100644 --- a/EnvyUpdate/Properties/Resources.Designer.cs +++ b/EnvyUpdate/Properties/Resources.Designer.cs @@ -250,7 +250,7 @@ namespace EnvyUpdate.Properties { } /// - /// Looks up a localized string similar to A new driver update is available for your graphics card. Click for more info.. + /// Looks up a localized string similar to A new driver update is available for your graphics card.. /// public static string update_popup_message { get { diff --git a/EnvyUpdate/Properties/Resources.de.resx b/EnvyUpdate/Properties/Resources.de.resx index 171c831..8457d37 100644 --- a/EnvyUpdate/Properties/Resources.de.resx +++ b/EnvyUpdate/Properties/Resources.de.resx @@ -181,6 +181,6 @@ Aufgrund eines Programmfehlers musste EnvyUpdate deinstalliert werden. Bitte laden Sie die neuste Version erneut manuell herunter. - Eine neue Treiberversion ist verfügbar. Hier klicken für mehr Info. + Eine neue Treiberversion ist verfügbar. \ No newline at end of file diff --git a/EnvyUpdate/Properties/Resources.resx b/EnvyUpdate/Properties/Resources.resx index 6036388..12997c9 100644 --- a/EnvyUpdate/Properties/Resources.resx +++ b/EnvyUpdate/Properties/Resources.resx @@ -181,6 +181,6 @@ EnvyUpdate must be uninstalled because of an application bug. Please download the most recent version again. - A new driver update is available for your graphics card. Click for more info. + A new driver update is available for your graphics card. \ No newline at end of file