Silverlight UI thread dispatcher helper class
A simple class to manage dispatching calls to a UI thread in a silverlight application (might work in WPF too, I haven't tried it!)
public static class UIThread
{
private static readonly Dispatcher Dispatcher;
static UIThread()
{
Dispatcher = Deployment.Current.Dispatcher;
}
public static void Invoke(Action action)
{
if (Dispatcher.CheckAccess())
action();
else
Dispatcher.BeginInvoke(action);
}
}