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

106 lines
3.0 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 KGIS.Framework.Commands;
using Kingo.PluginServiceInterface;
using Kingo.Plugin.DataLoad.View;
using KGIS.Framework.Utils.Interface;
namespace Kingo.Plugin.DataLoad.Commands
{
public class CmdLoadOtherData : 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
{
FrmLoadOtherData frmLoadOtherData = new FrmLoadOtherData();
frmLoadOtherData.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
frmLoadOtherData.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();
msg.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();
}
}
}
}