コード例 #1
0
ファイル: MainActivity.cs プロジェクト: y2k/ImageKeyboard
        async void Initialize()
        {
            var keys = new KeyStorage();
            var client = new DropNetClient(await keys.Get("dropbox-apikey"), await keys.Get("dropbox-secret"));
            client.UseSandbox = true;

            var token = await client.GetRequestToken();
            var url = client.BuildAuthorizeUrl(token, "http://localhost");

            var regClient = new WebClientImpl();
            browser.SetWebViewClient(regClient);
            browser.LoadUrl(url);

            await regClient.Callback.Task;
            await client.GetAccessToken();

            browser.Visibility = ViewStates.Gone;

            var items = new List<Adaptar.Item>();
            foreach (var file in (await client.GetMetaData("/")).Contents.Take(10))
            {
                var buffer = await client.GetThumbnail(file);
                items.Add(
                    new Adaptar.Item
                    {
                        Title = file.Name,
                        Icon = await BitmapFactory.DecodeByteArrayAsync(buffer, 0, buffer.Length),
                    });
            }
            adapter.Update(items);
        }
コード例 #2
0
        public async Task Get_Access_Token_Test()
        {
            var client = new DropNetClient(AppKey, AppSecret);

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

            Assert.NotNull(user);
        }
コード例 #3
0
 public async Task Activate()
 {
     if(string.IsNullOrEmpty(_cache.DropboxUserSecret) || string.IsNullOrEmpty(_cache.DropboxUserToken))
     {
         _client = new DropNetClient(ApiKeys.DropBoxKey,
             ApiKeys.DropBoxSecret);
         var tokens = await _client.GetAccessToken();
         _cache.DropboxUserSecret = tokens.Secret;
         _cache.DropboxUserToken = tokens.Token;
     }
     else
     {
         _client = new DropNetClient(
        ApiKeys.DropBoxKey,
        ApiKeys.DropBoxSecret,
        _cache.DropboxUserToken,
        _cache.DropboxUserSecret);              
     }
     _client.UseSandbox = true;
 }