From 452790d9233b33674c7431875eb773004e0a1d39 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 14 Jul 2023 22:03:26 +0200 Subject: [PATCH] simplify notification --- EnvyUpdate/App.xaml.cs | 27 +++++++++------------------ EnvyUpdate/DashboardPage.xaml | 1 + EnvyUpdate/DashboardPage.xaml.cs | 6 ++++++ EnvyUpdate/MainWindow.xaml | 2 +- EnvyUpdate/Notify.cs | 3 --- 5 files changed, 17 insertions(+), 22 deletions(-) diff --git a/EnvyUpdate/App.xaml.cs b/EnvyUpdate/App.xaml.cs index 369d24c..2d0e158 100644 --- a/EnvyUpdate/App.xaml.cs +++ b/EnvyUpdate/App.xaml.cs @@ -31,25 +31,16 @@ namespace EnvyUpdate // TODO: Watch for theme changes and dynamically update // Listen to notification activation - ToastNotificationManagerCompat.OnActivated += toastArgs => - { - // Obtain the arguments from the notification - ToastArguments args = ToastArguments.Parse(toastArgs.Argument); + ToastNotificationManagerCompat.OnActivated += ToastNotificationManagerCompat_OnActivated; + } - // Need to dispatch to UI thread if performing UI operations - Application.Current.Dispatcher.Invoke(delegate - { - switch (args.Get("action")) - { - case "download": - Process.Start(Util.GetGpuUrl()); - break; - default: - Util.ShowMain(); - break; - } - }); - }; + private void ToastNotificationManagerCompat_OnActivated(ToastNotificationActivatedEventArgsCompat e) + { + // Need to dispatch to UI thread if performing UI operations + Application.Current.Dispatcher.Invoke(delegate + { + Util.ShowMain(); + }); } } } diff --git a/EnvyUpdate/DashboardPage.xaml b/EnvyUpdate/DashboardPage.xaml index eb0757b..dc9d964 100644 --- a/EnvyUpdate/DashboardPage.xaml +++ b/EnvyUpdate/DashboardPage.xaml @@ -48,6 +48,7 @@ + diff --git a/EnvyUpdate/DashboardPage.xaml.cs b/EnvyUpdate/DashboardPage.xaml.cs index 45f7af0..f7e4f1d 100644 --- a/EnvyUpdate/DashboardPage.xaml.cs +++ b/EnvyUpdate/DashboardPage.xaml.cs @@ -378,6 +378,8 @@ namespace EnvyUpdate { Application.Current.Dispatcher.Invoke(new Action(() => { showSnackbar(Wpf.Ui.Common.ControlAppearance.Success, Wpf.Ui.Common.SymbolRegular.CheckmarkCircle24, Properties.Resources.info_download_success, Properties.Resources.info_download_success_title); + buttonDownload.Visibility = Visibility.Collapsed; + buttonInstall.Visibility = Visibility.Visible; })); if (File.Exists(Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe"))) File.Delete(Path.Combine(GlobalVars.exedirectory, "nvidia-installer.exe")); @@ -391,6 +393,10 @@ namespace EnvyUpdate })); } } + private void buttonInstall_Click(object sender, RoutedEventArgs e) + { + + } private void showSnackbar (Wpf.Ui.Common.ControlAppearance appearance, Wpf.Ui.Common.SymbolRegular icon, string message = "", string title = "") { diff --git a/EnvyUpdate/MainWindow.xaml b/EnvyUpdate/MainWindow.xaml index e3b0166..f12d454 100644 --- a/EnvyUpdate/MainWindow.xaml +++ b/EnvyUpdate/MainWindow.xaml @@ -11,7 +11,7 @@ ExtendsContentIntoTitleBar="True" WindowBackdropType="Mica" - Title="EnvyUpdate" MinHeight="450" Height="450" MinWidth="600" Width="600" Icon="icon.ico" StateChanged="Window_StateChanged" Closing="Window_Closing" ResizeMode="CanMinimize" Activated="UiWindow_Activated" WindowStyle="None"> + Title="EnvyUpdate" MinHeight="500" Height="500" MinWidth="600" Width="600" Icon="icon.ico" StateChanged="Window_StateChanged" Closing="Window_Closing" ResizeMode="CanMinimize" Activated="UiWindow_Activated" WindowStyle="None"> diff --git a/EnvyUpdate/Notify.cs b/EnvyUpdate/Notify.cs index 6230c6a..ac317c1 100644 --- a/EnvyUpdate/Notify.cs +++ b/EnvyUpdate/Notify.cs @@ -8,9 +8,6 @@ namespace EnvyUpdate { var toast = new ToastContentBuilder(); toast.AddText(Properties.Resources.update_popup_message); - toast.AddButton(new ToastButton() - .SetContent("Download") - .AddArgument("action", "download")); toast.Show(); } }