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


C# ITranslator类代码示例

本文整理汇总了C#中ITranslator的典型用法代码示例。如果您正苦于以下问题:C# ITranslator类的具体用法?C# ITranslator怎么用?C# ITranslator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ITranslator类属于命名空间,在下文中一共展示了ITranslator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridNewsItem news;
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                string id = requestParameters["NewsID"].ToString();
                news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", id);
                connector.RemoveGeneric(UUID.Zero, "WebGridNews", id);
                GridNewsItem item = new GridNewsItem { Text = text, Time = news.Time, Title = title, ID = int.Parse(id) };
                connector.AddGeneric(UUID.Zero, "WebGridNews", id, item.ToOSD());
                response = "<h3>News item editted successfully, redirecting to main page</h3>" +
                    "<script language=\"javascript\">" +
                    "setTimeout(function() {window.location.href = \"index.html?page=news_manager\";}, 0);" +
                    "</script>";
                return null;
            }


            news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
            vars.Add("NewsTitle", news.Title);
            vars.Add("NewsText", news.Text);
            vars.Add("NewsID", news.ID.ToString());

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));
            return vars;
        }
开发者ID:rjspence,项目名称:YourSim,代码行数:35,代码来源:edit_news.cs

示例2: 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>();

            if (requestParameters.ContainsKey("ResetMenu"))
            {
                PagesMigrator.ResetToDefaults();
                response = "Menu: "+ translator.GetTranslatedString("ChangesSavedSuccessfully");
                return null;
            }
            if (requestParameters.ContainsKey("ResetSettings"))
            {
                SettingsMigrator.ResetToDefaults(webInterface);
                response = "WebUI: "+ translator.GetTranslatedString("ChangesSavedSuccessfully");
                return null;
            }

            vars.Add("FactoryReset", translator.GetTranslatedString("FactoryReset"));
            vars.Add("ResetMenuText", translator.GetTranslatedString("ResetMenuText"));
            vars.Add("ResetSettingsText", translator.GetTranslatedString("ResetSettingsText"));
            vars.Add("ResetMenuInfoText", translator.GetTranslatedString("ResetMenuText"));
            vars.Add("ResetSettingsInfoText", translator.GetTranslatedString("ResetSettingsInfoText"));
            vars.Add("Reset", translator.GetTranslatedString("Reset"));

            return vars;
        }
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:29,代码来源:factory_reset.cs

示例3: 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>();
            //IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();

            // Check if we're looking at the standard page or the submitted one
            if (requestParameters.ContainsKey("Submit"))
            {
            }
            else
            {
                //vars.Add("ErrorMessage", error);

                vars.Add("SimConsoleText", translator.GetTranslatedString("SimConsoleText"));
                vars.Add("SimAddressText", translator.GetTranslatedString("SimAddressText"));
                vars.Add("UserNameText", translator.GetTranslatedString("UserNameText"));
                vars.Add("PasswordText", translator.GetTranslatedString("PasswordText"));
                vars.Add("SendCommandText", translator.GetTranslatedString("SendCommandText"));

                vars.Add("Login", translator.GetTranslatedString("Login"));

            }
            return vars;
        }
开发者ID:VirtualReality,项目名称:Universe,代码行数:27,代码来源:sim_console.cs

示例4: GameOfLife

 public GameOfLife(String gameInput, GameCriteria criteria, 
                   ITranslator<GameData> translator, BoardFactory boardFactory)
 {
     this.criteria = criteria;
     var gameData = translator.Translate(gameInput);
     board = boardFactory.GetBoard(gameData);
 }
开发者ID:kevPo,项目名称:GameOfLife,代码行数:7,代码来源:GameOfLife.cs

示例5: 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>();
     IGenericsConnector connector = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
     if (httpRequest.Query.Contains("delete"))
     {
         string newsID = httpRequest.Query["delete"].ToString();
         connector.RemoveGeneric(UUID.Zero, "WebGridNews", newsID);
         vars["Success"] = "Successfully deleted the news item";
     }
     else
         vars["Success"] = "";
     var newsItems = connector.GetGenerics<GridNewsItem>(UUID.Zero, "WebGridNews");
     vars.Add("News", newsItems.ConvertAll<Dictionary<string, object>>(item => item.ToDictionary()));
     vars.Add("NewsManager", translator.GetTranslatedString("NewsManager"));
     vars.Add("EditNewsItem", translator.GetTranslatedString("EditNewsItem"));
     vars.Add("AddNewsItem", translator.GetTranslatedString("AddNewsItem"));
     vars.Add("DeleteNewsItem", translator.GetTranslatedString("DeleteNewsItem"));
     vars.Add("NewsTitleText", translator.GetTranslatedString("NewsTitleText"));
     vars.Add("NewsDateText", translator.GetTranslatedString("NewsDateText"));
     vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
     vars.Add("DeleteNewsText", translator.GetTranslatedString("DeleteNewsText"));
     return vars;
 }
