AE、AS调用时用代码提供许可(不需要添加LicenseControl控件)
private void CheckBindLicense() { ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop); esriLicenseStatus licenseStatus = esriLicenseStatus.esriLicenseUnavailable; licenseStatus = CheckOutLicenses(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB); } /// <summary> /// 授权 /// </summary> /// <param name="productCode"></param> /// <returns></returns> private esriLicenseStatus CheckOutLicenses(esriLicenseProductCode productCode) { esriLicenseStatus licenseStatus; IAoInitialize m_AoInitialize = new AoInitializeClass(); //是否产品是可能的 licenseStatus = m_AoInitialize.IsProductCodeAvailable(productCode); if (licenseStatus == esriLicenseStatus.esriLicenseAvailable) { //用相应的许可文件进行初始化 licenseStatus = m_AoInitialize.Initialize(productCode); } return licenseStatus; }
多看一行书,就少写一行代码,记录点滴,用心生活。