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

67 lines
2.0 KiB

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;
/// <summary>
/// 属性批量赋值的点击事件
/// </summary>
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;
}
}
}
}