Esempio n. 1
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            ManifestNodeList <ResourceType> resourceList = Course.Manifest.resources.Resources;
            var resourceListString = new string[resourceList.Count + 1];

            resourceListString[0] = string.Empty;

            for (int i = 1; i < resourceListString.Length; i++)
            {
                resourceListString[i] = resourceList[i - 1].ToString();
            }

            return(new StandardValuesCollection(resourceListString));
        }
Esempio n. 2
0
        /// <summary>
        /// Adds all subItems of current item to parent of current item. Removes current item.
        /// </summary>
        public void RemoveAndMerge()
        {
            if (this.Parent is IItemContainer == false)
            {
                throw new InvalidOperationException("Parent of '" + this.Title + "' should be a container of items!");
            }

            IItemContainer parent   = this.Parent as IItemContainer;
            int            position = parent.SubItems.IndexOf(this);

            //1. Add all children to Parent
            parent.SubItems.InsertRange(position, this.SubItems);

            //2. Clean subItems but do not remove!
            this.SubItems = new ManifestNodeList <ItemType>();

            //3. Remove item.
            parent.RemoveChild(this);
        }
Esempio n. 3
0
        /// <summary>
        /// Inserts grouping item, which is child of current item and contains sub items of current item.
        /// A parent of child nodes should be changed to new grouping Item.
        /// </summary>
        /// <param name="groupingItem"><see cref="ItemType"/> item, which would act as grouping item.</param>
        public void InsertGroupingItem([NotNull] ItemType groupingItem)
        {
            if (groupingItem == null)
            {
                throw new ArgumentNullException("Grouping Item can't be null!");
            }

            if (groupingItem.PageType != PageType.Chapter && groupingItem.PageType != PageType.ControlChapter)
            {
                throw new ArgumentException("Grouping Item should be a Chapter or Control Chapter!");
            }

            //1. Add all children to grouping item.
            foreach (ItemType item in this.SubItems)
            {
                groupingItem.SubItems.Add(item);
            }

            //2. Clear list of children, but not use Removing tool!!!
            this.SubItems = new ManifestNodeList <ItemType>(this);

            //3. Add grouping item to list of children.
            this.SubItems.Add(groupingItem);
        }
Esempio n. 4
0
 public OrganizationsType()
 {
     organizationField = new ManifestNodeList <OrganizationType>(this);
 }