From 868a7ce9c8b50bd64c8b5ae33fec77abfd25ef7c Mon Sep 17 00:00:00 2001 From: LukePulverenti Date: Thu, 21 Feb 2013 23:23:06 -0500 Subject: isolated clickonce dependancies --- MediaBrowser.UI/Extensions/Extensions.cs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 MediaBrowser.UI/Extensions/Extensions.cs (limited to 'MediaBrowser.UI/Extensions/Extensions.cs') diff --git a/MediaBrowser.UI/Extensions/Extensions.cs b/MediaBrowser.UI/Extensions/Extensions.cs new file mode 100644 index 000000000..1d0d7d1c2 --- /dev/null +++ b/MediaBrowser.UI/Extensions/Extensions.cs @@ -0,0 +1,26 @@ +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(); + } + } +} -- cgit v1.2.3