用博客记录点滴……

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;
        }

 

posted @ 2014-08-20 12:31  aegisada  阅读(1401)  评论(0编辑  收藏  举报