using ESRI.ArcGIS.ADF.BaseClasses; using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using KGIS.Framework.Platform; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using KGIS.Framework.Maps; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Kingo.Plugin.NYYP.View; using KGIS.Framework.Commands; namespace Kingo.Plugin.NYYP.Commands { public class CmdAllTBYP : BaseMenuCommand { private UCAllTBYPList ucAllTBYPList = null; private IHookHelper m_hookHelper = null; public override void OnCreate(object hook) { if (m_hookHelper == null) { m_hookHelper = new HookHelperClass(); } m_hookHelper.Hook = hook; } public override void OnClick() { try { IFeatureLayer pJCDLTBTBFeatureLayer = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("地类图斑"); if (pJCDLTBTBFeatureLayer == null || pJCDLTBTBFeatureLayer.FeatureClass == null) { MessageHelper.ShowTips("未找到基础地类图斑图层!"); return; } else { if (pJCDLTBTBFeatureLayer.FeatureClass.FeatureCount(null) == 0) { KGIS.Framework.Utils.Helper.MessageHelper.ShowTips("基础地类图斑表数据为空,请先导入基础地类图斑数据!"); return; } } if (ucAllTBYPList != null) { if (ucAllTBYPList != null) ucAllTBYPList.CloseDetailView(); ucAllTBYPList.ClosePanel(); ucAllTBYPList = null; } if (ucAllTBYPList == null) { ucAllTBYPList = new UCAllTBYPList(m_hookHelper); ucAllTBYPList.CloseViewHandler += UCAllTBYPList_CloseViewHandler; } ucAllTBYPList.ShowPanel(); } catch (Exception ex) { LogAPI.Debug("在初始化 全图斑判读 命令时异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("在初始化 全图斑判读 命令时异常信息结束"); m_hookHelper = null; } } private void UCAllTBYPList_CloseViewHandler(object sender, EventArgs e) { if (ucAllTBYPList != null) { ucAllTBYPList.DataContext = null; ucAllTBYPList = null; } } public override bool Enabled { get { return true; } } } }