using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.MapView.Views; using System; namespace Kingo.Plugin.MapView.Commands { /// /// 打开最近工程文件 /// public class CmdOpenTheProject : BaseMenuCommand { /// /// 打开工程页面 /// UCOpenProject ucOpenProject = null; IHookHelper hookHelper = null; public override void OnClick() { try { EngineEditorClass engineEditorClass = new EngineEditorClass(); if (engineEditorClass.EditState != esriEngineEditState.esriEngineStateNotEditing) { MessageHelper.ShowTips("当前工程正处于编辑状态,打开工程之前请先结束编辑!"); return; } if (ucOpenProject == null) { ucOpenProject = new UCOpenProject(); ucOpenProject.Closed += UcOpenProject_Closed; } ucOpenProject.ShowInMainWindow(true); } catch (Exception ex) { LogAPI.Debug("在打开工程时发生异常,异常信息如下:" + ex.Message); } } private void UcOpenProject_Closed(object sender, EventArgs e) { try { if (ucOpenProject != null) ucOpenProject = null; } catch (Exception ex) { LogAPI.Debug("在关闭工程时发生异常,异常信息如下:" + ex.Message); } } public override void OnCreate(object Hook) { try { if (hookHelper == null) { hookHelper = new HookHelper(); hookHelper.Hook = Hook; } } catch (Exception ex) { LogAPI.Debug("在 初始化 打开工程 命令时异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("在 初始化 打开工程 命令时异常信息结束"); } } } }