public static void DoSignInEx(IdentityManager.CredentialRequestInfos credentialRequestInfos, Action<IdentityManager.Credential, Exception> callback, IdentityManager.GenerateTokenOptions generateTokenOptions = null)
{
// Check if IWA authentication might be OK
if (ChallengeIWA(credentialRequestInfos, callback))
return;
// Display UI for challenging
System.Windows.Threading.Dispatcher d = null;
if (Application.Current != null)
d = Application.Current.Dispatcher;
if (d != null && !d.CheckAccess())
{
//Ensure we are showing up the SignInDialog on the UI thread
d.BeginInvoke((Action)(() => DoSignInInUIThreadEx(credentialRequestInfos, callback, generateTokenOptions)));
}
else
DoSignInInUIThreadEx(credentialRequestInfos, callback, generateTokenOptions);
}