using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using ESRI.ArcGIS.Geodatabase; using KGIS.Plugin.LayerProperty.Utils; namespace KGIS.Plugin.LayerProperty.View.UC_Controls { public partial class UCFieldsCombox : UserControl { public delegate void SelectedFieldChangedHandler(IField field); private IFields m_Fields; private bool m_HaveNone; private bool m_IsNumberOnly; private IField selectedField; public event UCFieldsCombox.SelectedFieldChangedHandler SelectedFieldChanged; public IField SelectedField { get { return this.selectedField; } set { this.selectedField = value; } } public UCFieldsCombox() { InitializeComponent(); } public void InitFieldList(IFields fields, string selected) { try { this.m_Fields = fields; Utils.Util.InitFieldList(ref this.cmbFields, fields, selected); } catch (Exception ex) { //RdbUtil.AddException(ex); } } public void InitFieldList(IFields fields, string selected, bool haveNone) { try { this.m_Fields = fields; this.m_HaveNone = haveNone; Utils.Util.InitFieldList(ref this.cmbFields, fields, selected, haveNone); } catch (Exception ex) { //RdbUtil.AddException(ex); } } public void InitFieldList(IFields fields, string selected, bool haveNone, bool isNumberOnly) { try { this.m_Fields = fields; this.m_HaveNone = haveNone; this.m_IsNumberOnly = isNumberOnly; Utils.Util.InitFieldList(ref this.cmbFields, fields, selected, haveNone, isNumberOnly); } catch (Exception ex) { //RdbUtil.AddException(ex); } } public void InitFieldList(IFields fields, string selected, bool haveNone, bool isNumberOnly, bool useAlias) { try { this.m_Fields = fields; this.m_HaveNone = haveNone; this.m_IsNumberOnly = isNumberOnly; this.chkUseAliasName.Checked = useAlias; Utils.Util.InitFieldList(ref this.cmbFields, fields, selected, haveNone, isNumberOnly, useAlias); } catch (Exception ex) { //RdbUtil.AddException(ex); } } private void cmbFields_SelectedIndexChanged(object sender, System.EventArgs e) { try { ItemInfo itemInfo = this.cmbFields.SelectedItem as ItemInfo; if (itemInfo != null) { if (this.SelectedFieldChanged != null) { this.SelectedFieldChanged(itemInfo.InnerValue); } this.selectedField = itemInfo.InnerValue; } } catch (Exception ex) { //RdbUtil.AddException(ex); } } private void chkUseAliasName_CheckedChanged(object sender, System.EventArgs e) { if (this.m_Fields != null) { Utils.Util.InitFieldList(ref this.cmbFields, this.m_Fields, this.cmbFields.Text, this.m_HaveNone, this.m_IsNumberOnly, this.chkUseAliasName.Checked); } } } }