Esempio n. 1
0
        List <BaseBindingPanelFactory> GetAvailableBindingPanels()
        {
            PropertyWrapper property = null;
            List <BaseBindingPanelFactory> result = new List <BaseBindingPanelFactory>();

            if (propertyList.SelectedIndex >= 0)
            {
                property = propertyList.Items[propertyList.SelectedIndex] as PropertyWrapper;
            }

            if (property == null)
            {
                return(result);
            }

            Assembly archiverAssembly = this.GetType().Assembly;

            foreach (Type type in archiverAssembly.GetTypes())
            {
                if (type.IsSubclassOf(typeof(BaseBindingPanelFactory)))
                {
                    BaseBindingPanelFactory factory = (BaseBindingPanelFactory)Activator.CreateInstance(type);
                    if (factory != null && factory.CheckApplicability(element, property))
                    {
                        result.Add(factory);
                    }
                }
            }

            return(result);
        }
Esempio n. 2
0
        private void CreateAssociationButton_Click(object sender, EventArgs e)
        {
            SavePanelStateAndClose();

            if (propertyList.SelectedIndex >= 0 && bindingTypes.SelectedIndex >= 0)
            {
                BaseBindingPanelFactory factory = (BaseBindingPanelFactory)bindingTypes.SelectedItem;
                bindingPanel = factory.CreateInstance();
                bindingPanel.Initialize(element, propertyList.SelectedItem as PropertyWrapper, null);
                bindingPanel.Parent             = panel1;
                bindingPanel.Dock               = DockStyle.Fill;
                CreateAssociationButton.Enabled = false;
                bindingTypes.Enabled            = false;
            }
        }