public bool FilterProperties(System.ComponentModel.IComponent component, System.Collections.IDictionary properties)
        {
            if (OldService != null)
            {
                OldService.FilterProperties(component, properties);
            }

            string[] PropertyNames = new string[properties.Keys.Count];
            properties.Keys.CopyTo(PropertyNames, 0);
            string        PN = string.Join(",", PropertyNames);
            List <string> AllowedPropertyNames = new List <string>(AllowedProperties["All"]);
            string        ComponentType        = component.GetType().Name;
            string        FullComponentType    = component.GetType().FullName;

            if (FullComponentType.Equals("System.Windows.Forms.Form"))
            {
                AllowedPropertyNames.Remove("Name");
            }
            if (AllowedProperties.ContainsKey(FullComponentType))
            {
                AllowedPropertyNames.AddRange(AllowedProperties[FullComponentType]);
            }
            foreach (string PropertyName in PropertyNames)
            {
                if (PropertyName.StartsWith("Name_") && !FullComponentType.Equals("System.Windows.Forms.Form"))
                {
                    continue;
                }
                if (!AllowedPropertyNames.Contains(PropertyName))
                {
                    properties.Remove(PropertyName);
                }
            }
            return(true);
        }
Exemple #2
0
        public BaseTemplateInformation(TemplateItem template, ICustomItemNamespaceProvider namespaceProvider)
        {
            ClassName = CodeUtil.GetClassNameForTemplate(template);

            PropertyName = ClassName.Remove(ClassName.Length - 4);
            if (PropertyName.StartsWith("_"))
            {
                PropertyName = PropertyName.Substring(1);
            }

            CustomItemSettings settings = new CustomItemSettings(HttpContext.Current);

            UsingNameSpace = namespaceProvider.GetNamespace(template, settings.BaseNamespace);
        }