예제 #1
0
            public StartPageControlDescriptor([NotNull] Type type, [NotNull] StartPageControlAttribute attribute)
            {
                Assert.ArgumentNotNull(type, nameof(type));
                Assert.ArgumentNotNull(attribute, nameof(attribute));

                Type      = type;
                Attribute = attribute;
            }
예제 #2
0
        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);
        }
예제 #3
0
            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;
            }
예제 #4
0
        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);
        }