public StartPageControlDescriptor([NotNull] Type type, [NotNull] StartPageControlAttribute attribute) { Assert.ArgumentNotNull(type, nameof(type)); Assert.ArgumentNotNull(attribute, nameof(attribute)); Type = type; Attribute = attribute; }
public static void LoadType([NotNull] Type type, [NotNull] StartPageControlAttribute attribute) { Assert.ArgumentNotNull(type, nameof(type)); Assert.ArgumentNotNull(attribute, nameof(attribute)); var descriptor = new StartPageControlDescriptor(type, attribute); controls.Add(descriptor); }
public StartPageTabDescriptor([NotNull] Type type, [NotNull] StartPageControlAttribute attribute, [NotNull] string parentName, [NotNull] string text) : base(type, attribute) { Assert.ArgumentNotNull(type, nameof(type)); Assert.ArgumentNotNull(attribute, nameof(attribute)); Assert.ArgumentNotNull(parentName, nameof(parentName)); Assert.ArgumentNotNull(text, nameof(text)); ParentName = parentName; Text = text; }
private static void ParseElement([NotNull] XElement element, [NotNull] string elementName) { Debug.ArgumentNotNull(element, nameof(element)); Debug.ArgumentNotNull(elementName, nameof(elementName)); var name = element.GetAttributeValue("name"); if (string.IsNullOrEmpty(name)) { return; } var text = element.GetAttributeValue("header"); if (string.IsNullOrEmpty(text)) { return; } var parentName = elementName + (string.IsNullOrEmpty(elementName) ? string.Empty : @".") + name; if (controls.All(c => c.Attribute.ParentName != parentName)) { var priority = element.GetAttributeDouble("priority", 1000); StartPageControlDescriptor descriptor = null; var attribute = new StartPageControlAttribute(elementName, priority); switch (element.Name.ToString()) { case "tab": descriptor = new StartPageTabDescriptor(typeof(ExternalStartPageTab), attribute, parentName, text); break; case "page": descriptor = new StartPageListDescriptor(typeof(ExternalStartPageTab), attribute, parentName, text); break; case "group": descriptor = new StartPageGroupDescriptor(typeof(ExternalStartPageGroup), attribute, parentName, text, element.GetAttributeValue("text")); break; } if (descriptor != null) { controls.Add(descriptor); } } ParseElements(element, parentName); }