Beispiel #1
0
        public ControlDescription(XElement c)
        {
            bool b = false;

            IsNew        = (c.Attribute("isNew") != null && bool.TryParse(c.Attribute("isNew").Value, out b) ? b : false);
            IsTop        = (c.Attribute("isTop") != null && bool.TryParse(c.Attribute("isTop").Value, out b) ? b : false);
            IsEnabled    = (c.Attribute("enabled") != null && bool.TryParse(c.Attribute("enabled").Value, out b) ? b : true);
            AssemblyName = c.Attribute("assembly") != null?PlatformUtils.AdjustPlatformName(c.Attribute("assembly").Value, false) : string.Empty;

            Name        = c.Attribute("name").Value;
            IconName    = c.Attribute("iconName").Value;
            Source      = (c.Attribute("source") != null) ? c.Attribute("source").Value : string.Empty;
            Description = (c.Element("Description") != null) ? c.Element("Description").Value : string.Empty;
            Features    = (from f in c.Elements("Feature") select new FeatureDescription(this, f)).ToList();
        }
 // constructor
 public FeatureDescription(ControlDescription control, XElement f)
 {
     Control             = control;
     Description         = (f.Element("Description") != null) ? f.Element("Description").Value : string.Empty;
     Name                = (f.Attribute("name") != null) ? f.Attribute("name").Value : string.Empty;
     IconName            = (f.Attribute("iconName") != null) ? f.Attribute("iconName").Value : string.Empty;
     AssemblyName        = (f.Attribute("assemblyName") != null) ? PlatformUtils.AdjustPlatformName(f.Attribute("assemblyName").Value, false) : string.Empty;
     PackageUri          = (f.Attribute("packageUri") != null) ? new Uri(PlatformUtils.AdjustPlatformName(f.Attribute("packageUri").Value, true), UriKind.RelativeOrAbsolute) : null;
     DemoControlTypeName = (f.Attribute("type") != null) ? f.Attribute("type").Value : string.Empty;
     Source              = (f.Attribute("source") != null) ? f.Attribute("source").Value : string.Empty;
     Event               = (f.Element("Event") != null ? f.Element("Event").Value : "");
     Link                = new Uri((control.Name + "/" + Name).Trim().Replace("?", "").Replace("'", "").Replace("(", "").Replace(")", ""), UriKind.Relative);
     SupportThemes       = (f.Attribute("supportThemes") != null ? bool.Parse(f.Attribute("supportThemes").Value) : true);
     IsExpanded          = (f.Attribute("isExpanded") != null) ? bool.Parse(f.Attribute("isExpanded").Value) : false;
     IsNew               = (f.Attribute("isNew") != null) ? bool.Parse(f.Attribute("isNew").Value) : false;
     if (f.Element("SubFeatures") != null)
     {
         SubFeatures = (from sf in f.Element("SubFeatures").Elements("SubFeature") select new FeatureDescription(control, sf)).ToList();
         foreach (FeatureDescription sub in SubFeatures)
         {
             sub.OwnerFeature = this;
         }
     }
     else
     {
         SubFeatures = new List <FeatureDescription>();
     }
     if (f.Element("Properties") != null)
     {
         var properties = from pair in f.Element("Properties").Elements("Property")
                          select new PropertyAttribute
         {
             MemberName   = pair.Attribute("name").Value,
             DisplayName  = (pair.Attribute("caption") != null ? pair.Attribute("caption").Value : pair.Attribute("name").Value),
             DefaultValue = (pair.Attribute("value") != null ? pair.Attribute("value").Value : null),
             Browsable    = (pair.Attribute("display") != null ? bool.Parse(pair.Attribute("display").Value) : true),
             MinimumValue = (pair.Attribute("minimumValue") != null ? double.Parse(pair.Attribute("minimumValue").Value, CultureInfo.InvariantCulture) : double.NaN),
             MaximumValue = (pair.Attribute("maximumValue") != null ? double.Parse(pair.Attribute("maximumValue").Value, CultureInfo.InvariantCulture) : double.NaN),
             Tag          = (pair.Attribute("nullable") != null ? bool.Parse(pair.Attribute("nullable").Value) : false),
         };
         Properties = new List <PropertyAttribute>(properties);
     }
 }