using KGIS.Framework.Commands; using KGIS.Framework.Utils; using Kingo.Plugin.MapView.Views.AppMenuView; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Kingo.Plugin.MapView.Commands.ShortKey { public class CmdShortcutKeyCommand : BaseMenuCommand { private UCShortcutKeyDescription shortcutKeyDescription { get; set; } public override void OnClick() { try { //bool showSuccess = KGIS.Framework.Platform.Platform.Instance.GetViewManager().OpenViewByID(new Guid("A347EB08-E68F-4CB7-BFDB-B841F4D85846")); bool showSuccess = UCShortcutKeyDescription.Instance == null; if (!showSuccess) { return; } if (shortcutKeyDescription == null) { shortcutKeyDescription = new UCShortcutKeyDescription(); shortcutKeyDescription.CloseViewHandler += ShortcutKeyDescription_CloseViewHandler; ; } shortcutKeyDescription.ShowPanel(); } catch (Exception ex) { LogAPI.Debug("在启动 帮助 命令时异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("在启动 帮助 命令时异常信息结束"); } } private void ShortcutKeyDescription_CloseViewHandler(object sender, EventArgs e) { try { if (shortcutKeyDescription != null) { shortcutKeyDescription.ClosePanel(); } shortcutKeyDescription = null; } catch (Exception ex) { LogAPI.Debug(ex.Message); } } 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("在初始化 帮助 命令时异常信息结束"); } } } }