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.
100 lines
2.9 KiB
100 lines
2.9 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.BuildZLDatabase.View; |
|
using Kingo.PluginServiceInterface; |
|
using System; |
|
using System.Collections.Generic; |
|
using System.Linq; |
|
using System.Text; |
|
using System.Threading.Tasks; |
|
|
|
namespace Kingo.Plugin.BuildZLDatabase.Commands |
|
{ |
|
/// <summary> |
|
/// 继承标识码 |
|
/// </summary> |
|
public class CmdInheritBSM : BaseMenuCommand |
|
{ |
|
private EngineEditorClass pEditor = null; |
|
private IHookHelper hookHelper = null; |
|
private FrmInheritBSM frmInheritBSM = null; |
|
public override void OnClick() |
|
{ |
|
try |
|
{ |
|
|
|
if (pEditor.EditState != esriEngineEditState.esriEngineStateNotEditing) |
|
{ |
|
MessageHelper.ShowTips("请先关闭编辑!"); |
|
return; |
|
} |
|
if (frmInheritBSM == null) |
|
{ |
|
frmInheritBSM = new FrmInheritBSM |
|
{ |
|
WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen |
|
}; |
|
frmInheritBSM.Closed += FrmInheritBSM_Closed; |
|
} |
|
frmInheritBSM.ShowInMainWindow(); |
|
} |
|
catch (Exception ex) |
|
{ |
|
MessageHelper.ShowError(ex.Message); |
|
} |
|
} |
|
|
|
private void FrmInheritBSM_Closed(object sender, EventArgs e) |
|
{ |
|
try |
|
{ |
|
if (frmInheritBSM != null) |
|
frmInheritBSM = null; |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("在继承标识码时发生异常,异常信息如下:" + ex.Message); |
|
} |
|
} |
|
|
|
public override void OnCreate(object Hook) |
|
{ |
|
if (pEditor == null) |
|
{ |
|
pEditor = new EngineEditorClass(); |
|
} |
|
if (hookHelper == null) |
|
{ |
|
hookHelper = new HookHelperClass(); |
|
} |
|
hookHelper.Hook = Hook; |
|
} |
|
|
|
public override bool Enabled |
|
{ |
|
get |
|
{ |
|
return JudgeIsHaveTargetPath(); |
|
} |
|
} |
|
private bool JudgeIsHaveTargetPath() |
|
{ |
|
try |
|
{ |
|
if (!(MapsManager.Instance.MapService.GetProjectInfo() is ProjectInfo prj)) |
|
{ |
|
return false; |
|
} |
|
return pEditor.EditState == esriEngineEditState.esriEngineStateNotEditing; |
|
} |
|
catch (Exception ex) |
|
{ |
|
LogAPI.Debug("判定 继承BSM 按钮是否有效时失败,异常原因: " + ex + " ; "); |
|
return false; |
|
} |
|
} |
|
} |
|
}
|
|
|