using ESRI.ArcGIS.Controls; using KGIS.Framework.Commands; using KGIS.Framework.Utils; using Kingo.Plugin.DTBJKLoadData.View; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Kingo.Plugin.DTBJKLoadData.Commands { /// /// 加载单图斑基础数据库 /// public class CmdLoadDTBBaseData : BaseMenuCommand { private UCLoadDTBJKData uCLoadDTBJKData { get; set; } private IHookHelper m_hookHelper { get; set; } public override void OnClick() { try { if (uCLoadDTBJKData == null) { uCLoadDTBJKData = new UCLoadDTBJKData(m_hookHelper); uCLoadDTBJKData.Closed += ExportDTBJK_CloseViewHandler; uCLoadDTBJKData.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; } uCLoadDTBJKData.ShowInMainWindow(true); } catch (Exception ex) { LogAPI.Debug(ex.Message); uCLoadDTBJKData = null; } } public override void OnCreate(object Hook) { try { if (m_hookHelper == null) m_hookHelper = new HookHelperClass(); m_hookHelper.Hook = Hook; } catch (Exception ex) { LogAPI.Debug(ex); } } private void ExportDTBJK_CloseViewHandler(object sender, EventArgs e) { try { if (uCLoadDTBJKData != null) { uCLoadDTBJKData.DataContext = null; uCLoadDTBJKData = null; } } catch (Exception ex) { LogAPI.Debug("单图斑基础数据加载失败:" + ex); } } } }