Exemplo n.º 1
0
        protected void DeserializePropertyView(XmlNode xmlPropertyView, ClassView classView)
        {
            PropertyView propertyView = new PropertyView(classView);

            if (!(xmlPropertyView.Attributes["name"] == null))
                propertyView.Name = xmlPropertyView.Attributes["name"].Value;
            else
                throw new FormatException("The property element must contain a name attribute!");

            if (!(xmlPropertyView.Attributes["path"] == null))
                propertyView.Name = xmlPropertyView.Attributes["path"].Value;

            if (!(xmlPropertyView.Attributes["category"] == null))
                propertyView.Category = xmlPropertyView.Attributes["category"].Value;

            if (!(xmlPropertyView.Attributes["description"] == null))
                propertyView.Description = xmlPropertyView.Attributes["description"].Value;

            if (!(xmlPropertyView.Attributes["display-name"] == null))
                propertyView.DisplayName = xmlPropertyView.Attributes["display-name"].Value;

            if (!(xmlPropertyView.Attributes["read-only"] == null))
                propertyView.IsReadOnly  = ParseBool(xmlPropertyView.Attributes["display-name"].Value);

            if (!(xmlPropertyView.Attributes["default"] == null))
                propertyView.DefaultValue  = xmlPropertyView.Attributes["default"].Value;
        }
Exemplo n.º 2
0
        protected void DeserializePropertyView(XmlNode xmlPropertyView, ClassView classView)
        {
            PropertyView propertyView = new PropertyView(classView);

            if (!(xmlPropertyView.Attributes["name"] == null))
            {
                propertyView.Name = xmlPropertyView.Attributes["name"].Value;
            }
            else
            {
                throw new FormatException("The property element must contain a name attribute!");
            }

            if (!(xmlPropertyView.Attributes["path"] == null))
            {
                propertyView.Name = xmlPropertyView.Attributes["path"].Value;
            }

            if (!(xmlPropertyView.Attributes["category"] == null))
            {
                propertyView.Category = xmlPropertyView.Attributes["category"].Value;
            }

            if (!(xmlPropertyView.Attributes["description"] == null))
            {
                propertyView.Description = xmlPropertyView.Attributes["description"].Value;
            }

            if (!(xmlPropertyView.Attributes["display-name"] == null))
            {
                propertyView.DisplayName = xmlPropertyView.Attributes["display-name"].Value;
            }

            if (!(xmlPropertyView.Attributes["read-only"] == null))
            {
                propertyView.IsReadOnly = ParseBool(xmlPropertyView.Attributes["display-name"].Value);
            }

            if (!(xmlPropertyView.Attributes["default"] == null))
            {
                propertyView.DefaultValue = xmlPropertyView.Attributes["default"].Value;
            }
        }
        public WrappedProperty(MemberDescriptor descr, PropertyView propertyView, Attribute[] attrs)
            : base(descr, attrs)
        {
            this.realPropertyDescriptor = (PropertyDescriptor) descr;
            this.name = propertyView.Name;
            this.displayName = propertyView.DisplayName;

            Attribute[] attribs = new Attribute[descr.Attributes.Count + 4];

            int i = 0;
            foreach (Attribute attrib in descr.Attributes)
            {
                attribs[i] = attrib;
                i++;
            }
            attribs[i] = new DescriptionAttribute(propertyView.Description);
            attribs[i + 1] = new CategoryAttribute(propertyView.Category);
            attribs[i + 2] = new DescriptionAttribute(propertyView.Description);
            attribs[i + 3] = new ReadOnlyAttribute(propertyView.IsReadOnly);

            attributes = new AttributeCollection(attribs);
        }