using KGIS.Framework.Commands; using KGIS.Framework.Maps; using KGIS.Framework.Utils; using Kingo.Plugin.MapView.Views.AppMenuView; using Kingo.PluginServiceInterface; using System; namespace Kingo.Plugin.MapView.Commands { public class CmdUserInfoSetting : BaseMenuCommand { private UCProjectInfoSetting ProjectInfoSetting { get; set; } public override void OnClick() { try { if (ProjectInfoSetting == null) { ProjectInfoSetting = new UCProjectInfoSetting { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen }; ProjectInfoSetting.Closed += Main_Closed; ProjectInfoSetting.ShowInMainWindow(false); } } catch (Exception ex) { LogAPI.Debug("用户信息设置界面初始化异常,异常信息如下:"); LogAPI.Debug(ex); LogAPI.Debug("异常信息结束。"); KGIS.Framework.Utils.Helper.MessageHelper.ShowError("用户信息设置界面初始化异常:" + ex.Message); } } private void Main_Closed(object sender, EventArgs e) { try { if (ProjectInfoSetting != null) { ProjectInfoSetting.Close(); } ProjectInfoSetting = null; } catch (Exception ex) { LogAPI.Debug(ex); } } public override void OnCreate(object Hook) { } public override bool Enabled { get { return (MapsManager.Instance.MapService.GetProjectInfo() as ProjectInfo) == null ? false : true; } } } }