Пример #1
0
        //public static bool HasSidebarActions(this MasonryHtmlHelper helper)
        //{
        //  return GetSidebarActions(helper).Any();
        //}

        public static IEnumerable <HeaderActionGroup> GetHeaderActionGroups(this MasonryHtmlHelper helper)
        {
            var cache = new Dictionary <string, HeaderActionGroup>();

            var actions = GetHeaderActions().Where(v => !string.IsNullOrWhiteSpace(v.GroupName));

            foreach (var verb in actions)
            {
                HeaderActionGroup group;
                if (!cache.TryGetValue(verb.GroupName, out group))
                {
                    group = new HeaderActionGroup {
                        Name = verb.GroupName
                    };
                    cache[verb.GroupName] = group;
                }

                group.AddVerb(verb);
            }

            return(cache.Values);
        }
Пример #2
0
        //public static IEnumerable<ISidebarActionVerb> GetSidebarActions(this MasonryHtmlHelper helper)
        //{
        //  return CompositionProvider.Current.GetExports<ISidebarActionVerb>();
        //}

        public static IEnumerable <ISidebarActionVerb> GetSidebarActions(this MasonryHtmlHelper helper, string category)
        {
            return(CompositionProvider.Current
                   .GetExports <ISidebarActionVerb>()
                   .Where(v => category.Equals(v.Category, StringComparison.OrdinalIgnoreCase)));
        }
Пример #3
0
 public static IEnumerable <IHeaderActionVerb> GetHeaderActions(this MasonryHtmlHelper helper)
 {
     return(GetHeaderActions().Where(v => string.IsNullOrWhiteSpace(v.GroupName)));
 }