//Only called after compilling done, only one call, for performance
        private static void RefreshAllVisualComponent()
        {
            //DIAttributeData.Instance.components = typeof(DIVisualComponent).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(DIVisualComponent))).ToList();
            DIAttributeData.Instance.components = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
                                                   from type in assembly.GetTypes()
                                                   where type.IsSubclassOf(typeof(DIVisualComponent))
                                                   select(System.Type) type).ToList();
            DIAttributeData.Instance.componentPathPopup.Clear();
            DIAttributeData.Instance.componentPathPopup.Add("Component");
            foreach (Type comp in DIAttributeData.Instance.components)
            {
                VisualComponentAttribute att = (VisualComponentAttribute)Attribute.GetCustomAttribute(comp, typeof(VisualComponentAttribute));
                if (att != null)
                {
                    DIAttributeData.Instance.componentPathPopup.Add(att.path + "/" + AddSpacesToSentence(comp.Name, true));
                    DIAttributeData.Instance.componentsWithAttribute.Add(comp);
                }
            }

            var propertyDrawerCandidate = (from assembly in AppDomain.CurrentDomain.GetAssemblies()
                                           from type in assembly.GetTypes()
                                           where type.IsSubclassOf(typeof(VSPropertyDrawer))
                                           select(System.Type) type).ToArray();

            DIAttributeData.Instance.propertyDrawers.Clear();
            foreach (Type drawer in propertyDrawerCandidate)
            {
                VSCustomPropertyDrawerAttribute att = (VSCustomPropertyDrawerAttribute)Attribute.GetCustomAttribute(drawer, typeof(VSCustomPropertyDrawerAttribute));
                if (att != null)
                {
                    DIAttributeData.Instance.propertyDrawers.Add(new DIAttributeData.VSCustomPropertyDrawerAttributeData(att, drawer));
                }
            }
        }
Example #2
0
 public VSCustomPropertyDrawerAttributeData(VSCustomPropertyDrawerAttribute att, Type type)
 {
     this.att  = att;
     this.type = type;
     instance  = Activator.CreateInstance(type) as VSPropertyDrawer;
 }