开发者ID:VirtualReality,项目名称:Universe,代码行数:27,代码来源:news_manager.cs

示例6: AfterEmit

 public void AfterEmit(IEmitter emitter, ITranslator translator)
 {
     foreach (var plugin in this.Parts)
     {
         plugin.AfterEmit(emitter, translator);
     }
 }
开发者ID:GavinHwa,项目名称:Bridge,代码行数:7,代码来源:Plugins.cs

示例7: Fill

        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
            OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary<string, object>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridNewsItem news = connector.GetGeneric<GridNewsItem>(UUID.Zero, "WebGridNews", httpRequest.Query["newsid"].ToString());
            if (news != null)
            {
                vars.Add("NewsTitle", news.Title);
                vars.Add("NewsText", news.Text);
                vars.Add("NewsID", news.ID.ToString());
            }
            else
            {
                if (httpRequest.Query["newsid"].ToString() == "-1")
                {
                    vars.Add("NewsTitle", "No news to report");
                    vars.Add("NewsText", "");
                }
                else
                {
                    vars.Add("NewsTitle", "Invalid News Item");
                    vars.Add("NewsText", "");
                }
                vars.Add("NewsID", "-1");
            }

            vars.Add("News", translator.GetTranslatedString("News"));
            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("EditNewsText", translator.GetTranslatedString("EditNewsText"));
            return vars;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:33,代码来源:news.cs

示例8: TranslatableException

 public TranslatableException(Exception innerException, ITranslator translator, string format, params object[] args)
     : base(null, innerException)
 {
     Format = format;
     Args = args;
     Translator = translator;
 }
开发者ID:happyu0223,项目名称:CodeFirstIOCDemo,代码行数:7,代码来源:TranslatableException.cs

示例9: Fill

        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
            OSHttpResponse httpResponse, Dictionary<string, object> requestParameters, ITranslator translator)
        {
            var vars = new Dictionary<string, object>();
            if (requestParameters.ContainsKey("Submit"))
            {
                string title = requestParameters["NewsTitle"].ToString();
                string text = requestParameters["NewsText"].ToString();
                IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
                GridNewsItem item = new GridNewsItem { Text = text, Time = DateTime.Now, Title = title };
                item.ID = connector.GetGenericCount(UUID.Zero, "WebGridNews") + 1;
                connector.AddGeneric(UUID.Zero, "WebGridNews", item.ID.ToString(), item.ToOSD());
                vars["ErrorMessage"] = "News item added successfully";
                webInterface.Redirect(httpResponse, "index.html?page=news_manager", filename);
                return vars;
            }
            else
                vars["ErrorMessage"] = "";

            vars.Add("NewsItemTitle", translator.GetTranslatedString("NewsItemTitle"));
            vars.Add("NewsItemText", translator.GetTranslatedString("NewsItemText"));
            vars.Add("AddNewsText", translator.GetTranslatedString("AddNewsText"));
            vars.Add("Submit", translator.GetTranslatedString("Submit"));

            return vars;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:26,代码来源:add_news.cs

示例10: AlreadyTranslatedTranslator

        public AlreadyTranslatedTranslator(ITranslator inner)
        {
            if (inner == null)
                throw new ArgumentNullException("inner");

            this.Inner = inner;
        }
开发者ID:carlosesquivelunono,项目名称:extensions,代码行数:7,代码来源:ITranslator.cs

示例11: With

        public NodeTreeParserConfig With(ITranslator translator)
        {
            this.translators.Add(translator);
            this.locators.Add(new LinkedTextLocator(translator));

            return this;
        }
开发者ID:MatanShahar,项目名称:IntelliSun,代码行数:7,代码来源:NodeTreeParserConfig.cs

示例12: Fill

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

            IAgentInfoConnector users = DataManager.DataManager.RequestPlugin<IAgentInfoConnector>();
            IGenericsConnector connector = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            GridWelcomeScreen welcomeInfo = connector.GetGeneric<GridWelcomeScreen>(UUID.Zero, "GridWelcomeScreen", "GridWelcomeScreen");
            if (welcomeInfo == null)
                welcomeInfo = GridWelcomeScreen.Default;

            IConfigSource config = webInterface.Registry.RequestModuleInterface<ISimulationBase>().ConfigSource;
            vars.Add("GridStatus", translator.GetTranslatedString("GridStatus"));
            vars.Add("GridOnline", welcomeInfo.GridStatus ? translator.GetTranslatedString("Online") : translator.GetTranslatedString("Offline"));
            vars.Add("TotalUserCount", translator.GetTranslatedString("TotalUserCount"));
            vars.Add("UserCount", webInterface.Registry.RequestModuleInterface<IUserAccountService>().
                NumberOfUserAccounts(null, "").ToString());
            vars.Add("TotalRegionCount", translator.GetTranslatedString("TotalRegionCount"));
            vars.Add("RegionCount", DataManager.DataManager.RequestPlugin<IRegionData>().
                Count((Framework.RegionFlags)0, (Framework.RegionFlags)0).ToString());
            vars.Add("UniqueVisitors", translator.GetTranslatedString("UniqueVisitors"));
            vars.Add("UniqueVisitorCount", users.RecentlyOnline((uint)TimeSpan.FromDays(30).TotalSeconds, false).ToString());
            vars.Add("OnlineNow", translator.GetTranslatedString("OnlineNow"));
            vars.Add("OnlineNowCount", users.RecentlyOnline(5 * 60, true).ToString());
            vars.Add("HGActiveText", translator.GetTranslatedString("HyperGrid"));
            string disabled = translator.GetTranslatedString("Disabled"),
                enabled = translator.GetTranslatedString("Enabled");
            vars.Add("HGActive", disabled + "(TODO: FIX)");
            vars.Add("VoiceActiveLabel", translator.GetTranslatedString("Voice"));
            vars.Add("VoiceActive", config.Configs["Voice"] != null && config.Configs["Voice"].GetString("Module", "GenericVoice") != "GenericVoice" ? enabled : disabled);
            vars.Add("CurrencyActiveLabel", translator.GetTranslatedString("Currency"));
            vars.Add("CurrencyActive", webInterface.Registry.RequestModuleInterface<IMoneyModule>() != null ? enabled : disabled);

            return vars;
        }
