using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.DataDictionary.Views; using System; namespace Kingo.Plugin.DataDictionary.Commands { public class CmdDicManage : BaseMenuCommand { public override void OnCreate(object hook) { } public override void OnClick() { try { //KGIS.Framework.Common.Utils.LicenseManager.License(); FrmDicManage main = new FrmDicManage { Width = 1100, Height = 520, WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen }; main.ShowInMainWindow(false); } catch (Exception ex) { LogAPI.Debug(ex); MessageHelper.ShowError("字典维护出现错误,可能的原因是:" + ex.Message); } } public override bool Enabled { get { return JudgeIsHaveTargetPath(); } } private bool JudgeIsHaveTargetPath() { try { object pTemps = MapsManager.Instance.MapService.GetFeatureLayerByLayerName("地类图斑"); if (pTemps == null) { return false; } else { return true; } } catch (Exception ex) { LogAPI.Debug("判定 维护数据字典 按钮是否有效时失败,异常原因: " + ex + " ; "); return false; } } //public override string Caption //{ // get // { // return "维护数据字典"; // } //} } }