// 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); } }
// 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; AssemblyName = (f.Attribute("assemblyName") != null) ? PlatformUtils.AdjustPlatformName(f.Attribute("assemblyName").Value, false) : (f.Attribute("type") != null ? f.Attribute("type").Value.Split('.')[0] + ".4.dll" : 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; Event = (f.Element("Event") != null ? f.Element("Event").Value : ""); Link = new Uri(("/" + control.Name + "/" + Name).Trim().Replace("?", "").Replace("'", "").Replace("(", "").Replace(")", ""), UriKind.Relative); 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); } }
public FeatureDescription(string p1, string p2, string p3, string p4, string p5, string ITEM_CONTENT, ControlDescription group1) { Name = p1; Description = p3; }