using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using Kingo.Plugin.AttributeProcess.Views; using Kingo.PluginServiceInterface; using System; namespace Kingo.Plugin.AttributeProcess.Commands { public class AttributeBatchAssignmentCommand : BaseMenuCommand { IEngineEditor m_pEditor; BaseWindow window = null; /// /// 属性批量赋值的点击事件 /// public override void OnClick() { if (window == null) { window = new UCAttributeBatchAssignment { Title = "属性批量维护", ResizeMode = System.Windows.ResizeMode.NoResize, WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen }; } window.Closed += Window_Closed; window.ShowInMainWindow(true); } public override void OnCreate(object Hook) { m_pEditor = new EngineEditorClass(); } private void Window_Closed(object sender, EventArgs e) { if (window != null) { window.Close(); window = null; } } 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; } } } }