Example #1
0
 public CustomProperties(XmlNode propertiesNode)
 {
     foreach (XmlNode child in propertiesNode.ChildNodes)
     {
         CustomProperty newProp = new CustomProperty(child);
         _properties.Add(newProp.Name, newProp);
     }
 }
 public override void SetValue(object component, object value)
 {
     string stringValue;
     if (value.GetType() == typeof(bool))
     {
         stringValue = ((bool)value) ? "1" : "0";
     }
     else
     {
         stringValue = value.ToString();
     }
     if (stringValue == _schemaItem.DefaultValue)
     {
         if (_properties.PropertyValues.ContainsKey(_schemaItem.Name))
         {
             _properties.PropertyValues.Remove(_schemaItem.Name);
         }
     }
     else
     {
         if (_properties.PropertyValues.ContainsKey(_schemaItem.Name))
         {
             _properties.PropertyValues[_schemaItem.Name].Value = stringValue;
         }
         else
         {
             CustomProperty newProperty = new CustomProperty();
             newProperty.Name = _schemaItem.Name;
             newProperty.Value = stringValue;
             _properties.PropertyValues.Add(newProperty.Name, newProperty);
         }
     }
 }