diff --git a/SharedLibraryCore/Utilities.cs b/SharedLibraryCore/Utilities.cs index f0ceafa62..57ebd7243 100644 --- a/SharedLibraryCore/Utilities.cs +++ b/SharedLibraryCore/Utilities.cs @@ -1331,5 +1331,24 @@ namespace SharedLibraryCore return serviceCollection; } + + public static void NotifyAfterDelay(TimeSpan duration, Func action) => + NotifyAfterDelay((int)duration.TotalMilliseconds, action); + + public static void NotifyAfterDelay(int delayMs, Func action) + { + Task.Run(async () => + { + try + { + await Task.Delay(delayMs); + await action(); + } + catch + { + // ignored + } + }); + } } }