开发者ID:nathanmarck,项目名称:Aurora-Sim,代码行数:35,代码来源:gridstatus.cs

示例13: PluginsPresenter

 /// <summary>
 /// Initializes a new instance of the <see cref="PluginsPresenter" /> class.
 /// </summary>
 /// <param name="settingsService">The settings service.</param>
 /// <param name="translator">The translator.</param>
 public PluginsPresenter(
     ISettingsService settingsService,
     ITranslator<string, Plugins> translator)
 {
     this.settingsService = settingsService;
     this.translator = translator;
 }
开发者ID:slodge,项目名称:NinjaCoderForMvvmCross,代码行数:12,代码来源:PluginsPresenter.cs

示例14: ISOStringFieldEncoder

 public ISOStringFieldEncoder(IPadder padder, IPrefix prefix, ITranslator translator)
     : base()
 {
     _padder = padder;
     _prefix = prefix;
     _translator = translator;
 }
开发者ID:phucvinh,项目名称:iso4net,代码行数:7,代码来源:ISOStringFieldEncoder.cs

示例15: 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>();

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

            // Index Page
            vars.Add("HomeText", translator.GetTranslatedString("HomeText"));
            vars.Add("HomeTextWelcome", translator.GetTranslatedString("HomeTextWelcome"));
            vars.Add("HomeTextTips", translator.GetTranslatedString("HomeTextTips"));
            vars.Add("WelcomeScreen", translator.GetTranslatedString("WelcomeScreen"));
            vars.Add("WelcomeToText", translator.GetTranslatedString("WelcomeToText"));

            IGenericsConnector generics = Aurora.DataManager.DataManager.RequestPlugin<IGenericsConnector>();
            var settings = generics.GetGeneric<GridSettings>(UUID.Zero, "WebSettings", "Settings");
            if (PagesMigrator.RequiresUpdate() && PagesMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastPagesVersionUpdateIgnored))
                vars.Add("PagesUpdateRequired", translator.GetTranslatedString("Pages") + " " + translator.GetTranslatedString("DefaultsUpdated"));
            else
                vars.Add("PagesUpdateRequired", "");
            if (SettingsMigrator.RequiresUpdate() && SettingsMigrator.CheckWhetherIgnoredVersionUpdate(settings.LastSettingsVersionUpdateIgnored))
                vars.Add("SettingsUpdateRequired", translator.GetTranslatedString("Settings") + " " + translator.GetTranslatedString("DefaultsUpdated"));
            else
                vars.Add("SettingsUpdateRequired", "");
            return vars;
        }
开发者ID:rjspence,项目名称:YourSim,代码行数:29,代码来源:home.cs


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