|
|
|
|
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 CmdLoadDDTCData : BaseMenuCommand
|
|
|
|
|
{
|
|
|
|
|
IEngineEditor pEditor = null;
|
|
|
|
|
private IHookHelper m_hookHelper = null;
|
|
|
|
|
public override void OnCreate(object hook)
|
|
|
|
|
{
|
|
|
|
|
if (m_hookHelper == null)
|
|
|
|
|
{
|
|
|
|
|
m_hookHelper = new HookHelperClass();
|
|
|
|
|
}
|
|
|
|
|
m_hookHelper.Hook = hook;
|
|
|
|
|
pEditor = new EngineEditorClass();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick()
|
|
|
|
|
{
|
|
|
|
|
if (pEditor.EditState == esriEngineEditState.esriEngineStateEditing)
|
|
|
|
|
{
|
|
|
|
|
MessageHelper.ShowTips("请先关闭编辑!");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
FrmLoadDDTCData frmLoadDDTC = new FrmLoadDDTCData();
|
|
|
|
|
frmLoadDDTC.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
|
|
|
|
|
frmLoadDDTC.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 !string.IsNullOrWhiteSpace(prj.ZLDatabase) && pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
LogAPI.Debug("判定 检测数据加载 按钮是否有效时失败,异常原因: " + ex + " ; ");
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override bool Enabled
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return JudgeIsHaveTargetPath();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|