using ESRI.ArcGIS.Carto; using ESRI.ArcGIS.Controls; using KGIS.Framework.AE.ExtensionMethod; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.MapView.Views; using System; namespace Kingo.Plugin.MapView.Commands { public class ClaculationMJCmd : BaseMapMenuCommand { BaseWindow window = null; public override void OnClick() { if (m_hookHelper == null) return; IFeatureLayer layer = null; try { object obj = m_hookHelper.GetCustomProperty(); if (obj != null && obj is ILayer) { if (obj is IFeatureLayer) { layer = obj as IFeatureLayer; } } if (layer != null) { window = new UcClaculationMJView(layer); window.Title = (obj as ILayer).Name + window.Title; window.ResizeMode = System.Windows.ResizeMode.NoResize; window.Closed += Window_Closed; window.ShowInMainWindow(true); } } catch (Exception ex) { MessageHelper.ShowError(string.Format("计算椭球面积失败!{0}", ex.Message)); LogAPI.Debug("计算椭球面积时发生异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("异常信息结束。"); } } private void Window_Closed(object sender, EventArgs e) { window = null; } public override void OnCreate(object Hook) { try { if (m_hookHelper == null) { m_hookHelper = new HookHelper(); m_hookHelper.Hook = Hook; } } catch (Exception ex) { LogAPI.Debug("加载 计算椭球面积 命令时发生异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("异常信息结束"); } } } }