Exemplo n.º 1
0
 public OrganizationsType()
 {
     organizationField = new ManifestNodeList<OrganizationType>(this);
 }
Exemplo n.º 2
0
 public ResourcesType()
 {
     resourceField = new ManifestNodeList<ResourceType>(this);
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public SequencingCollectionType()
 {
     this.sequencingCollection = new ManifestNodeList<SequencingType>(this);
 }
Exemplo n.º 5
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);
        }