private void PersistentTypeComboSelectionChanged(object sender, EventArgs e) { IconComboBox comboBox = (sender as IconComboBox); if (disableComboChangeNotification[comboBox]) { return; } bool isPersistentCombo = (sender as Control).Tag == "0"; if (!isPersistentCombo) { PersistentTypeItem selectedPersistentType = SelectedPersistentType; PersistentTypeItem selectedPropertyType = SelectedPropertyType; bool isItself = false; if (selectedPersistentType != null && selectedPropertyType != null) { isItself = selectedPersistentType.EqualsTo(selectedPropertyType); } chNavigationToItSelf.Checked = isItself; } UpdateControlNavigationToItSelf(); UpdatePreview(); GenerateAssociationName(); GeneratePropertyNames(); }
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 PopulatePersistentType(bool end1, PersistentTypeItem itemToSelect = null) { IconComboBox comboBox = GetPersistentTypeCombo(end1); comboBox.Items.Clear(); foreach (var entry in ownerForm.BuildPersistentTypesItems().Where(entry => ((PersistentTypeItem)entry.Value).Kind != EntityKind.Structure)) { 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 PersistentTypeItem GetSelectedPersistentType(bool end1) { IconComboBox comboBox = GetPersistentTypeCombo(end1); IconListEntry selectedItem = comboBox.SelectedItem as IconListEntry; return((selectedItem != null ? selectedItem.Value : null) as PersistentTypeItem); }
private void PopulateOnRemoveActions(bool end1) { IconComboBox onOwnerCombo = end1 ? cmbOnOwnerRemoveEnd1 : cmbOnOwnerRemoveEnd2; IconComboBox onTargetCombo = end1 ? cmbOnTargetRemoveEnd1 : cmbOnTargetRemoveEnd2; PopulateOnRemoveActionCombo(onOwnerCombo); PopulateOnRemoveActionCombo(onTargetCombo); }
private AssociationOnRemoveAction GetSelectedOnRemoveAction(bool end1, bool onOwner) { IconComboBox onOwnerCombo = end1 ? cmbOnOwnerRemoveEnd1 : cmbOnOwnerRemoveEnd2; IconComboBox onTargetCombo = end1 ? cmbOnTargetRemoveEnd1 : cmbOnTargetRemoveEnd2; IconComboBox combo = onOwner ? onOwnerCombo : onTargetCombo; return((AssociationOnRemoveAction)(combo.SelectedItem as IconListEntry).Value); }
private void OnPersistentTypeSelectionChanged(object sender, EventArgs e) { IconComboBox comboBox = sender as IconComboBox; if (disableComboChangeNotification[comboBox]) { return; } UpdatePreview(); GenerateAssociationName(); GeneratePropertyNames(); }
private void SelectPersistentType(IconComboBox comboBox, PersistentTypeItem itemToSelect) { int idx = 0; foreach (var entry in comboBox.Items.OfType <IconListEntry>()) { PersistentTypeItem item = entry.Value as PersistentTypeItem; if (item.EqualsTo(itemToSelect)) { comboBox.SelectedIndex = idx; break; } idx++; } }
private int FindPersistentTypeIndex(IconComboBox combo, PersistentTypeItem persistentTypeItem) { int idx = -1; foreach (var entry in combo.Items.OfType <IconListEntry>()) { idx++; PersistentTypeItem item = entry.Value as PersistentTypeItem; if (item.EqualsTo(persistentTypeItem)) { break; } } return(idx); }
private void PopulateOnRemoveActionCombo(IconComboBox comboBox) { comboBox.Items.Clear(); int idx = -1; int selIdx = 0; foreach (var value in EnumType <AssociationOnRemoveAction> .Values) { idx++; comboBox.Items.Add(new IconListEntry(value.ToString(), value, Resources.bullet)); if (value == AssociationOnRemoveAction.Default) { selIdx = idx; } } comboBox.SelectedIndex = selIdx; }