using DevExpress.XtraEditors; using ESRI.ArcGIS.Carto; using KGIS.Framework.Platform; using KGIS.Framework.Utils; using KGIS.Plugin.LayerProperty.Interface; using KGIS.Plugin.LayerProperty.View.UC_Controls; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace KGIS.Plugin.LayerProperty.View { public partial class FrmLayerProperty : XtraForm, ILayerPropertiesSet { #region 字段 private bool m_IsNew; private UCLayerProperties ucLayerProperties; #endregion #region 构造函数 public FrmLayerProperty() { InitializeComponent(); } public FrmLayerProperty(bool isNew) : this() { m_IsNew = isNew; } #endregion public event System.EventHandler btnApplyClick; public event System.EventHandler ApplyLayerPropertiesSet { add { this.btnApplyClick = (System.EventHandler)Delegate.Combine(this.btnApplyClick, value); } remove { this.btnApplyClick = (System.EventHandler)Delegate.Remove(this.btnApplyClick, value); } } public void InitiateForm() { try { Application.UseWaitCursor = true; if (this.ucLayerProperties == null) { this.ucLayerProperties = new UCLayerProperties(this.m_IsNew); this.ucLayerProperties.btnApplyClick += new System.EventHandler(this.ucLayerProperties_btnApplyClick); this.ucLayerProperties.btnCancelClick += new System.EventHandler(this.ucLayerProperties_btnCancelClick); this.ucLayerProperties.btnOKClick += new System.EventHandler(this.ucLayerProperties_btnOKClick); base.Width = this.ucLayerProperties.Width; base.Height = this.ucLayerProperties.Height + 32; base.CancelButton = this.ucLayerProperties.btnCancel; base.AcceptButton = this.ucLayerProperties.btnOK; } this.ucLayerProperties.Dock = DockStyle.Fill; base.Controls.Add(this.ucLayerProperties); Application.UseWaitCursor = false; } catch (Exception ex) { LogAPI.Debug(string.Format("加载图层属性界面失败:" + ex)); Application.UseWaitCursor = false; //RdbUtil.AddException(ex); } } public bool InitForm(ILayer layer) { try { if (this.ucLayerProperties == null) return false; //Application.UseWaitCursor = true; //if (this.ucLayerProperties == null) //{ // this.ucLayerProperties = new UCLayerProperties(this.m_IsNew); // this.ucLayerProperties.btnApplyClick += new System.EventHandler(this.ucLayerProperties_btnApplyClick); // this.ucLayerProperties.btnCancelClick += new System.EventHandler(this.ucLayerProperties_btnCancelClick); // this.ucLayerProperties.btnOKClick += new System.EventHandler(this.ucLayerProperties_btnOKClick); // base.Width = this.ucLayerProperties.Width; // base.Height = this.ucLayerProperties.Height + 32; // base.CancelButton = this.ucLayerProperties.btnCancel; // base.AcceptButton = this.ucLayerProperties.btnOK; //} //this.ucLayerProperties.Dock = DockStyle.Fill; //base.Controls.Add(this.ucLayerProperties); Application.UseWaitCursor = false; return this.ucLayerProperties.InitUC(layer); } catch (Exception ex) { LogAPI.Debug(string.Format("加载图层属性界面失败:"+ex)); Application.UseWaitCursor = false; //RdbUtil.AddException(ex); } return false; } private void ucLayerProperties_btnOKClick(object sender, System.EventArgs e) { base.DialogResult = DialogResult.OK; base.Close(); Platform.Instance.SendMsg(new KGIS.Framework.Utils.Interface.NotifyMsgPackage() { MsgType = "SaveProject" }); } private void ucLayerProperties_btnCancelClick(object sender, System.EventArgs e) { base.DialogResult = DialogResult.Cancel; base.Close(); } private void ucLayerProperties_btnApplyClick(object sender, System.EventArgs e) { if (this.btnApplyClick != null) { this.btnApplyClick(sender, e); Platform.Instance.SendMsg(new KGIS.Framework.Utils.Interface.NotifyMsgPackage() { MsgType = "SaveProject" }); } } } }