diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-21 23:23:06 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-21 23:23:06 -0500 |
| commit | 868a7ce9c8b50bd64c8b5ae33fec77abfd25ef7c (patch) | |
| tree | a60a3a27afe43a8b5e3412279225be7b2415e6c3 /MediaBrowser.UI/Extensions/Extensions.cs | |
| parent | fdafa596832eae13cebcf5bbe5fa867f7ba068f0 (diff) | |
isolated clickonce dependancies
Diffstat (limited to 'MediaBrowser.UI/Extensions/Extensions.cs')
| -rw-r--r-- | MediaBrowser.UI/Extensions/Extensions.cs | 26 |
1 files changed, 26 insertions, 0 deletions
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 + { + /// <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(); + } + } +} |
