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

77 lines
2.4 KiB

6 months ago
using KGIS.Framework.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KGIS.Framework.Utils;
using KGIS.Framework.Utils.Helper;
using KGIS.Framework.Maps;
using ESRI.ArcGIS.Controls;
using Kingo.Plugin.MakeTaskPackage.View;
using Kingo.PluginServiceInterface;
namespace Kingo.Plugin.MakeTaskPackage.Commands
{
public class CmdMakeTaskPackage : BaseMenuCommand
{
IEngineEditor m_pEditor;
private IHookHelper m_hookHelper = null;
public override void OnCreate(object Hook)
{
try
{
if (m_hookHelper == null)
{
m_hookHelper = new HookHelper();
m_hookHelper.Hook = Hook;
}
m_pEditor = new EngineEditorClass();
}
catch (Exception ex)
{
LogAPI.Debug("加载 外业底图制作 命令时发生异常,异常信息如下:");
LogAPI.Debug(ex);
LogAPI.Debug("异常信息结束");
}
}
public override void OnClick()
{
try
{
FrmMakeTaskPackage frmMakeTaskPackage = new FrmMakeTaskPackage();
frmMakeTaskPackage.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
frmMakeTaskPackage.ShowInMainWindow(true);
}
catch (Exception ex)
{
LogAPI.Debug("外业底图制作 发生异常,异常信息如下:");
LogAPI.Debug(ex);
MessageHelper.ShowError("数据导出发生异常" + 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) && m_pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing;
}
catch (Exception ex)
{
LogAPI.Debug("判定 检测数据加载 按钮是否有效时失败,异常原因: " + ex + " ; ");
return false;
}
}
}
}