protected override void OnStartup(StartupEventArgs e) { if (!RuntimeManager.Bind(ProductCode.Desktop)) { MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down."); return; } ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeAdvanced); base.OnStartup(e); }
static void Main() { if (!RuntimeManager.Bind(ProductCode.Desktop)) { MessageBox.Show("Unable to bind to ArcGIS runtime. Application will be shut down."); return; } ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeAdvanced); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
private void CreateGeoDatabase() { //为了正常调用 pWorkSpaceFactory.OpenFromFile(pDBPath, 0); //先初始化License如下,否则出未知异常 ESRI.ArcGIS.esriSystem.AoInitialize pLicenseInitialize = new ESRI.ArcGIS.esriSystem.AoInitialize(); pLicenseInitialize.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeEngine); string pDBDirectory = "C:\\"; string pDBName = "LG.gdb"; string pDBPath = pDBDirectory + pDBName; ESRI.ArcGIS.Geodatabase.IWorkspaceFactory pWorkSpaceFactory = new ESRI.ArcGIS.DataSourcesGDB.FileGDBWorkspaceFactoryClass(); //ESRI.ArcGIS.Geodatabase.IWorkspaceName pWorkspaceName = pWorkSpaceFactory.Create(pDBDirectory, pDBName, null, 0); if (pWorkSpaceFactory.IsWorkspace(pDBPath)) { pWorkSpaceFactory.OpenFromFile(pDBPath, 0); } }