using System;
using System.Windows.Threading;
namespace MediaBrowser.UI.Extensions
{
public static class Extensions
{
///
/// Invokes an action after a specified delay
///
/// The dispatcher.
/// The action.
/// The delay ms.
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();
}
}
}