Exemple #1
0
 // Revoke access to the current app.
 public void RevokeAccessAndDisconnect()
 {
     if (mPlusClient.IsConnected())
     {
         mPlusClient.RevokeAccessAndDisconnect(this);
     }
 }
Exemple #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            imageLoader    = new ImageLoader(this);
            progressDialog = new ProgressDialog(this);
            progressDialog.Indeterminate = true;
            progressDialog.SetMessage("Connecting");

            plusClient = new PlusClient.Builder(this, this, this).Build();

            googleLoginButton = FindViewById <SignInButton> (Resource.Id.sign_in_button);
            plusOneButton     = FindViewById <PlusOneButton> (Resource.Id.plus_one_button);

            var logoutButton = FindViewById <Button> (Resource.Id.logout_button);

            logoutButton.Click += (sender, e) => {
                if (!plusClient.IsConnected || plusClient.IsConnecting)
                {
                    return;
                }

                plusClient.RevokeAccessAndDisconnect(this);
            };

            googleLoginButton.Click += (sender, e) => {
                if (plusClient.IsConnected || plusClient.IsConnecting)
                {
                    return;
                }

                progressDialog.Show();

                if (connectionResult == null)
                {
                    plusClient.Connect();
                }
                else
                {
                    ResolveLogin(connectionResult);
                }
            };

            plusClient.RegisterConnectionCallbacks(this);
            plusClient.IsConnectionFailedListenerRegistered(this);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            imageLoader = new ImageLoader (this);
            progressDialog = new ProgressDialog (this);
            progressDialog.Indeterminate = true;
            progressDialog.SetMessage ("Connecting");

            plusClient = new PlusClient.Builder(this, this, this).Build();

            googleLoginButton = FindViewById<SignInButton> (Resource.Id.sign_in_button);
            plusOneButton = FindViewById<PlusOneButton> (Resource.Id.plus_one_button);

            var logoutButton = FindViewById<Button> (Resource.Id.logout_button);
            logoutButton.Click += (sender, e) => {
                if(!plusClient.IsConnected || plusClient.IsConnecting)
                    return;

                plusClient.RevokeAccessAndDisconnect(this);
            };

            googleLoginButton.Click += (sender, e) => {
                if(plusClient.IsConnected || plusClient.IsConnecting)
                    return;

                progressDialog.Show();

                if (connectionResult == null) {
                    plusClient.Connect();
                }
                else{
                    ResolveLogin(connectionResult);
                }
            };

            plusClient.RegisterConnectionCallbacks (this);
            plusClient.IsConnectionFailedListenerRegistered (this);
        }