mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-22 16:54:46 +03:00
isolated clickonce dependancies
This commit is contained in:
26
MediaBrowser.UI/Extensions/Extensions.cs
Normal file
26
MediaBrowser.UI/Extensions/Extensions.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace MediaBrowser.UI.Extensions
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Invokes an action after a specified delay
|
||||
/// </summary>
|
||||
/// <param name="dispatcher">The dispatcher.</param>
|
||||
/// <param name="action">The action.</param>
|
||||
/// <param name="delayMs">The delay ms.</param>
|
||||
public static void InvokeWithDelay(this Dispatcher dispatcher, Action action, long delayMs)
|
||||
{
|
||||
var timer = new DispatcherTimer(DispatcherPriority.Normal, dispatcher);
|
||||
timer.Interval = TimeSpan.FromMilliseconds(delayMs);
|
||||
timer.Tick += (sender, args) =>
|
||||
{
|
||||
timer.Stop();
|
||||
action();
|
||||
};
|
||||
timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user