예제 #1
0
        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();
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        private PersistentTypeItem GetSelectedPersistentType(bool end1)
        {
            IconComboBox  comboBox     = GetPersistentTypeCombo(end1);
            IconListEntry selectedItem = comboBox.SelectedItem as IconListEntry;

            return((selectedItem != null ? selectedItem.Value : null) as PersistentTypeItem);
        }
예제 #5
0
        private void PopulateOnRemoveActions(bool end1)
        {
            IconComboBox onOwnerCombo  = end1 ? cmbOnOwnerRemoveEnd1 : cmbOnOwnerRemoveEnd2;
            IconComboBox onTargetCombo = end1 ? cmbOnTargetRemoveEnd1 : cmbOnTargetRemoveEnd2;

            PopulateOnRemoveActionCombo(onOwnerCombo);
            PopulateOnRemoveActionCombo(onTargetCombo);
        }
예제 #6
0
        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);
        }
예제 #7
0
        private void OnPersistentTypeSelectionChanged(object sender, EventArgs e)
        {
            IconComboBox comboBox = sender as IconComboBox;

            if (disableComboChangeNotification[comboBox])
            {
                return;
            }

            UpdatePreview();
            GenerateAssociationName();
            GeneratePropertyNames();
        }
예제 #8
0
        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++;
            }
        }
예제 #9
0
        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);
        }
예제 #10
0
        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;
        }