年度变更建库软件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.

92 lines
3.0 KiB

6 months ago
using ESRI.ArcGIS.Controls;
using KGIS.Framework.Commands;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using KGIS.Framework.Views;
using Kingo.Plugin.DataCheck.Helper.JCCZCDYD;
using Kingo.Plugin.DataCheck.View;
using Kingo.PluginServiceInterface;
using System;
namespace Kingo.Plugin.DataCheck.Commands
{
/// <summary>
/// 基础城镇村等用地检查
/// </summary>
public class JCCZCDYDDatacheckCommand : BaseMenuCommand
{
private EngineEditorClass pEditor = null;
private IHookHelper hookHelper = null;
private IDockPanel2 view = null;
public override void OnCreate(object hook)
{
if (hookHelper == null)
{
hookHelper = new HookHelperClass();
}
hookHelper.Hook = hook;
pEditor = new EngineEditorClass();
}
public override void OnClick()
{
try
{
ProjectInfo ProInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
if (ProInfo == null)
{
MessageHelper.Show("请先打开工程");
return;
}
if (pEditor == null)
{
pEditor = new EngineEditorClass();
}
if (pEditor.EditState != esriEngineEditState.esriEngineStateNotEditing)
{
MessageHelper.ShowTips("请先关闭编辑!");
return;
}
if (view == null)
{
view = new V_DataCheck("", new JCCZCDYDDataCheckHelper());
view.Title = "基础城镇村等用地检查";
view.CloseViewHandler += (sender, e) =>
{
view = null;
};
}
if (view != null)
{
view.ShowPanel();
}
}
catch (Exception ex)
{
MessageHelper.ShowTips("变更后数据检查初始化失败:" + ex.Message);
LogAPI.Debug("变更后数据检查初始化失败:" + ex.Message);
}
}
public override bool Enabled => JudgeIsHaveTargetPath();
private bool JudgeIsHaveTargetPath()
{
try
{
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
if (prj == null)
{
return false;
}
return !string.IsNullOrWhiteSpace(prj.BGDatabase) && pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing; ;
}
catch (Exception ex)
{
LogAPI.Debug("判定 检测数据加载 按钮是否有效时失败,异常原因: " + ex + " ; ");
return false;
}
}
}
}