using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Core.Attributes; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.MapView.Views.GoToXYUi; using System; namespace Kingo.Plugin.MapView.Commands { //[PathAttribute("Kingo.Plugin.MapView.Commands.GoToXYCommandClass")] public class GoToXYCommandClass : BaseMenuCommand { public static IHookHelper m_hookHelper;//获取地图控件和主窗体 public override void OnClick() { try { if (m_hookHelper != null) { //GoToXYUi goToXYUi = new GoToXYUi(m_hookHelper); //goToXYUi.ShowInMainWindow(); GoToXYUi.Instance(m_hookHelper).ShowInMainWindow(); } else { MessageHelper.Show("hookHelper获取失败"); //return; } } catch (Exception ex) { LogAPI.Debug("点击 转到xy 时异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("点击 转到xy 时异常信息结束"); } } public override void OnCreate(object Hook) { try { if (m_hookHelper == null) { m_hookHelper = new HookHelper(); m_hookHelper.Hook = Hook; } } catch (Exception ex) { LogAPI.Debug("初始化 转到xy 时异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("初始化 转到xy 时异常信息结束"); } } } }