Esempio n. 1
0
        private List <EditorComponent> GetComponents(DataControl element)
        {
            if (!cachedComponents.ContainsKey(element))
            {
                // Component gathering
                var components = new List <EditorComponent>();
                // Basic
                if (Components.ContainsKey(element.GetType()))
                {
                    components.AddRange(Components[element.GetType()]);
                }

                // Interface
                var typeInterfaceComponents = element.GetType()
                                              .GetInterfaces()
                                              .Where(i => Components.ContainsKey(i))
                                              .SelectMany(i => Components[i]);

                components.AddRange(typeInterfaceComponents);

                // Sorting the components by order
                if (components.Count > 0)
                {
                    components.Sort((c1, c2) => c1.Attribute.Order.CompareTo(c2.Attribute.Order));
                    cachedComponents.Add(element, components);
                }
            }

            return(cachedComponents[element]);
        }
Esempio n. 2
0
        private void SetDisabledFor(DataControl element)
        {
            if (element == null)
            {
                return;
            }

            if (!TypeEnabling.ContainsKey(element.GetType()))
            {
                TypeEnabling[element.GetType()] = true;
            }
            Disabled = !TypeEnabling[element.GetType()];
        }