From 17392b810e06cf06155246dcdb42a06d0592359f Mon Sep 17 00:00:00 2001 From: Kemal Setya Adhi Date: Fri, 21 Feb 2025 22:23:41 +0700 Subject: [PATCH] Always use UI Thread to spawn background activity notification --- .../Classes/EventsManagement/BackgroundActivityManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs b/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs index 799d9f6f2..703f4e4b1 100644 --- a/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs +++ b/CollapseLauncher/Classes/EventsManagement/BackgroundActivityManager.cs @@ -1,5 +1,6 @@ using CollapseLauncher.Dialogs; using CollapseLauncher.Extension; +using CollapseLauncher.Helper; using CollapseLauncher.Helper.Metadata; using CollapseLauncher.Interfaces; using CollapseLauncher.Statics; @@ -29,7 +30,8 @@ public static void Attach(int hashID, IBackgroundActivity activity, string activ return; } - AttachEventToNotification(hashID, activity, activityTitle, activitySubtitle); + WindowUtility.CurrentDispatcherQueue? + .TryEnqueue(() => AttachEventToNotification(hashID, activity, activityTitle, activitySubtitle)); BackgroundActivities.Add(hashID, activity); #if DEBUG Logger.LogWriteLine($"Background activity with ID: {hashID} has been attached", LogType.Debug, true);