using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using KGIS.Framework.Utils.Helper; using Kingo.Plugin.General.View; using Kingo.PluginServiceInterface; using System; namespace Kingo.Plugin.General.Commands { public class CmdDecompressionDB : BaseMenuCommand { private UCDecompressionDB main { get; set; } private ProjectInfo projectInfo { get; set; } public override void OnClick() { try { if (main == null) { main = new UCDecompressionDB(); main.Title = "数据解压"; main.Height = 500; main.Width = 900; main.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; main.Closed += Main_Closed; main.ShowInMainWindow(false); } } catch (Exception ex) { LogAPI.Debug("DB解压解密工具界面初始化异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("异常信息结束。"); MessageHelper.ShowError("DB解压解密工具界面初始化异常:" + ex.Message); } } private void Main_Closed(object sender, EventArgs e) { try { if (main != null) { main.Close(); } main = null; } catch (Exception ex) { LogAPI.Debug(ex); } } public override bool Enabled { get { try { projectInfo = (MapsManager.Instance.CurrProjectInfo as ProjectInfo); if (projectInfo == null || string.IsNullOrWhiteSpace(PluginServiceInterface.EncryptionHelper.GetDogKey(1, projectInfo.CODE))) { return false; } return true; } catch { return false; } } } public override void OnCreate(object Hook) { } } }