Пример #1
0
        private void ParseJson(Exception e, string json)
        {
            IEnumerable <IdentityProviderInformation> identityProviders = null;
            Exception error = e;

            if (null == e)
            {
                try
                {
                    using (MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(json)))
                    {
                        DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(IEnumerable <IdentityProviderInformation>));
                        identityProviders = serializer.ReadObject(ms) as IEnumerable <IdentityProviderInformation>;

                        IdentityProviderInformation windowsLiveId = identityProviders.FirstOrDefault(i => i.Name.Equals("Windows Live™ ID", StringComparison.InvariantCultureIgnoreCase));
                        if (windowsLiveId != null)
                        {
                            string separator = windowsLiveId.LoginUrl.Contains("?") ? "&" : "?";
                            windowsLiveId.LoginUrl = string.Format(CultureInfo.InvariantCulture, "{0}{1}pcexp=false", windowsLiveId.LoginUrl, separator);
                        }
                    }
                }
                catch (Exception ex)
                {
                    error = ex;
                }
            }

            if (null != GetIdentityProviderListCompleted)
            {
                GetIdentityProviderListCompleted(this, new GetIdentityProviderListEventArgs(identityProviders, error));
            }
        }
 internal IdentityProviderInformationEventArgs(IdentityProviderInformation identityProvider)
 {
     this.IdentityProviderInformation = identityProvider;
 }