using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.LocationChange.View; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Kingo.Plugin.LocationChange.Commands { /// /// 坐落信息变更 /// public class CmdLocationChange : BaseMenuCommand { public IHookHelper HookHelper { get; set; } public FrmLocationChange frmLocationChange = null; public override void OnClick() { try { if (frmLocationChange == null) { frmLocationChange = new FrmLocationChange { Width = 500, Height = 420, WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen }; frmLocationChange.Closed += FrmLocationChange_Closed; } frmLocationChange.ShowInMainWindow(true); } catch (Exception ex) { MessageHelper.ShowError("坐落变更初始化失败:" + ex.Message); LogAPI.Debug(ex); } } public override void OnCreate(object Hook) { if (HookHelper == null) { HookHelper = new HookHelperClass(); } HookHelper.Hook = Hook; } private void FrmLocationChange_Closed(object sender, EventArgs e) { if (frmLocationChange != null) frmLocationChange = null; } public override bool Enabled { get { return KGIS.Framework.Maps.MapsManager.Instance.MapService.GetProjectInfo() == null ? false : true; } } } }