static void Main() { ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine); ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeEngine); ao.CheckOutExtension(esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
static void Main() { // Bind this ArcObjects application to this machine's ArcGIS license ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop); // Fetch the License ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); esriLicenseStatus status = ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeStandard); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); }
public static void InitializeArcObjects() { try { ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop); //采用代码初始化License /* IAoInitialize m_AoInitialize = new AoInitializeClass(); * esriLicenseStatus licenseStatus = esriLicenseStatus.esriLicenseUnavailable; * licenseStatus = m_AoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB);*/ ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeStandard); } catch (Exception) { } }
static void Main() { if (!RuntimeManager.Bind(ProductCode.Desktop)) { if (!RuntimeManager.Bind(ProductCode.Engine)) { 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); Enable3DAnalysis(); //avoid "The 3D Analyst extension has not been enabled" Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FrmContinuousGeneralizer()); }
static void Main(string[] args) { // Don't show the "program stopped working" popup if a file/path cannot be opened AppDomain.CurrentDomain.UnhandledException += (sender, eargs) => { Console.Error.WriteLine("Unhandled exception: " + eargs.ExceptionObject); Environment.Exit(1); }; // The user must specify the root path to be explored (i.e. a path containing File GeoDatabases (*.gdb) // as well as an output csv file if (args.Length != 3) { usageExit(); } else { // Bind this ArcObjects application to this machine's ArcGIS license ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop); // Fetch the License ESRI.ArcGIS.esriSystem.IAoInitialize ao = new ESRI.ArcGIS.esriSystem.AoInitialize(); esriLicenseStatus status = ao.Initialize(ESRI.ArcGIS.esriSystem.esriLicenseProductCode.esriLicenseProductCodeStandard); string option = args[0]; string rootPath = args[1]; // Target path is the first argument of the console application string outfile = args[2]; // Output CSV file is the second argument outfile = toCSVPath(outfile); switch (option) { case "-p": // Path to a File GeoDatabase testFGDBPath(rootPath); Console.WriteLine("Processing... please wait."); printCSVHeader(outfile); exploreFGDB(rootPath, outfile); break; case "-P": // Path to a File GeoDatabase testFGDBPath(rootPath); Console.WriteLine("Processing... please wait."); printCSVHeader(outfile); exploreFGDB(rootPath, outfile); break; case "-r": // Root directory that contains File GeoDatabases exploreRootDirectory(rootPath, outfile); break; case "-R": // Root directory that contains File GeoDatabases exploreRootDirectory(rootPath, outfile); break; default: usageExit(); break; } Console.WriteLine("Done Processing."); System.Environment.Exit(0); } }