private void FTestPartAsynWait_Load(object sender, EventArgs e) { items.Add(new CobITemInfo("yf", 23)); items.Add(new CobITemInfo("zhn", 31)); items.Add(new CobITemInfo("tq", 18)); DropdownBoxHelper.BindingIEnumerableGenericToComboBox <CobITemInfo>(comboBox1, items); //DropdownBoxHelper.BindingIEnumerableGenericToComboBox<CobITemInfo>(comboBox1, items, string.Empty); //DropdownBoxHelper.BindingIEnumerableGenericToComboBox<CobITemInfo>(comboBox1, t => { return t.Name; }, items); //DropdownBoxHelper.BindingIEnumerableGenericToToolStripComboBox<CobITemInfo>(toolStripComboBox1, items, nameof(CobITemInfo.Name)); //DropdownBoxHelper.BindingIEnumerableGenericToToolStripComboBox<CobITemInfo>(toolStripComboBox1, items); DropdownBoxHelper.BindingIEnumerableGenericToToolStripComboBox <CobITemInfo>(toolStripComboBox1, t => { return(t.Name); }, items); }
/// <summary> /// 刷新数据 /// </summary> public override void RefreshData() { try { List <ConfigParaGroup> groups = this._configLogic.GetAllConfigParaGroup(); groups.Insert(0, this._allGroup); ConfigParaGroup selectedItem = null; if (comGroup.Items.Count > 0) { var oldSelectedItem = DropdownBoxHelper.GetGenericFromComboBox <ConfigParaGroup>(comGroup); if (oldSelectedItem != null) { var ret = (from tmpItem in groups where oldSelectedItem.ID == tmpItem.ID select tmpItem).ToList(); if (ret.Count > 0) { selectedItem = ret[0]; } } } if (selectedItem == null && groups.Count > 0) { selectedItem = groups[0]; } this.comGroup.SelectedIndexChanged -= this.comGroup_SelectedIndexChanged; try { DropdownBoxHelper.BindingIEnumerableGenericToComboBox <ConfigParaGroup>(comGroup, groups, nameof(ConfigParaGroup.Name), null); } finally { this.comGroup.SelectedIndex = -1; this.comGroup.SelectedIndexChanged += this.comGroup_SelectedIndexChanged; DropdownBoxHelper.SetGenericToComboBox(comGroup, selectedItem); } } catch (Exception ex) { Loger.Error(ex); } }
/// <summary> /// 构造函数 /// </summary> public PropertyGridEnumControl(object value) { InitializeComponent(); if (value == null) { throw new ArgumentNullException(nameof(value)); } Type valueType = value.GetType(); if (!valueType.IsEnum) { throw new ArgumentException(string.Format("类型:{0}不是枚举类型", valueType.FullName)); } List <FieldInfoEx> dbiItems = EnumEx.GetEnumFieldInfoExList(valueType); FieldInfoEx selectedItem = (from item in dbiItems where value.Equals(item.Value) select item).FirstOrDefault(); DropdownBoxHelper.BindingIEnumerableGenericToComboBox <FieldInfoEx>(comboBoxEnum, dbiItems, "Text", selectedItem); }
private void FParaManager_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } try { List <ConfigParaGroup> groups = this._configLogic.GetAllConfigParaGroup(); DropdownBoxHelper.BindingIEnumerableGenericToComboBox <ConfigParaGroup>(comboBoxParaGroup, groups, nameof(ConfigParaGroup.Name), null); this._srcItems = this._configLogic.GetAllConfigParaKeyValue(); this._bindItems.AddRange(this._srcItems); this.pgPara.ShowData(this._bindItems, "FParaManager.ConfigParaKeyValue", null, null, new ConfigParaKeyValue().GetAllowEditColumns()); } catch (Exception ex) { MessageBox.Show(ex.Message); Loger.Error(ex); } }
private void FConfigParaKeyValueEdit_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } try { this._serviceList.AddRange(this._configLogic.GetConfigParaServiceMap(this._configParaKeyValue.ID)); pgValidDomain.ShowData(this._serviceList, "FConfigParaKeyValueEdit.ConfigParaServiceMap", null, null, new string[] { nameof(ConfigParaServiceMap3.IsSelected) }); List <ConfigParaGroup> groups = this._configLogic.GetAllConfigParaGroup(); DropdownBoxHelper.BindingIEnumerableGenericToComboBox <ConfigParaGroup>(comGroup, groups, nameof(ConfigParaGroup.Name), this._configParaKeyValue.Group); this.txtKey.Text = this._configParaKeyValue.Key; this.rtxtValue.Text = this._configParaKeyValue.Value; this.rtxtDes.Text = this._configParaKeyValue.Des; } catch (Exception ex) { MessageBox.Show(ex.Message); Loger.Error(ex); } }
private void UCDBStructControl_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } try { DBTableInfoEx.ShowFieldChanged = this.ShowFieldChanged; List <DatabaseConfig> items = DatabaseConfigManager.GetAllConfigItems(); DropdownBoxHelper.BindingIEnumerableGenericToComboBox <DatabaseConfig>(comboBoxDB, items, nameof(DatabaseConfig.ConName)); dgvTables.ShowData(this._tableBindingList.DataSource, "UCDBStructControl.dgvTables", null, null, new string[] { nameof(DBTableInfoEx.ShowField) }); dgvTableFields.ShowData(this._fieldInfoBindingList.DataSource, "UCDBStructControl.dgvTableFields"); dgvIndex.ShowData(this._indexInfoBindingList.DataSource, "UCDBStructControl.dgvIndex"); this.checkMultTable_CheckedChanged(sender, e); } catch (Exception ex) { Loger.Error(ex); MessageBox.Show(ex.Message); } }
private void FTest_Load(object sender, EventArgs e) { if (this.DesignMode) { return; } var redirectAppenderToUI = (RedirectAppender)Loger.GetAppenderByName(null, "RedirectToUI"); if (redirectAppenderToUI != null) { redirectAppenderToUI.RedirectOuput += RedirectAppenderToUI_RedirectOuput;; } List <DatabaseConfig> itemList = DatabaseConfigManager.GetAllConfigItems(); DropdownBoxHelper.BindingIEnumerableGenericToComboBox <DatabaseConfig>(comboBoxDB, itemList, nameof(DatabaseConfig.ConName), itemList.Where(t => { return(t.DBID == _pssqlDbid); }).FirstOrDefault()); EFDbContext.OutputLog = true; EFEntityTypeManager.RegisterEntityType(3, typeof(DotnetWinFormApp.DB.Stu)); EFEntityTypeManager.RegisterEntityType(5, typeof(DotnetWinFormApp.DB.Stu)); }