示例#1
0
        protected override void OnClick()
        {
            log.Debug("User has clicked the authentication button.");

            try
            {
                // check to make sure the button is not checked (i.e. user has an auth code)
                log.Debug("Verifying the button is checked or not.");
                log.Debug("this.Checked: " + this.Checked);
                if (!this.Checked)
                {
                    // establish a new OAuth2 form
                    log.Debug("Creating a new OAuth2 authorization form.");
                    Extension.Dialogs.Auth.OAuth2AuthForm oauthForm = new Extension.Dialogs.Auth.OAuth2AuthForm(ext);

                    // show the dialog
                    log.Debug("Showing new dialog window.");
                    oauthForm.Show();
                }
                else
                {
                    // sign the user out of the toolbar
                    log.Debug("Sign the user out of the Google Earth Builder tools by removing all token references.");
                    ext.clearToken();
                }
            }
            catch (System.Exception ex)
            {
                log.Debug(ex);
                ext.displayErrorDialog("Unable to change user authentication state.");
            }
        }
示例#2
0
 protected override void OnClick()
 {
     // check to see if the extension is enabled
     log.Debug("Verifying extension is enabled.");
     if (ext.isExtensionEnabled())
     {
         ext.clearToken();
     }
 }