森林草原湿地荒漠调查
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.
 
 
 

95 lines
2.7 KiB

using ESRI.ArcGIS.Controls;
using KGIS.Framework.Commands;
using KGIS.Framework.Maps;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using KGIS.Framework.Utils.Interface;
using Kingo.Plugin.DataLoad.View;
using Kingo.PluginServiceInterface;
using System;
namespace Kingo.Plugin.DataLoad.Commands
{
public class CmdLoadBaseData : BaseMenuCommand
{
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()
{
IEngineEditor pEditor = new EngineEditorClass();
if (pEditor.EditState == esriEngineEditState.esriEngineStateEditing)
{
MessageHelper.ShowTips("请先关闭编辑!");
return;
}
try
{
FrmLoadBaseData frmLoadBaseData = new FrmLoadBaseData(m_hookHelper)
{
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen
};
frmLoadBaseData.ShowInMainWindow(true);
}
catch (Exception ex)
{
LogAPI.Debug("在初始化 基础数据加载 命令时异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("在初始化 基础数据加载 命令时异常信息结束");
m_hookHelper = null;
}
}
private void Main_Closed(object sender, EventArgs e)
{
NotifyMsgPackage msg = new NotifyMsgPackage
{
MsgType = "OpenPrj"
};
SetNotifyMsg(msg);
}
public event Action<NotifyMsgPackage> NotifyMsgEven;
public void SetNotifyMsg(NotifyMsgPackage msg)
{
try
{
NotifyMsgEven?.Invoke(msg);
}
catch (Exception ex)
{
MessageHelper.ShowError(ex.Message);
}
}
public override bool Enabled
{
get
{
return JudgeIsHaveTargetPath();
}
}
private bool JudgeIsHaveTargetPath()
{
try
{
if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj)) return false;
return true;
}
catch (Exception ex)
{
LogAPI.Debug("判定 基础数据加载 按钮是否有效时失败,异常原因: " + ex + " ; ");
return false;
}
}
}
}