Beispiel #1
0
        /// <summary>
        /// Get root item for sidebar.
        /// </summary>
        /// <returns>Root sidebar items.</returns>
        public SidebarItem GetRootSidebarItem()
        {
            this.ThrowIfDisposed();
            if (this.rootItem != null)
            {
                return(this.rootItem);
            }

            var item = new SidebarItem();

            this.PopulateRootItem(item);
            this.rootItem = item;
            return(item);
        }
Beispiel #2
0
        /// <summary>
        /// Find item with given id within
        /// </summary>
        /// <param name="id">Id of the item too look for.</param>
        /// <param name="parent">Parent item where to look item with given id.</param>
        /// <returns>Sidebar item with requested id if exists, null otherwise.</returns>
        private static SidebarItem FindById(string id, SidebarItem parent)
        {
            foreach (var item in parent.Items)
            {
                if (item.Id == id)
                {
                    return(item);
                }

                var insideNested = FindById(id, item);
                if (insideNested != null)
                {
                    return(insideNested);
                }
            }

            return(null);
        }
Beispiel #3
0
 /// <summary>
 /// Populates the root item.
 /// </summary>
 /// <param name="item">Root item to populate with child items.</param>
 protected virtual void PopulateRootItem(SidebarItem item)
 {
 }