public ToolsCommand_FindAsset() { // initialize and configure log4net, reading from Xml .config file log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); log.Info("ToolsCommand_FindAsset initializing."); // to check the state of the extension, get the extension log.Info("Retrieving a reference to the extension object to check state."); ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension(); // check to see if the extension is enabled log.Debug("Verifying extension is enabled."); if (!ext.isExtensionEnabled()) { this.Enabled = false; } else { if (!ext.isAuthorizationAvailable()) { this.Enabled = false; } } // subscribe to extension state change events through the extension ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange; // subscribe to Authentication state change events through the extension ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent; }
void HandleSelectionChange(object sender, Extension.SelectionChangeEventArgs e) { // check to see if there is a map feature selected log.Debug("Verifying map feature selected."); if (e.isSelected) { // verify the extension is enabled and there is auth // also, only when there is one feature selected...do not handle multiple features if (ext.isExtensionEnabled() && ext.isAuthorizationAvailable() && e.selectedFeaturesCount == 1) { // there is a map feature selected, enable this button for user to click log.Debug("there is a map feature selected, enable this button for user to click"); this.Enabled = true; } else { // the extension or authorization is not enabled, diable button log.Debug("the extension or authorization is not enabled, diable button."); this.Enabled = false; } } else { // disable this button as no feature selected log.Debug("There is no feature selected, disable button."); this.Enabled = false; } }
public ToolsCommand_FindAsset() { // initialize and configure log4net, reading from Xml .config file log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); log.Info("ToolsCommand_FindAsset initializing."); // to check the state of the extension, get the extension log.Info("Retrieving a reference to the extension object to check state."); ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension(); // check to see if the extension is enabled log.Debug("Verifying extension is enabled."); if (!ext.isExtensionEnabled()) { this.Enabled = false; } else { if (!ext.isAuthorizationAvailable()) this.Enabled = false; } // subscribe to extension state change events through the extension ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange; // subscribe to Authentication state change events through the extension ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent; }
void HandleExtensionStateChange(object sender, Extension.StateChangeEventArgs e) { // check to see if the extension is enabled log.Debug("Verifying extension is enabled."); if (e.State && ext.isAuthorizationAvailable()) { // the extension is enabled, verify the button is also enabled log.Debug("Extension is enabled, enable button and check to verify the user has an auth token."); this.Enabled = true; } else { // disable this button log.Debug("The extension is disabled, disable this button."); this.Enabled = false; } }
public ToolsCommand_UploadToGoogleMapsEngine() { // initialize and configure log4net, reading from Xml .config file log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); log.Info("ToolsCommand_UploadToGoogleEarthBuilder initializing."); // to check the state of the extension, get the extension log.Info("Retrieving a reference to the extension object to check state."); ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension(); // check to see if the extension is enabled log.Debug("Verifying extension is enabled."); if (ext.isExtensionEnabled()) { // the extension is enabled, verify the button is also enabled log.Debug("Extension is enabled, enable button and check to verify the user has an auth token."); this.Enabled = true; // check to see if the user has an auth code log.Debug("Checking to see if the user has an OAuth code"); if (ext.isAuthorizationAvailable() && !ext.getToken().isViewOnly && ext.hasAtLeastOneLayer()) { // the user has an OAuth code available for use log.Debug("User has an OAuth code available. Check the button."); this.Enabled = true; } else { // the user does not have an OAuth code available for use log.Debug("User does not have an OAuth code available. Uncheck the button."); this.Enabled = false; } } else { // disable this button log.Debug("The extension is disabled, disable this button."); this.Enabled = false; } // subscribe to extension state change events through the extension ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange; // subscribe to Authentication state change events through the extension ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent; // subscribe to map layer selection change events through the extension ext.RaiseMapLayerStateChangeEvent += HandleMapLayerSelectionStateChangeEvent; }
public ToolsCommand_UserSignout() { // initialize and configure log4net, reading from Xml .config file log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); log.Info("ToolsCommand_UserSignout initializing."); // to check the state of the extension, get the extension log.Info("Retrieving a reference to the extension object to check state."); ext = GoogleMapsEngineToolsExtensionForArcGIS.GetExtension(); // check to see if the extension is enabled log.Debug("Verifying extension is enabled."); if (!ext.isExtensionEnabled()) { // the extension is not enabled, diable the button log.Debug("Disabling the sign-out button, as the extension is disabled."); this.Enabled = false; } else { // by default, if there is no auth object, disable sign-out log.Debug("Extension enabled, checking to see if there is a valid auth token."); if (ext.isAuthorizationAvailable()) { // there is an auth token, verify the button is enabled log.Debug("The auth token is available, setting the button to enabled."); this.Enabled = true; } else { // there is no auth token, setting the button to disabled log.Debug("The auth token isn't available, disabling the sign-out button."); this.Enabled = false; } } // subscribe to extension state change events through the extension ext.RaiseExtensionStateChangeEvent += HandleExtensionStateChange; // subscribe to Authentication state change events through the extension ext.RaiseAuthenticationStateChangeEvent += HandleAuthenticationStateChangeEvent; }