Пример #1
0
        public InfoUser GetData(TrelloOAuth proxy, string id)
        {
            var client  = proxy.GetTrelloRestClient();
            var request = new RestRequest("/1/members/me");

            request.AddParameter("key", TrelloOAuth.consumerKey);
            request.AddParameter("token", TrelloOAuth.client_token);
            IRestResponse response = client.Execute(request);

            var jsonDeserializer = new JsonDeserializer();

            return(jsonDeserializer.Deserialize <InfoUser>(response));
        }
Пример #2
0
        public List<TrelloList> GetDataList(TrelloOAuth proxy, string idboard)
        {
            var apiClient = proxy.GetApiRestClient();

            //https://api.trello.com/1/boards/4fe20366df5c3cc66b1122cd/lists?key=b0241095b86be629a129979be29fa6db&token=637b50a2b29fb3ff8497014c1d773de293a32968dd59e189026eeac6316f1fa0
            var request = new RestRequest(string.Format("/1/boards/{0}/lists", idboard));
            request.AddParameter("key", TrelloOAuth.consumerKey);
            request.AddParameter("token", TrelloOAuth.client_token);
            var response = apiClient.Execute(request);

            var jsonDeserializer = new JsonDeserializer();

            return jsonDeserializer.Deserialize<List<TrelloList>>(response);
        }
Пример #3
0
        public GravEntry GetData(TrelloOAuth proxy, string hash)
        {
            var apiClient = proxy.GetCustomRestClient("http://en.gravatar.com");

            //http://en.gravatar.com/ad9d845d326eba333689b6c1d5682752.json
            var request  = new RestRequest(string.Format("/{0}.json", hash));
            var response = apiClient.Execute(request);

            var jsonDeserializer = new JsonDeserializer();

            var res = jsonDeserializer.Deserialize <Gravatar>(response);

            return(res.entry.FirstOrDefault());
        }
Пример #4
0
 public static InfoUser GetMember(this TrelloOAuth proxy, string id)
 {
     return(new InfoUserHandler().GetData(proxy, id));
 }
Пример #5
0
 public static GravEntry LoadGravatarEntry(this TrelloOAuth proxy, string hash)
 {
     return(new GravatarHandler().GetData(proxy, hash));
 }
Пример #6
0
 public static List <TrelloList> LoadListsFrom(this TrelloOAuth proxy, string idboard)
 {
     return(new TrelloListHandler().GetDataList(proxy, idboard));
 }
Пример #7
0
 public static List <Card> LoadCardsFrom(this TrelloOAuth proxy, string idList)
 {
     return(new ListCardHandler().GetDataList(proxy, idList));
 }
Пример #8
0
 public static Card LoadCardById(this TrelloOAuth proxy, string id)
 {
     return(new CardHandler().GetData(proxy, id));
 }
Пример #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            var explorer = FindViewById <WebView>(Resource.Id.webView1);

            explorer.Settings.JavaScriptEnabled = true;

            var button     = FindViewById <Button>(Resource.Id.MyButton);
            var txtWelcome = this.FindViewById <TextView>(Resource.Id.txtWelcome);

            if (NetworkStatus.HasConnectivity(this))
            {
                TrelloUserInfoProxy = new TrelloOAuth();

                TrelloUserInfoProxy.OAuthFailed += delegate
                {
                    _progress.Hide();
                    Toast.MakeText(this, "Unable to login. OAuthentication failed...", ToastLength.Short).Show();
                    TrelloUserInfoProxy.Authenticate(false);
                };

                TrelloUserInfoProxy.LoggedIn += delegate(InfoUser infoUser)
                {
                    var dashboard = new Intent(this, typeof(DashboardActivity));
                    button.Text    = "Logout";
                    button.Enabled = true;
                    _progress.Hide();
                    txtWelcome.Text = string.Format("Welcome, {0}", infoUser.FullName);
                    Thread.Sleep(1000);
                    StartActivity(dashboard);
                };

                TrelloUserInfoProxy.UrlReady += delegate {
                    _progress.Hide();
                    button.Enabled = true;
                };

                this._progress = new ProgressDialog(this)
                {
                    Indeterminate = true
                };
                this._progress.SetTitle("Login In Progress");
                this._progress.SetMessage("Please wait...");
                this._progress.Show();

                TrelloUserInfoProxy.Authenticate(true);
            }
            else
            {
                Toast.MakeText(this, "Unable to reach internet...", ToastLength.Long).Show();
                button.Enabled = false;
            }

            button.Click += delegate
            {
                if (button.Text == "Logout")
                {
                    button.Text = "Login";
                    TrelloUserInfoProxy.ForceLogout();
                    TrelloUserInfoProxy.Authenticate(false);
                }
                else
                {
                    explorer.LoadUrl(TrelloUserInfoProxy.Url.ToString());
                    button.Enabled = false;
                    RunOnUiThread(() => { explorer.Visibility = ViewStates.Visible; });
                }
            };

            explorer.SetWebViewClient(new TrelloAuthViewClient());
        }