Exemplo n.º 1
0
        public MenuItemBuilder Add(LocalizedString caption, Action<MenuItemBuilder> builderAction)
        {
            _addActions.Add(item =>
            {
                var menuItem = new MenuItemDefinition { Id = caption.Name };
                var itemBuilder = new MenuItemBuilder(menuItem);
                itemBuilder.Caption(caption);
                builderAction(itemBuilder);
                item.Items.Add(menuItem);
            });

            return this;
        }
Exemplo n.º 2
0
        public MenuItemBuilder Alter(string id, Action<MenuItemBuilder> builderAction)
        {
            _alterActions.Add(item =>
            {
                var menuItem = item.Items.FirstOrDefault(t => t.Id.Equals(id, StringComparison.OrdinalIgnoreCase));
                if (menuItem != null)
                {
                    var itemBuilder = new MenuItemBuilder(menuItem);
                    builderAction(itemBuilder);
                }
            });

            return this;
        }