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


C# WebInterface.SaveWebUISettings方法代碼示例

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


在下文中一共展示了WebInterface.SaveWebUISettings方法的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>();
            var settings = webInterface.GetWebUISettings();

            if (requestParameters.ContainsKey("Submit"))
            {
                settings.WebRegistration = requestParameters["WebRegistration"].ToString() == "1";
                settings.MapCenter.X = int.Parse(requestParameters["GridCenterX"].ToString());
                settings.MapCenter.Y = int.Parse(requestParameters["GridCenterY"].ToString());
                settings.LocalFrontPage = requestParameters["LocalFrontPage"].ToString();
                if (settings.LocalFrontPage != "")
                    settings.LocalFrontPage = "local/" + settings.LocalFrontPage;
                settings.LocalCSS = requestParameters["LocalCSS"].ToString();
                 settings.HideSlideshowBar = requestParameters["HideSlideshowBar"].ToString() == "1";
                settings.HideLanguageTranslatorBar = requestParameters["HideLanguageBar"].ToString() == "1";
                settings.HideStyleBar = requestParameters["HideStyleBar"].ToString() == "1";
                if (settings.LocalCSS != "")
                {
                    settings.LocalCSS = "local/" + settings.LocalCSS;
                    settings.HideStyleBar = true;                               // not needed if a local style is used
                }

                webInterface.SaveWebUISettings (settings);

                response = "Successfully updated WebUI settings.";

                return null;
            }
            else if (requestParameters.ContainsKey("IgnorePagesUpdates"))
            {
                settings.LastPagesVersionUpdateIgnored = PagesMigrator.CurrentVersion;
                webInterface.SaveWebUISettings (settings);
            }
            else if (requestParameters.ContainsKey("IgnoreSettingsUpdates"))
            {
                settings.LastSettingsVersionUpdateIgnored = PagesMigrator.CurrentVersion;
                webInterface.SaveWebUISettings (settings);
            }
            vars.Add("WebRegistrationNo", !settings.WebRegistration ? "selected=\"selected\"" : "");
            vars.Add("WebRegistrationYes", settings.WebRegistration ? "selected=\"selected\"" : "");
            vars.Add("GridCenterX", settings.MapCenter.X);
            vars.Add("GridCenterY", settings.MapCenter.Y);
            if (settings.LocalFrontPage.StartsWith("local/"))
                vars.Add("LocalFrontPage", settings.LocalFrontPage.Remove(0,6));                // remove 'local/' prefix
            else
                vars.Add("LocalFrontPage", settings.LocalFrontPage);

            if (settings.LocalCSS.StartsWith("local/"))
                vars.Add("LocalCSS", settings.LocalCSS.Remove(0,6));                            // remove 'local/' prefix
            else
                vars.Add("LocalCSS", settings.LocalCSS);

            vars.Add("HideSlideshowBarNo", !settings.HideSlideshowBar ? "selected=\"selected\"" : "");
            vars.Add("HideSlideshowBarYes", settings.HideSlideshowBar ? "selected=\"selected\"" : "");
            vars.Add("HideLanguageBarNo", !settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
            vars.Add("HideLanguageBarYes", settings.HideLanguageTranslatorBar ? "selected=\"selected\"" : "");
            vars.Add("HideStyleBarNo", !settings.HideStyleBar ? "selected=\"selected\"" : "");
            vars.Add("HideStyleBarYes", settings.HideStyleBar ? "selected=\"selected\"" : "");
            vars.Add("IgnorePagesUpdates",
                     PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored)
                         ? ""
                         : "checked");
            vars.Add("IgnoreSettingsUpdates",
                     settings.LastSettingsVersionUpdateIgnored != SettingsMigrator.CurrentVersion ? "" : "checked");

            vars.Add("SettingsManager", translator.GetTranslatedString("SettingsManager"));
            vars.Add("IgnorePagesUpdatesText", translator.GetTranslatedString("IgnorePagesUpdatesText"));
            vars.Add("IgnoreSettingsUpdatesText", translator.GetTranslatedString("IgnoreSettingsUpdatesText"));
            vars.Add("WebRegistrationText", translator.GetTranslatedString("WebRegistrationText"));
            vars.Add("GridCenterXText", translator.GetTranslatedString("GridCenterXText"));
            vars.Add("GridCenterYText", translator.GetTranslatedString("GridCenterYText"));
            vars.Add("LocalFrontPageText", translator.GetTranslatedString("LocalFrontPageText"));
            vars.Add("LocalCSSText", translator.GetTranslatedString("LocalCSSText"));
            vars.Add("WelcomeMessageText", translator.GetTranslatedString("WelcomeMessageText"));
            vars.Add("HideSlideshowBarText", translator.GetTranslatedString("HideSlideshowBarText"));
            vars.Add("HideLanguageBarText", translator.GetTranslatedString("HideLanguageBarText"));
            vars.Add("HideStyleBarText", translator.GetTranslatedString("HideStyleBarText"));
            vars.Add("Save", translator.GetTranslatedString("Save"));
            vars.Add("No", translator.GetTranslatedString("No"));
            vars.Add("Yes", translator.GetTranslatedString("Yes"));

            return vars;
        }
開發者ID:QueenStarfinder,項目名稱:WhiteCore-Dev,代碼行數:87,代碼來源:settings_manager.cs


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