using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.PluginServiceInterface; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UIShell.OSGi; namespace Kingo.Plugin.BHTB_Extract.Commands { public class CmdBHTBResult : BaseMenuCommand { IEngineEditor m_pEditor = null; IBGResultFormHelper frmGCDataToSHPGTY = null; public override void OnClick() { if (m_pEditor.EditState == esriEngineEditState.esriEngineStateEditing) { MessageHelper.ShowTips("请先关闭编辑!"); return; } IFeatureLayer BHTBLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB"); if (BHTBLayer != null) { frmGCDataToSHPGTY = BundleRuntime.Instance.GetFirstOrDefaultService(); if (frmGCDataToSHPGTY != null) { frmGCDataToSHPGTY.InitView(BHTBLayer); } } } public override void OnCreate(object Hook) { m_pEditor = new EngineEditorClass(); } public override bool Enabled => JudgeIsHaveTargetPath(); private bool JudgeIsHaveTargetPath() { try { IFeatureLayer BHTBLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB"); if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj) || BHTBLayer == null) { return false; } return m_pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing; } catch (Exception ex) { LogAPI.Debug("判定 变化图斑导出 按钮是否有效时失败,异常原因: " + ex + " ; "); return false; } } } }