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

99 lines
2.8 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.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);
frmLoadBaseData.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
frmLoadBaseData.ShowInMainWindow(true);
}
catch (Exception ex)
{
LogAPI.Debug("在初始化 基础数据加载 命令时异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("在初始化 基础数据加载 命令时异常信息结束");
m_hookHelper = null;
}
}
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
{
if (NotifyMsgEven != null)
NotifyMsgEven(msg);
}
catch (Exception ex)
{
MessageHelper.ShowError(ex.Message);
}
}
private bool JudgeIsHaveTargetPath()
{
try
{
ProjectInfo prj = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo;
if (prj == null)
{
return false;
}
return true;
}
catch (Exception ex)
{
LogAPI.Debug("判定 基础数据加载 按钮是否有效时失败,异常原因: " + ex + " ; ");
return false;
}
}
public override bool Enabled
{
get
{
return JudgeIsHaveTargetPath();
}
}
}
}