当前位置: 首页>>代码示例>>C#>>正文


C# WebInterface.SaveWebUISettings方法代码示例

本文整理汇总了C#中Universe.Modules.Web.WebInterface.SaveWebUISettings方法的典型用法代码示例。如果您正苦于以下问题:C# WebInterface.SaveWebUISettings方法的具体用法?C# WebInterface.SaveWebUISettings怎么用?C# WebInterface.SaveWebUISettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Universe.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:emperorstarfinder,项目名称:Virtual-Universe,代码行数:87,代码来源:settings_manager.cs


注:本文中的Universe.Modules.Web.WebInterface.SaveWebUISettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。