Esempio n. 1
0
        private void WebBrowser1OnDocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            webBrowser1.Hide();
            if (e.Url.Host.Contains("google"))
            {
                client.GetAccessTokenAsync(
                    user =>
                {
                    userLogin = user;
                    Invoke((MethodInvoker)
                           delegate
                    {
                        webBrowser1.Visible = false;
                    });

                    AccountInfo x = client.AccountInfo();

                    MessageBox.Show(x.display_name.ToString());
                },
                    error =>
                {
                    var xError = error as DropboxRestException;
                    if (xError != null)
                    {
                        MessageBox.Show(xError.Response.Content);
                    }
                    else
                    {
                        MessageBox.Show(error.Message);
                    }
                });
            }
        }
Esempio n. 2
0
                                                      Environment.SpecialFolder.ApplicationData), "CloudManagerDB"); //zb:"C:\\Users\\Michael\\AppData\\Roaming\\CloudManagerDB

        private async void OnAuthCompleted()
        {
            Thread t = null;

            client.GetAccessTokenAsync((userLogin) =>
            {
                //Save the Token and Secret we get here to save future logins
                _userLogin = userLogin;

                //_client = new DropNetClient(apiKey, appSecret, _userLogin.Token, _userLogin.Secret, null);
                t = Thread.CurrentThread;
                this.SaveSecrets();
                //SignedIn = true;
            },
                                       (error) =>
            {
                /////////////////////
            });

            Thread.Sleep(5000);     //Thread dauaert zu lange daher noch stoppen.
            //while (t.ThreadState == ThreadState.Running);


            if (this.loginFinished != null)
            {
                this.loginFinished();
            }
        }
Esempio n. 3
0
 private void brwLogin_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     if (e.Url.Host.Contains("google"))
     {
         _client.GetAccessTokenAsync(userLogin =>
         {
             _userLogin = userLogin;
             TestConnection();
         },
                                     error => MessageBox.Show("Failed to Obtain Access Token:\r\n\r\n" + error.Response.Content, "SQL Backup - GetAccessTokenAsync"));
     }
 }
Esempio n. 4
0
        public async Task Get_Access_Token_Test()
        {
            var client = new DropNetClient(AppKey, AppSecret);

            var userToken = await client.GetRequestTokenAsync();

            //Open the url in browser and login
            string url  = client.BuildAuthorizeUrl(userToken, "http://cloudyboxapp.com");
            var    user = await client.GetAccessTokenAsync();

            Assert.NotNull(user);
        }
Esempio n. 5
0
        private void CheckToken()
        {
            _client.GetAccessTokenAsync(x =>
            {
                var folder = NavigationContext
                             .QueryString["folder"];

                this.NavigateTo <List>(
                    "token={0}&secret={1}&folder={2}",
                    x.Token, x.Secret, folder);
            }, ex => ShowError());
        }
Esempio n. 6
0
        public Task <bool> LoginCallback(Uri url)
        {
            var tcs = new TaskCompletionSource <bool>();

            _client.GetAccessTokenAsync(login =>
            {
                _finalLogin = login;
                _persister.Save(new DropboxToken {
                    Value = _finalLogin
                });
                tcs.SetResult(true);
            }, tcs.SetException);

            return(tcs.Task);
        }
Esempio n. 7
0
        private void brwLogin_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (e.Url.Host.Contains("google"))
            {
                //Callback url reached, user has completed authorization

                //Now convert the request token into an access token
                _client.GetAccessTokenAsync((userLogin) =>
                {
                    //Save the Token and Secret we get here to save future logins
                    _userLogin = userLogin;

                    LoadContents();
                },
                                            (error) =>
                {
                    //Some sort of error
                    MessageBox.Show(error.Response.Content);
                });
            }
        }