Beispiel #1
0
        public static void BuildMenuTree(OdinMenuTree tree)
        {
            foreach (var allTrickOverViewInfo in AllTrickOverViewExamples)
            {
                TrickOverViewInfo trickOverViewInfo = (allTrickOverViewInfo.Value).GetTrickOverViewInfo();
                OdinMenuItem      menuItem          =
                    new OdinMenuItem(tree, trickOverViewInfo.Name, allTrickOverViewInfo.Key)
                {
                    Value        = allTrickOverViewInfo.Key,
                    SearchString = trickOverViewInfo.Name + trickOverViewInfo.Description
                };
                tree.AddMenuItemAtPath(trickOverViewInfo.Category, menuItem);
            }

            tree.MenuItems.Sort(AllTrickOverViewUtilities.CategorySorter);
            tree.MarkDirty();
        }
        public static void BuildMenuTree(OdinMenuTree tree)
        {
            foreach (var a in GetAllOdinAttributes())
            {
                // TODO: tags?
                string search = a.Name + " " + string.Join(" ", GetAttributeExampleInfos(a).Select(x => x.Name).ToArray());

                foreach (var c in GetAttributeCategories(a))
                {
                    var item = new OdinMenuItem(tree, a.GetNiceName().Replace("Attribute", "").SplitPascalCase(), a)
                    {
                        Value        = a,
                        SearchString = search,
                    };
                    search = null; // Only allow the user to find the first item of an attribute by search.

                    tree.AddMenuItemAtPath(c, item);
                }
            }

            tree.MenuItems.Sort(CategorySorter);
            tree.MarkDirty();
        }