Пример #1
0
        public IMenuItemBuilder AddItem(string path, string localizedName)
        {
            var currentDefinition = RootItemDefinition;

            foreach (var pathComponent in ParsePath(path))
            {
                var subItem = currentDefinition.SubItems.FirstOrDefault(d => d.Name == pathComponent);
                if (subItem == null)
                {
                    subItem = new MenuItemDefinition(pathComponent);
                    currentDefinition.SubItems.Add(subItem);
                }
                currentDefinition = subItem;
            }

            currentDefinition.LocalizedName = localizedName;

            return(currentDefinition);
        }