當前位置: 首頁>>代碼示例>>C#>>正文


C# NavigationBuilder.Add方法代碼示例

本文整理匯總了C#中Orchard.UI.Navigation.NavigationBuilder.Add方法的典型用法代碼示例。如果您正苦於以下問題:C# NavigationBuilder.Add方法的具體用法?C# NavigationBuilder.Add怎麽用?C# NavigationBuilder.Add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Orchard.UI.Navigation.NavigationBuilder的用法示例。


在下文中一共展示了NavigationBuilder.Add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetMenu

        public void GetMenu(IContent menu, NavigationBuilder builder) {
            var menuParts = _contentManager
                .Query<MenuPart, MenuPartRecord>()
                .Where(x => x.MenuId == menu.Id)
                .WithQueryHints(new QueryHints().ExpandRecords<MenuItemPartRecord>())
                .List();

            foreach (var menuPart in menuParts) {
                if (menuPart != null) {
                    var part = menuPart;

                    string culture = null;
                    // fetch the culture of the content menu item, if any
                    var localized = part.As<ILocalizableAspect>();
                    if (localized != null) {
                        culture = localized.Culture;
                    }
                    else {
                        // fetch the culture of the content menu item, if any
                        var contentMenuItemPart = part.As<ContentMenuItemPart>();
                        if (contentMenuItemPart != null) {
                            localized = contentMenuItemPart.Content.As<ILocalizableAspect>();
                            if (localized != null) {
                                culture = localized.Culture;
                            }
                        }
                    }

                    if (part.Is<MenuItemPart>())
                        builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Url(part.As<MenuItemPart>().Url).Content(part).Culture(culture));
                    else
                        builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues).Content(part).Culture(culture));
                }
            }
        }
開發者ID:richinoz,項目名稱:Orchard1.6,代碼行數:35,代碼來源:DefaultMenuProvider.cs

示例2: GetMenu

 public void GetMenu(Orchard.ContentManagement.IContent menu, NavigationBuilder builder)
 {
     builder.Add(T("Lifestyle"), "2", item => item.Action("Index", "Lifestyle", new { area = "Pharmalto.Ecosystem" }));
     builder.Add(T("Supplements"), "2", item => item.Action("Index", "Supplements", new { area = "Pharmalto.Ecosystem" }));
     //builder.Add(T("My Groups"), "2", item => item.Action("Index", "Groups", new { area = "Pharmalto.Ecosystem" }));
     //builder.Add(T("My Albums"), "2", item => item.Action("Index", "Album", new { area = "Pharmalto.Ecosystem" }));
     //builder.Add(T("My Gallery"), "2", item => item.Action("Index", "Gallery", new { area = "Pharmalto.Ecosystem" }));
     //builder.Add(T("My Health Plan"), "2", item => item.Action("Index", "HealthPlan", new { area = "Pharmalto.Ecosystem" }));
     //builder.Add(T("My Health Tracker"), "2", item => item.Action("Index", "Fitness", new { area = "Pharmalto.Ecosystem" }));
 }
開發者ID:CloudMetal,項目名稱:Ecosystem-Deployment,代碼行數:10,代碼來源:EcosystemMenuProvider.cs

示例3: GetNavigation

        public void GetNavigation(NavigationBuilder builder) {
            var menuParts = _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).WithQueryHints(new QueryHints().ExpandRecords<MenuItemPartRecord>()).List();
            foreach (var menuPart in menuParts) {
                if (menuPart != null) {
                    var part = menuPart;

                    if (part.Is<MenuItemPart>())
                        builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Url(part.As<MenuItemPart>().Url));
                    else
                        builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues));
                }
            }
        }
開發者ID:Vinna,項目名稱:DeepInSummer,代碼行數:13,代碼來源:MainMenuNavigationProvider.cs

示例4: GetNavigation

        public void GetNavigation(NavigationBuilder builder) {
            builder
                .Add(T("Media"), "6", menu => menu
                    .Add(T("Microsoft Azure Media Jobs"), "10.0", item => item.Action("Index", "Job", new { area = "Orchard.Azure.MediaServices" })
                        .Permission(Permissions.ManageCloudMediaJobs)));

            builder
                .Add(T("Settings"), menu => menu
                    .Add(T("Microsoft Azure Media"), "10.0", item => item.Action("Index", "Settings", new { area = "Orchard.Azure.MediaServices" })
                        .Permission(StandardPermissions.SiteOwner)
                        .Permission(Permissions.ManageCloudMediaSettings)
                ));
        }
開發者ID:SunRobin2015,項目名稱:RobinWithOrchard,代碼行數:13,代碼來源:AdminMenu.cs

示例5: GetNavigation

 public void GetNavigation(NavigationBuilder builder)
 {
     builder.Add("Users", "5",
                 menu => menu
                             .Add("Manage Users", "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.Users" }).Permission(Permissions.ManageUsers))
                             .Add("Add New User", "1.1", item => item.Action("Create", "Admin", new { area = "Orchard.Users" }).Permission(Permissions.ManageUsers)));
 }
開發者ID:mofashi2011,項目名稱:orchardcms,代碼行數:7,代碼來源:AdminMenu.cs

示例6: GetNavigation

 public void GetNavigation(NavigationBuilder builder) {
     builder
         .Add(T("Settings"), menu => menu
             .Add(T("Transliteration"), "10.0", subMenu => subMenu.Action("Index", "TransliterationAdmin", new { area = "Orchard.Localization" })
                 .Add(T("Settings"), "10.0", item => item.Action("Index", "TransliterationAdmin", new { area = "Orchard.Localization" }).LocalNav())
             ));
 }
