Exemplo n.º 1
0
        public NavigationItemBuilder(MenuItem existingItem)
        {
            if (existingItem == null)
            {
                throw new ArgumentNullException(nameof(existingItem));
            }

            _item = existingItem;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Builds a menu item shape.
        /// </summary>
        /// <param name="shapeFactory">The shape factory.</param>
        /// <param name="parentShape">The parent shape.</param>
        /// <param name="menu">The menu shape.</param>
        /// <param name="menuItem">The menu item to build the shape for.</param>
        /// <returns>The menu item shape.</returns>
        public static dynamic BuildMenuItemShape(dynamic shapeFactory, dynamic parentShape, dynamic menu, MenuItem menuItem)
        {
            var menuItemShape = shapeFactory.MenuItem()
                .Text(menuItem.Text)
                .Id(menuItem.Id)
                .Href(menuItem.Href)
                .LinkToFirstChild(menuItem.LinkToFirstChild)
                .Selected(parentShape.Selected != null && ((bool)parentShape.Selected || IsSelected(menuItem, null)))
                .RouteValues(menuItem.RouteValues)
                .Item(menuItem)
                .Menu(menu)
                .Parent(parentShape)
                .Level(parentShape.Selected == null ? 1 : (int)parentShape.Level + 1)
                .Local(menuItem.Local);

            foreach (var className in menuItem.Classes)
                menuItemShape.Classes.Add(className);

            return menuItemShape;
        }
Exemplo n.º 3
0
 public NavigationItemBuilder()
 {
     _item = new MenuItem();
 }
Exemplo n.º 4
0
 public NavigationBuilder Remove(MenuItem item)
 {
     Contained.Remove(item);
     return this;
 }
Exemplo n.º 5
0
 public static bool IsSelected(MenuItem menuItem, HttpContext httpContext)
 {
     return false;
 }