using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Platform; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using KGIS.Framework.Views; using System; using Kingo.Plugin.BHTB_Extract.View; using ESRI.ArcGIS.Controls; using Kingo.PluginServiceInterface; using UIShell.OSGi; namespace Kingo.Plugin.BHTB_Extract.Commands { /// /// 多窗口比对 /// public class CmdMulitForm : BaseMenuCommand { public override void OnCreate(object hook) { } UcMapControl view = null; public override void OnClick() { try { //view = new UcMapControl(); //(Platform.Instance.ViewManager as IViewManager2).AddDocument(view, DockStyle.DockRight); //ProjectInfo ProInfo = MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo; //if (ProInfo != null) // ProInfo.MulitMapData = ProInfo.TempData; //view.SetLayer(); IUcMulitMapControlHelper ucMulitMapControlHelper = BundleRuntime.Instance.GetFirstOrDefaultService(); if (ucMulitMapControlHelper != null) { ucMulitMapControlHelper.InitView(); ucMulitMapControlHelper.MarkLabelLayer(); if (ucMulitMapControlHelper.CurrentGeometry != null && !ucMulitMapControlHelper.CurrentGeometry.IsEmpty) ucMulitMapControlHelper.SetMask(ucMulitMapControlHelper.CurrentGeometry); } } catch (Exception ex) { LogAPI.Debug(ex); MessageHelper.ShowError("多窗口比对出现错误,可能的原因是:" + ex.Message); } } public override bool Enabled { get { return JudgeIsHaveTargetPath(); } } private bool JudgeIsHaveTargetPath() { try { return KGIS.Framework.Maps.MapsManager.Instance.MapService.GetProjectInfo() == null ? false : true; } catch (Exception ex) { LogAPI.Debug("判定 多窗口比对 按钮是否有效时失败,异常原因: " + ex + " ; "); return false; } } } }