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


C# WebInterface.GetGridPages方法代碼示例

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


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

示例1: Fill

        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                               OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
                                               ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary<string, object>();

            #region Find pages

            List<Dictionary<string, object>> pages = new List<Dictionary<string, object>>();

            var settings = webInterface.GetWebUISettings();
            var rootPage = webInterface.GetGridPages();

            rootPage.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));

            foreach (GridPage page in rootPage.Children)
            {
                if (page.LoggedOutRequired && Authenticator.CheckAuthentication(httpRequest))
                    continue;
                if (page.LoggedInRequired && !Authenticator.CheckAuthentication(httpRequest))
                    continue;
                if (page.AdminRequired && !Authenticator.CheckAdminAuthentication(httpRequest, page.AdminLevelRequired))
                    continue;

                List<Dictionary<string, object>> childPages = new List<Dictionary<string, object>>();
                page.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));
                foreach (GridPage childPage in page.Children)
                {
                    if (childPage.LoggedOutRequired && Authenticator.CheckAuthentication(httpRequest))
                        continue;
                    if (childPage.LoggedInRequired && !Authenticator.CheckAuthentication(httpRequest))
                        continue;
                    if (childPage.AdminRequired &&
                        !Authenticator.CheckAdminAuthentication(httpRequest, childPage.AdminLevelRequired))
                        continue;

                    childPages.Add(new Dictionary<string, object>
                                       {
                                           {"ChildMenuItemID", childPage.MenuID},
                                           {"ChildShowInMenu", childPage.ShowInMenu},
                                           {"ChildMenuItemLocation", childPage.Location},
                                           {
                                               "ChildMenuItemTitleHelp",
                                               GetTranslatedString(translator, childPage.MenuToolTip, childPage, true)
                                           },
                                           {
                                               "ChildMenuItemTitle",
                                               GetTranslatedString(translator, childPage.MenuTitle, childPage, false)
                                           }
                                       });

                    //Add one for menu.js
                    pages.Add(new Dictionary<string, object>
                                  {
                                      {"MenuItemID", childPage.MenuID},
                                      {"ShowInMenu", false},
                                      {"MenuItemLocation", childPage.Location}
                                  });
                }

                pages.Add(new Dictionary<string, object>
                              {
                                  {"MenuItemID", page.MenuID},
                                  {"ShowInMenu", page.ShowInMenu},
                                  {"HasChildren", page.Children.Count > 0},
                                  {"ChildrenMenuItems", childPages},
                                  {"MenuItemLocation", page.Location},
                                  {"MenuItemTitleHelp", GetTranslatedString(translator, page.MenuToolTip, page, true)},
                        {"MenuItemTitle", GetTranslatedString(translator, page.MenuTitle, page, false)},
                        {"MenuItemToolTip", GetTranslatedString(translator, page.MenuToolTip, page, true)}
                              });
            }
            vars.Add("MenuItems", pages);

            #endregion

            // Tooltips Urls
            vars.Add("TooltipsWelcomeScreen", translator.GetTranslatedString("TooltipsWelcomeScreen"));
            vars.Add("TooltipsWorldMap", translator.GetTranslatedString("TooltipsWorldMap"));

            // Style Switcher
            vars.Add("styles1", translator.GetTranslatedString("styles1"));
            vars.Add("styles2", translator.GetTranslatedString("styles2"));
            vars.Add("styles3", translator.GetTranslatedString("styles3"));
            vars.Add("styles4", translator.GetTranslatedString("styles4"));
            vars.Add("styles5", translator.GetTranslatedString("styles5"));

            vars.Add("StyleSwitcherStylesText", translator.GetTranslatedString("StyleSwitcherStylesText"));
            vars.Add("StyleSwitcherLanguagesText", translator.GetTranslatedString("StyleSwitcherLanguagesText"));
            vars.Add("StyleSwitcherChoiceText", translator.GetTranslatedString("StyleSwitcherChoiceText"));

            // Language Switcher
            vars.Add("en", translator.GetTranslatedString("en"));
            vars.Add("fr", translator.GetTranslatedString("fr"));
            vars.Add("de", translator.GetTranslatedString("de"));
            vars.Add("it", translator.GetTranslatedString("it"));
            vars.Add("es", translator.GetTranslatedString("es"));
            vars.Add("nl", translator.GetTranslatedString("nl"));
            vars.Add ("ru", translator.GetTranslatedString ("ru"));
//.........這裏部分代碼省略.........
開發者ID:WhiteCoreSim,項目名稱:WhiteCore-Dev,代碼行數:101,代碼來源:index.cs


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