public BuildingFeatureNoresident(ObjSale obj) { InitializeComponent(); objectBindingSource.DataSource = obj; _materialComboBox.DataSource = new MaterialValues(); _floursComboBox.DataSource = new FloursValues(); }
public void LoadObject(ObjSale obj) { _obj = obj; Utils.VisitChildren(this, delegate(Control ctl) { if(ctl.Tag == null) return; object value = typeof(ObjSale).GetProperty(ctl.Tag.ToString()).GetValue(obj, null); if(ctl is ComboBox) { ComboBox comboBox = (ComboBox) ctl; comboBox.DataSource = Application.GetEnumValues((Enums)Enum.Parse(typeof(Enums), ctl.Tag.ToString())); comboBox.SelectedValue = value; } else if(ctl is CheckBox) { CheckBox checkBox = (CheckBox)ctl; checkBox.CheckState = Application.EnumFindKey<CheckState>(Enums.YesNoUnknow, value); } }); }