コード例 #1
0
        public static void AssignSubMenu(List <Element> Links, RawMenu ParentMenu)
        {
            var commonparent = DomService.FindParent(Links);

            foreach (var item in Links)
            {
                var menu = new RawMenu();
                menu.Parent           = ParentMenu;
                menu.LinkElement      = item;
                menu.ContainerElement = FindLinkContainer(item, Links, commonparent);
                menu.Parent           = ParentMenu;
                ParentMenu.Children.Add(menu);
            }

            foreach (var item in ParentMenu.Children)
            {
                var sublinks = FindSubLinks(item);
                if (sublinks != null && sublinks.Count() > 0)
                {
                    var itemcontainer = DomService.FindParent(sublinks);
                    AssignSubMenu(sublinks, item);
                }
            }
            return;
        }
コード例 #2
0
        public static List <Element> FindSubLinks(RawMenu menu)
        {
            var Sublinks = GetDirectSubLinks(menu.LinkElement, menu.ContainerElement);

            if (Sublinks != null && Sublinks.Count() > 0)
            {
                return(Sublinks);
            }

            return(GetSiblingSubLinks(menu.ContainerElement, menu.NextContainer()));
        }
コード例 #3
0
        public static RawMenu FindRawMenu(Element element)
        {
            var alllinks = element.getElementsByTagName("a").item;

            if (alllinks != null && alllinks.Count() > 0)
            {
                var groupby = SimpleGroupBy(alllinks);

                RawMenu menu = new RawMenu();
                AssignSubMenu(groupby[0], menu);
                menu.SubItemContainer = element;
                return(menu);
            }
            return(null);
        }