From 1f860baa2bd99620a21d8aa80aa9828a8b7f6c0d Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 13 Jan 2025 11:59:12 +0100 Subject: [PATCH] do not show notifications again on the client --- src/BreCalClient/AppNotification.cs | 11 ++++++++++- src/BreCalClient/MainWindow.xaml.cs | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/BreCalClient/AppNotification.cs b/src/BreCalClient/AppNotification.cs index ea3eb02..2215f26 100644 --- a/src/BreCalClient/AppNotification.cs +++ b/src/BreCalClient/AppNotification.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using ToastNotifications.Core; using BreCalClient.misc.Model; +using System.Runtime.CompilerServices; namespace BreCalClient { @@ -165,15 +166,23 @@ namespace BreCalClient { vm.ShowAppNotification(toastText, options); }); + result = true; } } } + + if (result) + SaveNotifications(); // store notification ids in config array on change + return result; } internal static void SaveNotifications() { - Properties.Settings.Default.Notifications.Clear(); + if (Properties.Settings.Default.Notifications == null) + Properties.Settings.Default.Notifications = new(); + else + Properties.Settings.Default.Notifications.Clear(); foreach (int notification_id in _notifications.Keys) { Properties.Settings.Default.Notifications.Add(notification_id.ToString()); diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index be19337..c7f2ce2 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -152,6 +152,7 @@ namespace BreCalClient }; this.comboBoxSortOrder.ItemsSource = Enum.GetValues(typeof(Extensions.SortOrder)); this.comboBoxSortOrder.SelectedIndex = (int)_sortOrder; + AppNotification.LoadFromSettings(); } private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)