開發者ID:RasterImage,項目名稱:Orchard,代碼行數:7,代碼來源:AdminMenu.cs

示例7: GetNavigation

 public void GetNavigation(NavigationBuilder builder) {
     builder.Add(T("Workflows"), "10",
         menu => menu
             .Add(T("Workflows"), "1.0",
                 qi => qi.Action("Index", "Admin", new { area = "Orchard.Workflows" }).Permission(StandardPermissions.SiteOwner).LocalNav())
     );
 }
開發者ID:bigfont,項目名稱:CertifiedOverheadCrane,代碼行數:7,代碼來源:AdminMenu.cs

示例8: GetNavigation

 public void GetNavigation(NavigationBuilder builder)
 {
     builder
         .Add(T("Modules"), menu => menu
             .Add(T("Module Profiles"), "4", item => item.Action("Index", "ModuleProfilesAdmin", new { Area = "OrchardHUN.ModuleProfiles" }).LocalNav())
     );
 }
開發者ID:Lombiq,項目名稱:Orchard-Module-Profiles,代碼行數:7,代碼來源:AdminMenu.cs

示例9: GetNavigation

 public void GetNavigation(NavigationBuilder builder) {
     builder
         .Add(T("Settings"), menu => menu
             .Add(T("Open Authentication"), "10.0", subMenu => subMenu.Action("Index", "Admin", new { area = Constants.LocalArea }).Permission(StandardPermissions.SiteOwner)
                 .Add(T("Settings"), "10.0", item => item.Action("Index", "Admin", new { area = Constants.LocalArea }).Permission(StandardPermissions.SiteOwner).LocalNav())
             ));
 }
開發者ID:li0803,項目名稱:NGM.OpenAuthentication,代碼行數:7,代碼來源:AdminMenu.cs

示例10: GetNavigation

 public void GetNavigation(NavigationBuilder builder) {
     builder.Add(T("Rules"), "4",
         menu => menu
             .Add(T("Manage Rules"), "1.0",
                 item => item.Action("Index", "Admin", new { area = "Orchard.Rules" }).Permission(StandardPermissions.SiteOwner))
     );
 }
開發者ID:SunRobin2015,項目名稱:RobinWithOrchard,代碼行數:7,代碼來源:AdminMenu.cs

示例11: GetNavigation

 public void GetNavigation(NavigationBuilder builder)
 {
     builder.Add(T("Content"),
                 menu => menu
                             .Add(T("Content Types"), "3", item => item.Action("Index", "Admin", new {area = "Orchard.ContentTypes"}).LocalNav())
                             .Add(T("Content Parts"), "4", item => item.Action("ListParts", "Admin", new {area = "Orchard.ContentTypes"}).LocalNav()));
 }
開發者ID:CAAFA,項目名稱:caafa_internet,代碼行數:7,代碼來源:AdminMenu.cs

示例12: GetNavigation

 public void GetNavigation(NavigationBuilder builder) {
     builder.Add(T("Forms"), "4",
         menu => menu
             .Add(T("Manage Forms"), "1.0",
                 item => item.Action("Index", "Admin", new { area = "Orchard.CustomForms" }).Permission(Permissions.ManageForms))
     );
 }
開發者ID:bigfont,項目名稱:CertifiedOverheadCrane,代碼行數:7,代碼來源:AdminMenu.cs

示例13: GetNavigation

 public void GetNavigation(NavigationBuilder builder)
 {
     builder.Add(T("Settings"), "50",
         menu => menu
             .Add(T("MailChimp API Key"), "10", item => item.Action("Index", "Admin", new { area = "NogginBox.MailChimp" })
                 .Permission(StandardPermissions.SiteOwner)));
 }
開發者ID:Timbioz,項目名稱:SciGitAzure,代碼行數:7,代碼來源:AdminMenu.cs

示例14: GetNavigation

 public void GetNavigation(NavigationBuilder builder) {
     builder
         .Add(T("Migrate to 1.4"), "0", menu => menu.Action("Index", "Route", new { area = "UpgradeTo14" })
             .Add(T("Migrate Routes"), "0", item => item.Action("Index", "Route", new { area = "UpgradeTo14" }).LocalNav().Permission(StandardPermissions.SiteOwner))
             .Add(T("Migrate Fields"), "0", item => item.Action("Index", "Field", new { area = "UpgradeTo14" }).LocalNav().Permission(StandardPermissions.SiteOwner))
         );
 }
開發者ID:Vinna,項目名稱:DeepInSummer,代碼行數:7,代碼來源:AdminMenu.cs

示例15: GetNavigation

        public void GetNavigation(NavigationBuilder builder) {
            builder.Add(T("Taxonomies"), "4",
                        menu => menu
                                    .Add(T("Manage Taxonomies"), "1.0", item => item.Action("Index", "TaxonomyAdmin", new { area = "Summit.Core" }).Permission(Permissions.ManageTaxonomies))
                                    );

            builder.AddImageSet("summit")
                .Add(T("Summit"), "1.5", BuildMenu);

            builder
         .Add(T("Settings"), menu => menu
             .Add(T("Image Power Tools"), "1.0", x => x
                 .Add(T("Settings"), "1.0", a => a.Action("Settings", "Admin", new { area = "Summit.Core" }).Permission(StandardPermissions.SiteOwner).LocalNav())
                 .Add(T("Cache"), "2.0", a => a.Action("Cache", "Admin", new { area = "Summit.Core" }).Permission(StandardPermissions.SiteOwner).LocalNav())
             ));
        }
開發者ID:ThinkPublishing,項目名稱:Summit.Core,代碼行數:16,代碼來源:AdminMenu.cs


注:本文中的Orchard.UI.Navigation.NavigationBuilder.Add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。