Ejemplo n.º 1
0
 private void SerializeProperties(XmlWriter writer, object data)
 {
     foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(data))
     {
         CustomPropertyDescriptor pd = new CustomPropertyDescriptor(descriptor);
         if (pd.SerializationVisibility != Resco.Controls.DetailView.Design.DesignerSerializationVisibility.Hidden)
         {
             object obj2 = pd.GetValue(data);
             if ((obj2 != null) && pd.ShouldSerializeValue(data))
             {
                 if ((pd.SerializationVisibility == Resco.Controls.DetailView.Design.DesignerSerializationVisibility.Content) && (obj2 is IEnumerable))
                 {
                     this.SerializeCollection(writer, pd, obj2);
                 }
                 else
                 {
                     writer.WriteStartElement("Property");
                     writer.WriteAttributeString("Name", pd.Name);
                     writer.WriteAttributeString("Value", this.Serialize(obj2));
                     writer.WriteEndElement();
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void SerializeDetailViewProperties(XmlWriter writer, Control detailView)
 {
     foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(detailView))
     {
         CustomPropertyDescriptor descriptor2 = new CustomPropertyDescriptor(descriptor);
         if (descriptor2.Attributes.Contains(Resco.Controls.DetailView.Design.BrowsableAttribute.Yes) && descriptor2.Attributes.Contains(Resco.Controls.DetailView.Design.DesignerSerializationVisibilityAttribute.Visible))
         {
             object obj2 = descriptor2.GetValue(detailView);
             if ((obj2 != null) && descriptor2.ShouldSerializeValue(detailView))
             {
                 writer.WriteStartElement("Property");
                 writer.WriteAttributeString("Name", descriptor2.Name);
                 writer.WriteAttributeString("Value", this.Serialize(obj2));
                 writer.WriteEndElement();
             }
         }
     }
 }