年度变更建库软件5.0版本
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

98 lines
2.8 KiB

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 CmdJCTBYP : BaseMenuCommand
{
private UCJCTBYPList ucJCTBYPList = 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 pJCTBFeatureLayer = MapsManager.Instance.MapService.GetFeatureLayerByName("JCTB");
if (pJCTBFeatureLayer == null || pJCTBFeatureLayer.FeatureClass == null)
{
MessageHelper.ShowTips("未找到监测图斑图层!");
return;
}
else
{
if (pJCTBFeatureLayer.FeatureClass.FeatureCount(null) == 0)
{
KGIS.Framework.Utils.Helper.MessageHelper.ShowTips("监测图斑表数据为空,请先导入监测图斑数据!");
return;
}
}
if (ucJCTBYPList != null)
{
if (ucJCTBYPList != null)
ucJCTBYPList.CloseDetailView();
ucJCTBYPList.ClosePanel();
ucJCTBYPList = null;
}
if (ucJCTBYPList == null)
{
ucJCTBYPList = new UCJCTBYPList(m_hookHelper);
ucJCTBYPList.CloseViewHandler += UCJCTBYPList_CloseViewHandler;
}
ucJCTBYPList.ShowPanel();
}
catch (Exception ex)
{
LogAPI.Debug("在初始化 监测图斑判读 命令时异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("在初始化 监测图斑判读 命令时异常信息结束");
m_hookHelper = null;
}
}
private void UCJCTBYPList_CloseViewHandler(object sender, EventArgs e)
{
if (ucJCTBYPList != null)
{
ucJCTBYPList.DataContext = null;
ucJCTBYPList = null;
}
}
public override bool Enabled
{
get
{
return true;
}
}
}
}