private void PopulatePersistentType(IconComboBox comboBox, /*PersistentTypeItem exceptItem, */ PersistentTypeItem itemToSelect = null) { comboBox.Items.Clear(); foreach (var entry in ownerForm.BuildPersistentTypesItems()) { comboBox.Items.Add(entry); } disableComboChangeNotification[comboBox] = true; try { if (itemToSelect != null) { SelectPersistentType(comboBox, itemToSelect); } if (comboBox.SelectedIndex == -1) { comboBox.SelectedIndex = 0; } } finally { disableComboChangeNotification[comboBox] = false; } }
private void PopulateForm(PersistentTypeItem persistentTypeToSelect) { disablePreviewUpdate = true; try { persistentTypesEntries = ownerForm.BuildPersistentTypesItems().Where( entry => ((PersistentTypeItem)entry.Value).Kind != EntityKind.Structure); isValidToShow = persistentTypesEntries.Count() >= 2; if (!isValidToShow) { showValidationError = "There must be at least 2 persistent types (exclude structures) to make advanced association."; return; } disableComboChangeNotification.Add(cmbPersistentTypesEnd1, false); disableComboChangeNotification.Add(cmbPersistentTypesEnd2, false); PersistentTypeItem selectedPersistentType = GetSelectedPersistentType(true); PersistentTypeItem selectedPropertyType = GetSelectedPersistentType(false); PopulatePersistentType(true, selectedPersistentType); PopulatePersistentType(false, selectedPropertyType); GetPersistentTypeCombo(false).SelectedIndex = 1; PopulateMultiplicity(true); PopulateMultiplicity(false); GetUseAssociationAttributeCheckbox(true).Checked = true; GetUseAssociationAttributeCheckbox(false).Checked = true; if (persistentTypeToSelect != null) { SelectPersistentType(GetPersistentTypeCombo(true), persistentTypeToSelect); } GenerateAssociationName(); GeneratePropertyNames(); } finally { disablePreviewUpdate = false; } UpdatePreview(); }