mirror of
https://github.com/digital-jellyfish/Virtu.git
synced 2024-06-10 04:29:29 +00:00
27a5e3ac89
Normalize text files.
37 lines
1008 B
C#
37 lines
1008 B
C#
using System;
|
|
using System.Windows.Threading;
|
|
|
|
namespace Jellyfish.Library
|
|
{
|
|
public static class DispatcherExtensions
|
|
{
|
|
public static void Post(this Dispatcher dispatcher, Action action)
|
|
{
|
|
if (dispatcher == null)
|
|
{
|
|
throw new ArgumentNullException("dispatcher");
|
|
}
|
|
if (action == null)
|
|
{
|
|
throw new ArgumentNullException("action");
|
|
}
|
|
|
|
new DispatcherSynchronizationContext(dispatcher).Post(state => action(), null);
|
|
}
|
|
|
|
public static void Send(this Dispatcher dispatcher, Action action)
|
|
{
|
|
if (dispatcher == null)
|
|
{
|
|
throw new ArgumentNullException("dispatcher");
|
|
}
|
|
if (action == null)
|
|
{
|
|
throw new ArgumentNullException("action");
|
|
}
|
|
|
|
new DispatcherSynchronizationContext(dispatcher).Send(state => action(), null);
|
|
}
|
|
}
|
|
}
|