예제 #1
0
        public void AddAccount(DialogViewController dvc, NSAction action)
        {
            var oauth = new OAuthAuthorizer (TwitterAccount.OAuthConfig);

            if (useXauth)
                NewAccountXAuth (dvc, action);
            else {
                if (oauth.AcquireRequestToken ()){
                    oauth.AuthorizeUser (dvc, delegate {
                        SetDefaultAccount (oauth);
                        action ();
                    });
                }
            }
        }
예제 #2
0
        void StartLogin(DialogViewController dvc)
        {
            dvc.Root.RemoveAt(1);
            LoadMoreElement status;

            if (dvc.Root.Count == 1)
            {
                status = new LoadMoreElement(
                    Locale.GetText("Could not authenticate with twitter"),
                    Locale.GetText("Contacting twitter"), null, UIFont.BoldSystemFontOfSize(16), UIColor.Black)
                {
                    Animating = true
                };
                dvc.Root.Add(new Section()
                {
                    status
                });
            }
            else
            {
                status = (LoadMoreElement)dvc.Root [1][0];
            }

            // Spin off a thread to start the OAuth authentication process,
            // let the GUI thread show the spinner.
            ThreadPool.QueueUserWorkItem(delegate {
                var oauth = new OAuthAuthorizer(TwitterAccount.OAuthConfig);

                try {
                    if (oauth.AcquireRequestToken())
                    {
                        BeginInvokeOnMainThread(delegate {
                            oauth.AuthorizeUser(dvc, delegate {
                                StartupAfterAuthorization(oauth);
                            });
                        });
                        return;
                    }
                } catch (Exception e) {
                    Console.WriteLine(e);
                }

                BeginInvokeOnMainThread(delegate { status.Animating = false; });
            });
        }
예제 #3
0
        public void AddAccount(DialogViewController dvc, NSAction action)
        {
            var oauth = new OAuthAuthorizer(TwitterAccount.OAuthConfig);

            if (useXauth)
            {
                NewAccountXAuth(dvc, action);
            }
            else
            {
                if (oauth.AcquireRequestToken())
                {
                    oauth.AuthorizeUser(dvc, delegate {
                        SetDefaultAccount(oauth);
                        action();
                    });
                }
            }
        }
예제 #4
0
        void StartLogin(DialogViewController dvc)
        {
            dvc.Root.RemoveAt (1);
            LoadMoreElement status;

            if (dvc.Root.Count == 1){
                status = new LoadMoreElement (
                Locale.GetText ("Could not authenticate with twitter"),
                Locale.GetText ("Contacting twitter"), null, UIFont.BoldSystemFontOfSize (16), UIColor.Black) {
                    Animating = true
                };
                dvc.Root.Add (new Section () { status });
            } else
                status = (LoadMoreElement) dvc.Root [1][0];

            // Spin off a thread to start the OAuth authentication process,
            // let the GUI thread show the spinner.
            ThreadPool.QueueUserWorkItem (delegate {
                var oauth = new OAuthAuthorizer (TwitterAccount.OAuthConfig);

                try {
                    if (oauth.AcquireRequestToken ()){
                        BeginInvokeOnMainThread (delegate {
                            oauth.AuthorizeUser (dvc, delegate {
                                StartupAfterAuthorization (oauth);
                            });
                        });
                        return;
                    }
                } catch (Exception e){
                    Console.WriteLine (e);
                }

                BeginInvokeOnMainThread (delegate { status.Animating = false; });
            });
        }