Virtu/Library/DispatcherExtensions.cs
Sean Fausett 365e5723c1 Deleted all svn:eol-style properties on files.
--HG--
extra : convert_revision : svn%3Affd33b8c-2492-42e0-bdc5-587b920b7d6d/trunk%4050811
2010-08-28 11:34:14 +00:00

53 lines
1.3 KiB
C#

using System;
using System.Windows.Threading;
namespace Jellyfish.Library
{
public static class DispatcherExtensions
{
public static void CheckBeginInvoke(this Dispatcher dispatcher, Action action)
{
if (dispatcher == null)
{
throw new ArgumentNullException("dispatcher");
}
if (action == null)
{
throw new ArgumentNullException("action");
}
if (dispatcher.CheckAccess())
{
action();
}
else
{
dispatcher.BeginInvoke(action);
}
}
#if WINDOWS
public static void CheckInvoke(this Dispatcher dispatcher, Action action)
{
if (dispatcher == null)
{
throw new ArgumentNullException("dispatcher");
}
if (action == null)
{
throw new ArgumentNullException("action");
}
if (dispatcher.CheckAccess())
{
action();
}
else
{
dispatcher.Invoke(action);
}
}
#endif
}
}