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.
92 lines
2.7 KiB
92 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 Kingo.Plugin.BGResultManager.View; |
|
using Kingo.PluginServiceInterface; |
|
using System; |
|
|
|
namespace Kingo.Plugin.BGResultManager.Commands |
|
{ |
|
public class CreateBGVCTTemplateCommand : BaseMenuCommand |
|
{ |
|
private IHookHelper m_hookHelper = null; |
|
FrmCreateVCTTemplate main = null; |
|
private EngineEditorClass pEditor = null; |
|
public override void OnClick() |
|
{ |
|
try |
|
{ |
|
if (pEditor == null) |
|
{ |
|
pEditor = new EngineEditorClass(); |
|
} |
|
if (pEditor.EditState != esriEngineEditState.esriEngineStateNotEditing) |
|
{ |
|
MessageHelper.ShowTips("请先关闭编辑!"); |
|
return; |
|
} |
|
main = new FrmCreateVCTTemplate(); |
|
main.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; |
|
main.ShowInMainWindow(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug(ex); |
|
} |
|
|
|
} |
|
|
|
public override void OnCreate(object hook) |
|
{ |
|
if (hook == null) |
|
{ |
|
return; |
|
} |
|
try |
|
{ |
|
if (m_hookHelper == null) |
|
{ |
|
m_hookHelper = new HookHelperClass(); |
|
m_hookHelper.Hook = hook; |
|
} |
|
if (pEditor == null) |
|
{ |
|
pEditor = new EngineEditorClass(); |
|
} |
|
} |
|
catch (Exception ex) |
|
{ |
|
m_hookHelper = null; |
|
LogAPI.Debug("初始化 变更模板 时异常: " + ex + " ; "); |
|
return; |
|
} |
|
} |
|
|
|
public override bool Enabled |
|
{ |
|
get |
|
{ |
|
return JudgeIsHaveTargetPath(); |
|
} |
|
} |
|
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; |
|
} |
|
} |
|
} |
|
}
|
|
|