Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public static class DispatchService
{
public static void Invoke(Action action)
{
Dispatcher dispatchObject = Application.Current.Dispatcher;
if (dispatchObject == null || dispatchObject.CheckAccess())
{
action();
}
else
{
dispatchObject.Invoke(action);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment