public void SetData(SocialType type, ClientInfo client)
        {
            string path = "";

            if (type == SocialType.Weibo)
            {
                path = "/Alexis.WindowsPhone.Social;component/Images/weibo.png";
            }
            else if (type == SocialType.Tencent)
            {
                path = "/Alexis.WindowsPhone.Social;component/Images/tencent.png";
            }
            else if (type == SocialType.Renren)
            {
                path = "/Alexis.WindowsPhone.Social;component/Images/renren.png";
            }
            else if (type == SocialType.QZone)
            {
                path = "/Alexis.WindowsPhone.Social;component/Images/qzone.png";
            }
            this.imgLogo.Source = new BitmapImage {
                UriSource = new Uri(path, UriKind.Relative)
            };
            SocialAPI.Client  = client;
            this.client       = client;
            currentType       = type;
            webbrowser.Source = new Uri(SocialKit.GetAuthorizeUrl(currentType, client), UriKind.Absolute);
        }
        private void BrowserNavigating(object sender, NavigatingEventArgs e)
        {
            //QQ 空间授权成功后直接返回token,不需要用code换取token
            if (currentType == SocialType.QZone && e.Uri.AbsoluteUri.Contains("access_token"))
            {
                //http://qzs.qq.com/open/mobile/login/proxy.html?&t=1363316329#&openid=&appid=100394029&access_token=D1600ED336D42D024DFB5A0618A56B8C&key=270e66a425575f5130efe0d416252469&serial=&token_key=&browser=0&browser_error=0&status_os=&sdkv=&status_machine=
                AccessToken token = new AccessToken();
                token.Token  = QueryStringHelper.GetQueryString(e.Uri, "access_token");
                token.OpenId = QueryStringHelper.GetQueryString(e.Uri, "openid");
                action(token);
                return;
            }

            if (!e.Uri.AbsoluteUri.Contains("code=") && !e.Uri.AbsoluteUri.Contains("code ="))
            {
                return;
            }
            var    arguments = e.Uri.AbsoluteUri.Split('?');
            string code      = arguments[1];

            if (currentType == SocialType.Tencent)
            {
                var sp = arguments[1].Split('&');
                code = sp[0];

                //open id
                client.Tag = sp[1].Split('=')[1];
            }

            SocialKit.GetToken(currentType, client, code, (p) =>
            {
                action(p);
            });
        }
Пример #3
0
        private void BrowserNavigating(object sender, NavigatingEventArgs e)
        {
            if (!e.Uri.AbsoluteUri.Contains("code=") && !e.Uri.AbsoluteUri.Contains("code ="))
            {
                return;
            }
            var    arguments = e.Uri.AbsoluteUri.Split('?');
            string code      = arguments[1];

            if (currentType == SocialType.Tencent)
            {
                var sp = arguments[1].Split('&');
                code = sp[0];

                //open id
                client.Tag = sp[1].Split('=')[1];
            }

            SocialKit.GetToken(currentType, client, code, (p) =>
            {
                action(p);
            });
        }