public static void DoSignIn(string url, Action<IdentityManager.Credential, Exception> callback, IdentityManager.GenerateTokenOptions generateTokenOptions = null)
{
System.Windows.Threading.Dispatcher d = null;
#if SILVERLIGHT
// Note that RootVisual is only accessible from UI Thread so Application.Current.RootVisual.Dispatcher crashes
if (Deployment.Current != null) // should always be the case
d = Deployment.Current.Dispatcher;
#else
if (Application.Current != null)
d = Application.Current.Dispatcher;
#endif
if (d != null && !d.CheckAccess())
{
//Ensure we are showing up the SignInDialog on the UI thread
d.BeginInvoke((Action) delegate { DoSignInInUIThread(url, callback, generateTokenOptions); });
}
else
DoSignInInUIThread(url, callback, generateTokenOptions);
}
#pragma warning restore 1574