public void HandleUri(Uri uri)
        {
            if (m_loginProcessData == null)
            {
                m_loginProcessData             = new LoginProcessData();
                m_loginProcessData.IsTokenFlow = true;
            }
            LoginProcessData loginProcessData = m_loginProcessData;

            m_loginProcessData = null;
            if (loginProcessData.IsTokenFlow)
            {
                try
                {
                    if (!(uri != null) || string.IsNullOrEmpty(uri.Fragment))
                    {
                        goto IL_00a5;
                    }
                    Dictionary <string, string> dictionary = WebManager.UrlParametersFromString(uri.Fragment.TrimStart('#'));
                    if (!dictionary.ContainsKey("access_token"))
                    {
                        if (dictionary.ContainsKey("error"))
                        {
                            throw new Exception(dictionary["error"]);
                        }
                        goto IL_00a5;
                    }
                    SettingsManager.DropboxAccessToken = dictionary["access_token"];
                    loginProcessData.Succeed(this);
                    goto end_IL_0038;
IL_00a5:
                    throw new Exception("Could not retrieve Dropbox access token.");
                    end_IL_0038 :;
                }
                catch (Exception error)
                {
                    loginProcessData.Fail(this, error);
                }
            }
        }
예제 #2
0
        public void HandleUri(Uri uri)
        {
            if (m_loginProcessData == null)
            {
                m_loginProcessData             = new LoginProcessData();
                m_loginProcessData.IsTokenFlow = true;
            }
            LoginProcessData loginProcessData = m_loginProcessData;

            m_loginProcessData = null;
            if (loginProcessData.IsTokenFlow)
            {
                try
                {
                    if (!(uri != null) || string.IsNullOrEmpty(uri.Fragment))
                    {
                        throw new Exception("不能接收来自SPMBox的身份验证信息");
                    }
                    Dictionary <string, string> dictionary = WebManager.UrlParametersFromString(uri.Fragment.TrimStart('#'));
                    if (!dictionary.ContainsKey("access_token"))
                    {
                        if (dictionary.ContainsKey("error"))
                        {
                            throw new Exception(dictionary["error"]);
                        }
                        throw new Exception("不能接收来自SPMBox的身份验证信息");
                    }
                    SettingsManager.ScpboxAccessToken = dictionary["access_token"];
                    loginProcessData.Succeed(this);
                }
                catch (Exception error)
                {
                    loginProcessData.Fail(this, error);
                }
            }
        }