This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Check Out Extension License Snippet (ArcObjects .NET 10.4 SDK) |
Check out a specific ArcGIS extension license for a paticular licensed product.
///<summary>Check out a specific ArcGIS extension license for a paticular licensed product.</summary> /// ///<param name="licenseProductCode"> An ESRI.ArcGIS.esriSystem.esriLicenseProductCode enumeration that is the level of functionality to check out for a specific ArcGIS Extension. Example: ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView</param> ///<param name="licenseExtensionCode">An ESRI.ArcGIS.esriSystem.esriLicenseExtensionCode enumeration that is the ArcGIS extension to check out. Example: ESRI.ArcGIS.esriSystem.esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst</param> /// ///<returns>An esriLicenseStatus enumeration that details the state of the extension license. Example: ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable</returns> /// ///<remarks></remarks> public ESRI.ArcGIS.esriSystem.esriLicenseStatus CheckOutExtensionLicense(ESRI.ArcGIS.esriSystem.esriLicenseProductCode licenseProductCode, ESRI.ArcGIS.esriSystem.esriLicenseExtensionCode licenseExtensionCode) { ESRI.ArcGIS.esriSystem.IAoInitialize aoInitialize=new ESRI.ArcGIS.esriSystem.AoInitializeClass(); ESRI.ArcGIS.esriSystem.esriLicenseStatus licenseStatus=aoInitialize.IsExtensionCodeAvailable(licenseProductCode, licenseExtensionCode); if (licenseStatus == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable) { licenseStatus=aoInitialize.Initialize(licenseProductCode); } if (licenseStatus == ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseCheckedOut) { licenseStatus=aoInitialize.CheckOutExtension(licenseExtensionCode); } return licenseStatus; }
'''<summary>Check out a specific ArcGIS extension license for a paticular licensed product.</summary> ''' '''<param name="licenseProductCode"> An ESRI.ArcGIS.esriSystem.esriLicenseProductCode enumeration that is the level of functionality to check out for a specific ArcGIS Extension. Example: ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeArcView</param> '''<param name="licenseExtensionCode">An ESRI.ArcGIS.esriSystem.esriLicenseExtensionCode enumeration that is the ArcGIS extension to check out. Example: ESRI.ArcGIS.esriSystem.esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst</param> ''' '''<returns>An esriLicenseStatus enumeration that details the state of the extension license. Example: ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable</returns> ''' '''<remarks></remarks> Public Function CheckOutExtensionLicense(ByVal licenseProductCode As ESRI.ArcGIS.esriSystem.esriLicenseProductCode, ByVal licenseExtensionCode As ESRI.ArcGIS.esriSystem.esriLicenseExtensionCode) As ESRI.ArcGIS.esriSystem.esriLicenseStatus Dim aoInitialize As ESRI.ArcGIS.esriSystem.IAoInitialize=New ESRI.ArcGIS.esriSystem.AoInitializeClass Dim licenseStatus As ESRI.ArcGIS.esriSystem.esriLicenseStatus=aoInitialize.IsExtensionCodeAvailable(licenseProductCode, licenseExtensionCode) If licenseStatus=ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseAvailable Then licenseStatus=aoInitialize.Initialize(licenseProductCode) End If If licenseStatus=ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseCheckedOut Then licenseStatus=aoInitialize.CheckOutExtension(licenseExtensionCode) End If Return licenseStatus End Function