private void setPropsList() { comboBox_Prop.Items.Clear(); comboBox_constDef.Items.Clear(); comboBox_PropDef.Items.Clear(); if (manager != null && manager.form_main != null && manager.form_main.propertyTypesManager != null) { for (int i = 0; i < manager.form_main.propertyTypesManager.getElementCount(); i++) { comboBox_Prop.Items.Add(((ObjectElement)manager.form_main.propertyTypesManager.getElement(i)).name); } for (int i = 0; i < manager.form_main.iDsManager.getElementCount(); i++) { comboBox_constDef.Items.Add(((ObjectElement)manager.form_main.iDsManager.getElement(i)).name); } if (element.ValueType == Consts.PARAM_PROP) { noEvent = true; comboBox_Prop.SelectedIndex = element.getPropertyTypeElementUsedID(); noEvent = false; } if (element != null && element.defaultValue != null) { //默认值 if (element.ValueType == Consts.PARAM_INT) { numericUpDown_def.Value = (int)element.defaultValue; } else if (element.ValueType == Consts.PARAM_STR) { textBox_def.Text = (String)element.defaultValue; } else if (element.ValueType == Consts.PARAM_PROP && element.propertyTypeElementUsed != null) { PropertyTypeElement propertyTypeElement = element.propertyTypeElementUsed; for (int i = 0; i < propertyTypeElement.instancesManager.getElementCount(); i++) { comboBox_PropDef.Items.Add(((ObjectElement)propertyTypeElement.instancesManager.getElement(i)).name); } comboBox_PropDef.SelectedIndex = MathUtil.limitNumber((int)element.defaultValue, -1, element.propertyTypeElementUsed.instancesManager.getElementCount() - 1); } else if (element.ValueType == Consts.PARAM_INT_ID) { comboBox_constDef.SelectedIndex = MathUtil.limitNumber((int)element.defaultValue, -1, manager.form_main.iDsManager.getElementCount() - 1); } } } }
private void comboBox_Prop_SelectedIndexChanged(object sender, EventArgs e) { if (noEvent) { return; } comboBox_PropDef.Items.Clear(); if (manager != null && manager.form_main != null && manager.form_main.propertyTypesManager != null) { int index = comboBox_Prop.SelectedIndex; if (index >= 0) { PropertyTypeElement propertyTypeElement = (PropertyTypeElement)manager.form_main.propertyTypesManager.getElement(index); for (int i = 0; i < propertyTypeElement.instancesManager.getElementCount(); i++) { comboBox_PropDef.Items.Add(((ObjectElement)propertyTypeElement.instancesManager.getElement(i)).name); } } } }