Skip to content

Commit ad24aef

Browse files
committed
Use ConcurrentDictionary
1 parent 77d7b9d commit ad24aef

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Flow.Launcher/Notification.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using Flow.Launcher.Infrastructure;
2-
using Microsoft.Toolkit.Uwp.Notifications;
3-
using System;
4-
using System.Collections.Generic;
1+
using System;
2+
using System.Collections.Concurrent;
53
using System.IO;
64
using System.Windows;
5+
using Flow.Launcher.Infrastructure;
6+
using Microsoft.Toolkit.Uwp.Notifications;
77

88
namespace Flow.Launcher
99
{
@@ -13,7 +13,7 @@ internal static class Notification
1313

1414
internal static bool legacy = !Win32Helper.IsNotificationSupported();
1515

16-
private static readonly Dictionary<string, Action> _notificationActions = new();
16+
private static readonly ConcurrentDictionary<string, Action> _notificationActions = new();
1717

1818
internal static void Install()
1919
{
@@ -120,7 +120,7 @@ private static void ShowInternalWithButton(string title, string buttonText, Acti
120120
.AddButton(buttonText, ToastActivationType.Background, guid)
121121
.AddAppLogoOverride(new Uri(Icon))
122122
.Show();
123-
_notificationActions.Add(guid, buttonAction);
123+
_notificationActions.AddOrUpdate(guid, buttonAction, (key, oldValue) => buttonAction);
124124
}
125125
catch (InvalidOperationException e)
126126
{

0 commit comments

Comments
 (0)