private void DispatchWhenRequired( Action a ) { if( Application.Current.Dispatcher.CheckAccess() ) a(); else Application.Current.Dispatcher.BeginInvoke( a ); }