internal static void Stop() { if (IsRunning) { _license.Shutdown(); _license = null; Message = null; } }
static void Main(string[] args) { ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop); IAoInitialize aoInit = new AoInitialize(); esriLicenseStatus licStat = aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine); licStat = aoInit.CheckOutExtension(esriLicenseExtensionCode.esriLicenseExtensionCodeSpatialAnalyst); CreateMathFunctionRasterDataset(); aoInit.Shutdown(); }
public static void Main(string[] args) { try { if (args == null || args.Length != 1) { throw new ArgumentException("Command line format: <layer file name>"); } // The output is going to be put at the same path as the input layer file. var layerFilePath = args[0]; if (!File.Exists(layerFilePath)) { throw new FileNotFoundException($"Layer file does not exist: {layerFilePath}"); } // Set up the licensing. if (!ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop)) { throw new ArgumentException("Bind failure. Is ArcGIS Desktop or Engine installed?"); } IAoInitialize aoInit = new AoInitialize(); InitializeLicensing(aoInit); var context = GetContextFromLayer(layerFilePath); List <string> originNames; List <string> destinationNames; IStringArray costAttributeNames; var costMatrixByCostAttributesList = GetCostMatrixByCostAttributesList(context, out costAttributeNames, out originNames, out destinationNames); OutputODCostsToCsvFiles(layerFilePath, costMatrixByCostAttributesList, costAttributeNames, originNames, destinationNames); aoInit.Shutdown(); } catch (Exception e) { // Write errors out to the error stream. Console.Error.WriteLine("Exception thrown: " + e.Message); throw; } }
private void ReturnLicence() { m_license.Shutdown(); }
static void Main() { //cyf 20110612 modify:将许可授权文件由ArcEngine改为ArcINfo //ESRI License Initializer generated code. Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.EngineOrDesktop); IAoInitialize m_AoInitialize = new AoInitialize(); m_AoInitialize.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB); //esriLicenseProductCodeArcInfo);//.esriLicenseProductCodeEngineGeoDB); m_AoInitialize.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB); //esriLicenseProductCodeArcInfo);//.esriLicenseProductCodeEngineGeoDB); //end //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //added by chulili 20110714检测有没有安装arcengine RegistryKey LocalMachineRegKey = Registry.LocalMachine; RegistryKey InstallDirRegKey = LocalMachineRegKey.OpenSubKey(@"SOFTWARE\ESRI\CoreRuntime"); if (InstallDirRegKey == null) { InstallDirRegKey = LocalMachineRegKey.OpenSubKey(@"SOFTWARE\\ESRI\\Engine10.0\\CoreRuntime"); } if (InstallDirRegKey == null) { InstallDirRegKey = LocalMachineRegKey.OpenSubKey(@"SOFTWARE\\ESRI\\Desktop10.0\\CoreRuntime"); } if (InstallDirRegKey == null) { MessageBox.Show("没有安装ArcGIS Runtime或ArcGIS Desktop!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); } //end add ///软件狗的检测 //GeoOneKey key = new GeoOneKey(); //if (key.addkey() != -1) //{ bool b = GetProcessSysmain(); if (b == true) { //SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "该程序已启动!"); MessageBox.Show("该程序已启动!请查看程序是否正在运行,或请在进程中关闭。", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); } else { //deleted by chulili 20110531 删除psc的数据库连接窗体,仅适用南京的数据库连接窗体 //********************************************************************************************** //guozhegng 2011-2-25 系统维护库的连接正确性判断以及库体结构完整性判断// //#region 系统维护库的连接正确性判断以及库体结构完整性判断 //Exception ex = null; //clsAddAppDBConnection addAppDB = new clsAddAppDBConnection(); //string sConnect = addAppDB.GetAppDBConInfo(out ex); //if (string.IsNullOrEmpty(sConnect)) //{ // sConnect = addAppDB.SetAppDBConInfo(out ex); //} //if (!string.IsNullOrEmpty(sConnect)) //{ // addAppDB.JudgeAppDbConfiguration(sConnect, out ex); // if (ex != null) // { // //if (SysCommon.Error.ErrorHandle.ShowFrmInformation("是", "否", "系统维护库库体结构错误:" + ex.Message + ",\n是否重新配置系统维护库连接信息?")) // if (MessageBox.Show("系统维护库库体结构错误:" + ex.Message + ",\n是否重新配置系统维护库连接信息?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) // { // sConnect = addAppDB.SetAppDBConInfo(out ex); // } // else // { // Application.Exit(); // return; // } // } //} //else //{ // SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "获取系统维护库连接信息失败"); // Application.Exit(); // return; //} //#endregion //end deleted by chulili 20110531 //登陆主窗体条件设置 if (ModuleOperator.CheckLogin()) { ISelectionEnvironmentThreshold threshold = new SelectionEnvironmentClass(); threshold.WarningThreshold = 2000; Application.Run(new frmMain()); } } m_AoInitialize.Shutdown(); m_AoInitialize = null; m_AOLicenseInitializer.ShutdownApplication(); m_AOLicenseInitializer = null; }
private void ShutdownLicense() { aoInit.Shutdown(); }
static void Main(string[] args) { #region Initialize ESRI.ArcGIS.esriSystem.AoInitialize aoInit = null; try { Console.WriteLine("Obtaining license"); ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Desktop); aoInit = new AoInitialize(); esriLicenseStatus licStatus = aoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeAdvanced); Console.WriteLine("Ready with license."); } catch (Exception exc) { // If it fails at this point, shutdown the test and ignore any subsequent errors. Console.WriteLine(exc.Message); } #endregion try { // Input database and Mosaic Dataset string MDWorkspaceFolder = @"e:\md\Samples\GetSetKP\RasterSamples.gdb"; string MDName = @"LAC"; // Command line setting of above input if provided. string[] commandLineArgs = Environment.GetCommandLineArgs(); if (commandLineArgs.GetLength(0) > 1) { MDWorkspaceFolder = commandLineArgs[1]; MDName = commandLineArgs[2]; } // Open MD Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory"); IWorkspaceFactory mdWorkspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType); IWorkspace mdWorkspace = mdWorkspaceFactory.OpenFromFile(MDWorkspaceFolder, 0); IRasterWorkspaceEx workspaceEx = (IRasterWorkspaceEx)(mdWorkspace); IMosaicDataset mosaicDataset = (IMosaicDataset)workspaceEx.OpenRasterDataset(MDName); // Set Mosaic Dataset item information. SetMosaicDatasetItemInformation(mosaicDataset); // Set Key Property 'DataType' on the Mosaic Dataset to value 'Processed' // The change will be reflected on the 'General' page of the mosaic dataset // properties under the 'Source Type' property. SetKeyProperty((IDataset)mosaicDataset, "DataType", "Processed"); // Set the Product Definition on the Mosaic Dataset to 'NATURAL_COLOR_RGB' // First set the 'BandDefinitionKeyword' key property to natural color RGB. SetKeyProperty((IDataset)mosaicDataset, "BandDefinitionKeyword", "NATURAL_COLOR_RGB"); // Then set band names and wavelengths on the mosaic dataset. SetBandProperties((IDataset)mosaicDataset); // Last and most important, refresh the mosaic dataset so the changes are saved. ((IRasterDataset3)mosaicDataset).Refresh(); #region Shutdown Console.WriteLine("Success."); Console.WriteLine("Press any key..."); Console.ReadKey(); // Shutdown License aoInit.Shutdown(); #endregion } catch (Exception exc) { #region Shutdown Console.WriteLine("Exception Caught while creating Function Raster Dataset. " + exc.Message); Console.WriteLine("Failed."); Console.WriteLine("Press any key..."); Console.ReadKey(); // Shutdown License aoInit.Shutdown(); #endregion } }
private void TerminateLicense() { init.Shutdown(); }