public BasicAuthenticationCtrl() { try { this.Font = SystemFonts.MessageBoxFont; InitializeComponent(); resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.Editor.OSMFeatureInspectorStrings", this.GetType().Assembly); lblUserName.Text = resourceManager.GetString("OSMEditor_Authentication_UI_labelusername"); lblPassword.Text = resourceManager.GetString("OSMEditor_Authentication_UI_labelpassword"); txtUserName.LostFocus += new EventHandler(txtUserName_LostFocus); txtUserName.Refresh(); txtPassword.LostFocus += new EventHandler(txtPassword_LostFocus); txtPassword.Refresh(); m_password = String.Empty; m_username = String.Empty; this.Refresh(); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); System.Diagnostics.Debug.WriteLine(ex.StackTrace); } }
/// <summary> /// Initializes the attribute. /// </summary> protected void Init(int index, Type itemType, Type resourceType, string itemName, string name, int tabIndex, bool enabled) { this.Enabled = enabled; System.Resources.ResourceManager resources = new ResourceManager(resourceType.Namespace + ".Properties.Resources", resourceType.Assembly); string tmpName = resources.GetString(itemName); if (tmpName == null || tmpName.Trim().Length == 0) { m_ItemName = itemName; } else { m_ItemName = tmpName; } tmpName = resources.GetString(name); if (tmpName == null || tmpName.Trim().Length == 0) { m_Name = name; } else { m_Name = tmpName; } m_Index = index; m_TabIndex = tabIndex; m_ItemType = itemType; }
/// <summary> /// Localizable constructor /// </summary> /// <param name="name">The localized name</param> /// <param name="description">The localized description</param> /// <param name="resourceType">The resource type to load from</param> public NetworkLayerFactoryAttribute(string name, string description, Type resourceType) { ResourceManager manager = new ResourceManager(resourceType); Name = manager.GetString(name); Description = manager.GetString(description); }
public void UpdateLanguage(ResourceManager man) { label1.Text = man.GetString("name"); maleBox.Text = man.GetString("male"); femaleBox.Text = man.GetString("female"); label2.Text = man.GetString("server"); }
private void BindTabs() { ResourceManager LocRM = new ResourceManager("Mediachase.Ibn.WebResources.App_GlobalResources.Calendar.Resources.strCalendar", Assembly.Load(new AssemblyName("Mediachase.Ibn.WebResources"))); UserLightPropertyCollection pc = Security.CurrentUser.Properties; if (Tab != null) { if (Tab == "SharedCalendars" || Tab == "MyCalendar") pc["Calendar1_CurrentTab"] = Tab; } else if (pc["Calendar1_CurrentTab"] == null) pc["Calendar1_CurrentTab"] = "MyCalendar"; using (IDataReader rdr = Mediachase.IBN.Business.CalendarView.GetListPeopleForCalendar()) { if (!rdr.Read() && pc["Calendar1_CurrentTab"] == "SharedCalendars") pc["Calendar1_CurrentTab"] = "MyCalendar"; } string controlName = "CalendarViewMy.ascx"; if (pc["Calendar1_CurrentTab"] == "MyCalendar") ((Mediachase.UI.Web.Modules.PageTemplateNew)this.Parent.Parent.Parent.Parent).Title = LocRM.GetString("tMyCalendar"); else if (pc["Calendar1_CurrentTab"] == "SharedCalendars") ((Mediachase.UI.Web.Modules.PageTemplateNew)this.Parent.Parent.Parent.Parent).Title = LocRM.GetString("tSharedCalendars"); System.Web.UI.UserControl control = (System.Web.UI.UserControl)LoadControl(controlName); phItems.Controls.Add(control); }
public Autodesk.Revit.UI.Result OnStartup(UIControlledApplication application) { try { //TAF load english_us TODO add a way to localize res = Resource_en_us.ResourceManager; // Create new ribbon panel RibbonPanel ribbonPanel = application.CreateRibbonPanel(res.GetString("App_Description")); //MDJ todo - move hard-coded strings out to resource files //Create a push button in the ribbon panel PushButton pushButton = ribbonPanel.AddItem(new PushButtonData("Dynamo", res.GetString("App_Name"), m_AssemblyName, "Dynamo.Applications.DynamoRevit")) as PushButton; System.Drawing.Bitmap dynamoIcon = Dynamo.Applications.Properties.Resources.Nodes_32_32; BitmapSource bitmapSource = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap( dynamoIcon.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, System.Windows.Media.Imaging.BitmapSizeOptions.FromEmptyOptions()); pushButton.LargeImage = bitmapSource; pushButton.Image = bitmapSource; // MDJ = element level events and dyanmic model update // MDJ 6-8-12 trying to get new dynamo to watch for user created ref points and re-run definition when they are moved IdlePromise.RegisterIdle(application); updater = new DynamoUpdater(application.ActiveAddInId, application.ControlledApplication); if (!UpdaterRegistry.IsUpdaterRegistered(updater.GetUpdaterId())) UpdaterRegistry.RegisterUpdater(updater); ElementClassFilter SpatialFieldFilter = new ElementClassFilter(typeof(SpatialFieldManager)); ElementClassFilter familyFilter = new ElementClassFilter(typeof(FamilyInstance)); ElementCategoryFilter refPointFilter = new ElementCategoryFilter(BuiltInCategory.OST_ReferencePoints); ElementClassFilter modelCurveFilter = new ElementClassFilter(typeof(CurveElement)); ElementClassFilter sunFilter = new ElementClassFilter(typeof(SunAndShadowSettings)); IList<ElementFilter> filterList = new List<ElementFilter>(); filterList.Add(SpatialFieldFilter); filterList.Add(familyFilter); filterList.Add(modelCurveFilter); filterList.Add(refPointFilter); filterList.Add(sunFilter); ElementFilter filter = new LogicalOrFilter(filterList); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeAny()); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementDeletion()); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeElementAddition()); return Result.Succeeded; } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.ToString()); return Result.Failed; } }
public override void Setup() { base.Setup(); // Replace existing listeners with listener for testing. Trace.Listeners.Clear(); Trace.Listeners.Add(this.asertFailListener); ResourceManager r = new ResourceManager("MySql.Data.Entity.Tests.Properties.Resources", typeof(BaseEdmTest).Assembly); string schema = r.GetString("schema"); MySqlScript script = new MySqlScript(conn); script.Query = schema; script.Execute(); // now create our procs schema = r.GetString("procs"); script = new MySqlScript(conn); script.Delimiter = "$$"; script.Query = schema; script.Execute(); //ModelFirstModel1 schema = r.GetString("ModelFirstModel1"); script = new MySqlScript(conn); script.Query = schema; script.Execute(); MySqlCommand cmd = new MySqlCommand("DROP DATABASE IF EXISTS `modeldb`", rootConn); cmd.ExecuteNonQuery(); }
static void Main(string[] args) { while (true) { var j = LanguageConfig.Languages.Keys; List<string> k = j.ToList(); foreach (var i in j) { Console.WriteLine(i + ", " + LanguageConfig.Languages[i]); } foreach (var l in k) { Console.WriteLine(l); } Console.WriteLine(ConfigurationManager.AppSettings["defaultTheme"]); Console.ReadLine(); ConfigurationManager.RefreshSection("appSettings"); ResourceManager rm = new ResourceManager("ConsoleApplication10.Resources", Assembly.GetExecutingAssembly()); System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("es"); Console.WriteLine(rm.GetString("name", ci)); Console.WriteLine(rm.GetString("name", new System.Globalization.CultureInfo("en"))); Console.WriteLine(rm.GetString("name")); Console.ReadLine(); } }
/// <summary> /// This static/utility method will provide a message suitable for display to a user corresponding to a given Rapid Code/language. /// </summary> /// <param name="errorCode">Rapid API Error Code e.g. "V6023" </param> /// <param name="language">Language Code, e.g. "EN" (default) or "ES"</param> /// <returns>String with a description for the given code in the specified language</returns> public static string UserDisplayMessage(string errorCode, string language) { ResourceManager rm = new ResourceManager("eWAY.Rapid.Resources.ErrorMessages", Assembly.GetExecutingAssembly()); string result = null; try { var cultureInfo = new CultureInfo(language); return result = rm.GetString(errorCode, cultureInfo); } catch (CultureNotFoundException) { var cultureInfo = new CultureInfo(SystemConstants.DEFAULT_LANGUAGE_CODE); return result = rm.GetString(errorCode, cultureInfo); } catch (MissingManifestResourceException) { var cultureInfo = new CultureInfo(SystemConstants.DEFAULT_LANGUAGE_CODE); try { return result = rm.GetString(errorCode, cultureInfo); } catch (MissingManifestResourceException) { return SystemConstants.INVALID_ERROR_CODE_MESSAGE; } } }
protected void Page_Load(object sender, EventArgs e) { try { if (User.IsInRole("Employee")) { lbl_Username.Text = Context.Profile.GetProfileGroup("Employee").GetPropertyValue("FirstName").ToString(); } else if (User.IsInRole("Organization")) { Assembly ass = Assembly.Load("App_GlobalResources"); ResourceManager rm = new ResourceManager("Resources.Resource", ass); lbl_Username.Text = Context.Profile.GetPropertyValue("Employer.FirstName").ToString(); HyperLink2.Text = rm.GetString("Pleaseclickheretoyourmanagement"); HyperLink2.NavigateUrl = "~/Employer/EmployerSite.aspx"; HyperLink1.Text = rm.GetString("Pleaseclickheretopostajob"); HyperLink1.NavigateUrl = "~/memberArea/AdsAJob.aspx"; } else { lbl_Username.Visible = false; HyperLink1.Visible = false; HyperLink2.Visible = false; } } catch (Exception) { Response.Redirect("~/publicArea/errorpages/Error404.aspx"); } }
public ActionResult Buy(string id) { ResourceManager resourceManager = new ResourceManager("NetPing_modern.Resources.Views.InnerPages.Buy", typeof(InnerPagesController).Assembly); ; switch (id) { case "": case null: ViewBag.Text = _repository.SiteTexts.FirstOrDefault(t => t.Tag == "Buy").Text; break; case "dealers": resourceManager = new ResourceManager("NetPing_modern.Resources.Views.InnerPages.Dealers", typeof(InnerPagesController).Assembly); ViewBag.Text = _repository.SiteTexts.FirstOrDefault(t => t.Tag == "Dealers").Text; break; case "partnership-how-to": resourceManager = new ResourceManager("NetPing_modern.Resources.Views.InnerPages.Partnership", typeof(InnerPagesController).Assembly); ViewBag.Text = _repository.SiteTexts.FirstOrDefault(t => t.Tag == "Partnership-how").Text; break; default: return HttpNotFound(); } ViewBag.Head = resourceManager.GetString("Page_head", System.Globalization.CultureInfo.CurrentCulture); ViewBag.Title = resourceManager.GetString("Page_title", System.Globalization.CultureInfo.CurrentCulture); ViewBag.Description = resourceManager.GetString("Page_description", System.Globalization.CultureInfo.CurrentCulture); ViewBag.Keywords = resourceManager.GetString("Page_keywords", System.Globalization.CultureInfo.CurrentCulture); return View("InnerPage"); }
protected void Page_Load(object sender, EventArgs e) { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.FileLibrary.Resources.strFileLibrary", Assembly.GetExecutingAssembly()); secHeader.Title = LocRM.GetString("tDownloadLinkTitle"); int lifeTime = 0; try { lifeTime = Convert.ToInt32(PortalConfig.WebDavSessionLifeTime); } catch (Exception) { } string sTime = String.Format("{0:D2}:{1:D2}", lifeTime / 60, lifeTime % 60); string sLink = WebDavUrlBuilder.GetWebDavUrl(_id); lblDownloadLink.Text = String.Format(LocRM.GetString("tDownLoadLink"), "javascript:FileDownload();", sTime); StringBuilder sb = new StringBuilder(); sb.AppendLine("var global_DownloadFlag = true;"); sb.AppendLine("function FileDownload()"); sb.AppendLine("{"); sb.AppendLine("global_DownloadFlag = false;"); sb.AppendFormat("window.location.href='{0}'", sLink); sb.AppendLine("}"); sb.AppendLine("function AutoFileDownload()"); sb.AppendLine("{"); sb.AppendLine("if(!global_DownloadFlag) return;"); sb.AppendFormat("window.location.href='{0}'", sLink); sb.AppendLine("}"); sb.AppendLine("setTimeout('AutoFileDownload()', 3000);"); ClientScript.RegisterStartupScript(this.Page, this.Page.GetType(), Guid.NewGuid().ToString("N"), sb.ToString(), true); }
protected void Page_Load(object sender, EventArgs e) { facade = new BusinessFacade(myConn); int noOfUnread = 0; try { MembershipUser mu = Membership.GetUser(); string employerId = mu.ProviderUserKey.ToString(); noOfUnread = facade.NoOfUnread(employerId); } catch (NullReferenceException) { FormsAuthentication.SignOut(); } Assembly ass = Assembly.Load("App_GlobalResources"); ResourceManager rm = new ResourceManager("Resources.Resource", ass); if (noOfUnread == 0) { lbl_NewApply.Text = rm.GetString("Nonewapply"); } else if (noOfUnread > 0) { lbl_NewApply.Text = noOfUnread + " "+rm.GetString("newapply"); } lbl_firstname.Text = Context.Profile.GetPropertyValue("Employer.Salutation").ToString() + " " + HttpContext.Current.Profile.GetPropertyValue("Employer.FirstName").ToString() + " " + HttpContext.Current.Profile.GetPropertyValue("Employer.LastName").ToString(); }
/// <summary> /// 显示 信息. /// /// 1.工程添加资源文件 /// 资源文件命名方式 [资源文件主题名].[语言区域.].resx /// 这里是 Resource1.en.resx 与 Resource1.zh-CN.resx /// 资源文件 默认为 “不复制” “嵌入的资源” /// /// /// 2.获取资源文件管理器 /// 资源文件名的构成为 [项目命名空间].[资源文件主题名] /// 这里是 A0410_Globalization.Resource1 /// /// 3.获取当前进程的语言区域 /// /// 4.从资源文件中按项目名获取值 /// /// /// /// 前台国际化环境的选择(改变当前程序进程中的区域信息的方式达到改变) /// Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("zh-CN"); /// Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-us"); /// Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("ja-JP"); /// /// </summary> public void ShowInfo() { // 获取资源文件管理器 ResourceManager rm = new ResourceManager("A0410_Globalization.Resource1", Assembly.GetExecutingAssembly()); // 获取当前进程的语言区域 CultureInfo ci = Thread.CurrentThread.CurrentCulture; // 从资源文件中按项目名获取值 String hello = rm.GetString("Hello", ci); String desc = rm.GetString("Desc", ci); Console.WriteLine("使用 {0} 的情况下:{1}, {2}", ci, hello, desc); // 换一种 语言区域 CultureInfo ciEn = new System.Globalization.CultureInfo("en-us"); // 从资源文件中按项目名获取值 hello = rm.GetString("Hello", ciEn); desc = rm.GetString("Desc", ciEn); Console.WriteLine("使用 {0} 的情况下:{1}, {2}", ciEn, hello, desc); }
private static void Application_Idle(object sender, EventArgs e) { Application.Idle -= new EventHandler(Application_Idle); if (context.MainForm == null) { ResourceManager rm =new ResourceManager("SoukeyNetget.Resources.globalUI", Assembly.GetExecutingAssembly()); frmMain mf = new frmMain (); context.MainForm = mf; frmStart sf = (frmStart)context.Tag; //初始化界面信息 sf.label3.Text = rm.GetString ("Info69"); Application.DoEvents(); mf.IniForm(); //初始化对象并开始启动运行区的任务 sf.label3.Text = rm.GetString ("Info70"); Application.DoEvents(); mf.UserIni(); sf.label3.Text = rm.GetString ("Info71"); Application.DoEvents(); mf.StartListen(); rm = null; //mf.IniForm(); sf.Close(); //关闭启动窗体 sf.Dispose(); mf.Show(); //启动主程序窗体 } }
private void ClearAllNote_Click(object sender, RoutedEventArgs e) { ResourceManager rm = new ResourceManager(typeof(My_Note.Lang.AppResources)); if (MessageBox.Show(rm.GetString("SettingPageClearAllNoteMessage"), rm.GetString("SettingPageClearButtonMessageTitle"), MessageBoxButton.OKCancel) != MessageBoxResult.OK) { //ommit } else { using (var appStorage = IsolatedStorageFile.GetUserStoreForApplication()) { string[] filelist = appStorage.GetFileNames("*.txt"); foreach (string file in filelist) { appStorage.DeleteFile(file); } string[] jpglist = appStorage.GetFileNames("*.jpg"); foreach (string file in jpglist) { appStorage.DeleteFile(file); } } } }
void Sound_Load(object sender, System.EventArgs e) { ResourceManager rm = new ResourceManager("SystemInformation.Resources", System.Reflection.Assembly.GetExecutingAssembly()); this.labelTitle.Text = rm.GetString("node_sound"); this.labelControllers.Text = rm.GetString("sound_controllers"); this.labelNumberControllers.Text = rm.GetString("sound_numofcontrollers") + ":"; this.labelControllerInfo.Text = rm.GetString("sound_controller_info") + ":"; try { // Allow panel to paint. Application.DoEvents(); int X; // Display number of controllers labelNumberControllers.Text = rm.GetString("sound_numofsoundcontrollers") + ": " + SndNumberOfControllers.ToString(); // Display controller detail if (SndNumberOfControllers > 0) { for (X = 0; X <= SndNumberOfControllers - 1; X++) { try { listviewAdaptors.Items.Add(rm.GetString("sound_man") + ": " + SndManufacturer[X].ToString()); } catch { listviewAdaptors.Items.Add(rm.GetString("sound_man") + ": " + rm.GetString("sound_n/a")); } try { listviewAdaptors.Items.Add(rm.GetString("sound_controller") + ": " + SndController[X].ToString()); } catch { listviewAdaptors.Items.Add(rm.GetString("sound_controller") + ": " + rm.GetString("sound_n/a")); } try { listviewAdaptors.Items.Add(rm.GetString("sound_dma_buffer_size") + ": " + SndDmaBufferSize[X].ToString()); } catch { listviewAdaptors.Items.Add(rm.GetString("sound_dma_buffer_size") + ": " + rm.GetString("sound_n/a")); } // Add blank line between adaptors listviewAdaptors.Items.Add(""); } } } catch { } }
private void ApplyLocalization() { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Projects.Resources.strPageTitles", typeof(AddRelatedProject).Assembly); if (Request["ProjectId"]!=null) pT.Title = LocRM.GetString("tAddRelated"); else pT.Title = LocRM.GetString("tAddToPortfolio"); }
public string GetMessageFromKey(string message) { ResourceManager resourceManager = new ResourceManager(Assembly.GetEntryAssembly().GetName().Name + ".Resource.LocalizedResources", Assembly.GetEntryAssembly()); if (resourceManager.GetString(message) != null && resourceManager.GetString(message) != "") return resourceManager.GetString(message); else return $"#<{message}>"; }
protected void Page_Load(object sender, EventArgs e) { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Workspace.Resources.strWorkspace", Assembly.GetExecutingAssembly()); if(Request["ReportType"]!= null && Request["ReportType"] == "Admin") pT.Title = LocRM.GetString("tTTReportTitleAdmin"); else pT.Title = LocRM.GetString("tTTReportTitleAdminMy"); }
private void ApplyLocalization() { ResourceManager LocRM = new ResourceManager("Mediachase.Ibn.WebResources.App_GlobalResources.Admin.Resources.strPageTitles", Assembly.Load(new AssemblyName("Mediachase.Ibn.WebResources"))); if (Request["ExceptionId"]!=null) pT.Title = LocRM.GetString("tExceptionsEditor"); else pT.Title = LocRM.GetString("tNewException"); }
private void Translation() { Assembly assembly = Assembly.Load("JeuxDuPendu"); ResourceManager rm = new ResourceManager("JeuxDuPendu.Langues.langres", assembly); this.Text = rm.GetString("fenetrePropos", dialogJoueur.ci); groupBox1.Text = rm.GetString("creerpar", dialogJoueur.ci); }
private void ApplyLocalization() { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Directory.Resources.strPageTitles", typeof(AddGroup).Assembly); if (Request["Edit"] == "1" ) pT.Title = LocRM.GetString("tAddGroup1"); else pT.Title = LocRM.GetString("tAddGroup2"); }
public void UpdateLanguage(ResourceManager man) { label2.Text = man.GetString("success"); button1.Text = man.GetString("copy2clipboard"); button2.Text = man.GetString("save2file"); label3.Text = man.GetString("smallPreview"); label1.Text = man.GetString("finalText"); }
// This method is consumed by load context tests public static string GetMessage() { var rm = new ResourceManager( "TestProjectWithCultureSpecificResource.Strings", typeof(Program).GetTypeInfo().Assembly); return rm.GetString("hello") + Environment.NewLine + rm.GetString("hello", new CultureInfo("fr")); }
private void ApplyLocalization() { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Tasks.Resources.strPageTitles", typeof(TaskEdit).Assembly); if(TID!=0) pT.Title = LocRM.GetString("tTaskEdit"); else pT.Title = LocRM.GetString("tTaskAdd"); }
private void ApplyLocalization() { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Documents.Resources.strDocuments", typeof(DocumentEdit).Assembly); if(DocumentId != 0) pT.Title = LocRM.GetString("tDocumentEdit"); else pT.Title = LocRM.GetString("tDocumentAdd"); }
private void ApplyLocalization() { ResourceManager LocRM = new ResourceManager("Mediachase.UI.Web.App_GlobalResources.Common.Resources.strPageTitles", typeof(CommentAdd1).Assembly); if(Request["DiscussionId"] != null) dT.Title = LocRM.GetString("tCommentEdit"); else dT.Title = LocRM.GetString("tCommentAdd"); }
private void configureLanguage() { ResourceManager recursos = new System.Resources.ResourceManager("E69IL2CoD.Properties.Resources", this.GetType().Assembly); CultureInfo cultura= new System.Globalization.CultureInfo(System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName.ToUpper()); this.Text = recursos.GetString("mainWindow", cultura); this.groupBoxSpeed.Text = recursos.GetString("groupSpeed", cultura); }
/// <summary> /// Sets a specified <paramref name="culture"/> to the current thread /// </summary> /// <param name="culture"></param> void SetCulture(CultureInfo culture) { ResourceManager rm = new ResourceManager("FileSplitterAndJoiner.Resources", typeof(FormPieceSizeDialog).Assembly); Thread.CurrentThread.CurrentUICulture = culture; btnOK.Text = rm.GetString("ok"); Text = rm.GetString("specify_piece_size"); }
internal static string Get(string id) { string str = _resourceManager.GetString(id); if (str == null) { str = _resourceManager.GetString("Unavailable"); } return(str); }
/// <summary> /// Type constructor. Initializes localized strings. /// </summary> static ProjectInfo() { ResourceManager resources = new System.Resources.ResourceManager("BuildAutoIncrement.Resources.Shared", typeof(ResourceAccessor).Assembly); Debug.Assert(resources != null); s_txtSaveErrorTitle = resources.GetString("Save Error"); s_txtCannotSaveFile = resources.GetString("Cannot save file"); Debug.Assert(s_txtSaveErrorTitle != null); Debug.Assert(s_txtCannotSaveFile != null); }
/// <summary> /// Clears all items in the <c>IList</c> and reloads the list with /// items according to language settings. /// </summary> /// <param name="controlName"> /// Name of the control. /// </param> /// <param name="list"> /// <c>IList</c> with items to change. /// </param> /// <param name="itemsNumber"> /// Number of items. /// </param> /// <param name="resources"> /// <c>ResourceManager</c> object. /// </param> private void ReloadItems(string controlName, IList list, int itemsNumber, System.Resources.ResourceManager resources) { string resourceName = controlName + ".Items.Items"; if (resources.GetString(resourceName, m_cultureInfo) == null) { return; } list.Clear(); list.Add(resources.GetString(resourceName, m_cultureInfo)); for (int i = 1; i < itemsNumber; i++) { list.Add(resources.GetString(resourceName + i, m_cultureInfo)); } }
/// <summary> /// Reads resource key and return relevant localized string value /// </summary> /// <param name="resourceSource">Type of the resource that contains the localized strings</param> /// <param name="culture">Culture name e.g. ar-SY</param> /// <param name="code">key name to look for</param> /// <param name="args"></param> /// <returns></returns> internal static LocalizedHtmlString GetValue(Type resourceSource, string culture, string code, params object[] args) { var _res = new System.Resources.ResourceManager(resourceSource); var cultureInfo = string.IsNullOrWhiteSpace(culture) ? CultureInfo.CurrentCulture : CultureInfo.GetCultureInfo(culture); bool _resourceNotFound; string _value; try { _value = _res.GetString(code, cultureInfo); _resourceNotFound = false; } catch (MissingSatelliteAssemblyException) { _resourceNotFound = true; _value = code; } catch (MissingManifestResourceException) { _resourceNotFound = true; _value = code; } return(args == null ? new LocalizedHtmlString(code, _value, _resourceNotFound) : new LocalizedHtmlString(code, _value, _resourceNotFound, args)); }
/// <summary>实现 IDTExtensibility2 接口的 OnConnection 方法。接收正在加载外接程序的通知。</summary> /// <param term='Application'>宿主应用程序的根对象。</param> /// <param term='ConnectMode'>描述外接程序的加载方式。</param> /// <param term='AddInInst'>表示此外接程序的对象。</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom) { applicationObject = (DTE2)Application; addInInstance = (AddIn)AddInInst; if (ConnectMode == ext_ConnectMode.ext_cm_UISetup) { object[] contextGUIDS = new object[] { }; Commands2 commands = (Commands2)applicationObject.Commands; try { CommandBar menuBarCommandBar; CommandBarControl toolsControl; CommandBarPopup toolsPopup; CommandBarControl commandBarControl; //将一个命令添加到 Commands 集合: Command command = commands.AddNamedCommand2(addInInstance, "PasteXmlAsLinq", "Paste XML as XElement", "Pastes the XML on the clipboard as C# Linq To Xml code", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton); String editMenuName; //查找 MenuBar 命令栏,该命令栏是容纳所有主菜单项的顶级命令栏: menuBarCommandBar = ((CommandBars)applicationObject.CommandBars)["MenuBar"]; try { // 此代码将获取区域性,将其追加到菜单项的名称中, // 然后将此命令添加到菜单中。您可以在以下文件中看到全部顶级菜单的列表: // CommandBar.resx. System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("PasteXmlAsLinq.CommandBar", System.Reflection.Assembly.GetExecutingAssembly()); System.Threading.Thread thread = System.Threading.Thread.CurrentThread; System.Globalization.CultureInfo cultureInfo = thread.CurrentUICulture; editMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Edit")); toolsControl = menuBarCommandBar.Controls["Edit"]; } catch (Exception) { // 我们尝试查找 Edit 一词的本地化版本,但未能找到。 // 默认值为 en-US 一词,该值可能适用于当前区域性。 toolsControl = menuBarCommandBar.Controls["Edit"]; } //将此命令置于“编辑”菜单上。 toolsPopup = (CommandBarPopup)toolsControl; int pasteControlIndex = 1; //查找“粘贴”控件,以便可在其后添加新的元素。 foreach (CommandBarControl commandBar in toolsPopup.CommandBar.Controls) { if (String.Compare(commandBar.Caption, "&Paste", StringComparison.OrdinalIgnoreCase) == 0) { pasteControlIndex = commandBar.Index + 1; break; } } //在 MenuBar 命令栏上查找相应的命令栏: commandBarControl = (CommandBarControl)command.AddControl(toolsPopup.CommandBar, pasteControlIndex); } catch (Exception) { } } }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='Application'>Root object of the host application.</param> /// <param term='ConnectMode'>Describes how the Add-in is being loaded.</param> /// <param term='AddInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom) { applicationObject = (DTE2)Application; addInInstance = (AddIn)AddInInst; if (ConnectMode == ext_ConnectMode.ext_cm_UISetup) { object[] contextGUIDS = new object[] { }; Commands2 commands = (Commands2)applicationObject.Commands; try { CommandBar menuBarCommandBar; CommandBarControl toolsControl; CommandBarPopup toolsPopup; CommandBarControl commandBarControl; //Add a command to the Commands collection: Command command = commands.AddNamedCommand2(addInInstance, "PasteXmlAsLinq", "Paste XML as XElement", "Pastes the XML on the clipboard as C# Linq To Xml code", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton); String editMenuName; //Find the MenuBar command bar, which is the top-level command bar holding all the main menu items: menuBarCommandBar = ((CommandBars)applicationObject.CommandBars)["MenuBar"]; try { // This code will take the culture, append on the name of the menuitem, // then add the command to the menu. You can find a list of all the top-level menus in the file // CommandBar.resx. System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("PasteXmlAsLinq.CommandBar", System.Reflection.Assembly.GetExecutingAssembly()); System.Threading.Thread thread = System.Threading.Thread.CurrentThread; System.Globalization.CultureInfo cultureInfo = thread.CurrentUICulture; editMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Edit")); toolsControl = menuBarCommandBar.Controls["Edit"]; } catch (Exception) { // We tried to find a localized version of the word Edit, but one was not found. // Default to the en-US word, which may work for the current culture. toolsControl = menuBarCommandBar.Controls["Edit"]; } //Place the command on the edit menu. toolsPopup = (CommandBarPopup)toolsControl; int pasteControlIndex = 1; //Find the paste control so that the new element can be added after it. foreach (CommandBarControl commandBar in toolsPopup.CommandBar.Controls) { if (String.Compare(commandBar.Caption, "&Paste", StringComparison.OrdinalIgnoreCase) == 0) { pasteControlIndex = commandBar.Index + 1; break; } } //Find the appropriate command bar on the MenuBar command bar: commandBarControl = (CommandBarControl)command.AddControl(toolsPopup.CommandBar, pasteControlIndex); } catch (Exception) { } } }
/// <summary> /// Recurs <c>Controls</c> members of the control to change /// corresponding texts. /// </summary> /// <param name="parent"> /// Parent <c>Control</c> object. /// </param> /// <param name="resources"> /// <c>ResourceManager</c> object. /// </param> private void RecurControls(System.Windows.Forms.Control parent, System.Resources.ResourceManager resources, System.Windows.Forms.ToolTip toolTip) { foreach (Control control in parent.Controls) { ReloadControlCommonProperties(control, resources); ReloadControlSpecificProperties(control, resources); if (toolTip != null) { toolTip.SetToolTip(control, resources.GetString(control.Name + ".ToolTip", m_cultureInfo)); } if (control is System.Windows.Forms.UserControl) { RecurUserControl((System.Windows.Forms.UserControl)control); } else { ReloadTextForSelectedControls(control, resources); ReloadListItems(control, resources); if (control is System.Windows.Forms.TreeView) { ReloadTreeViewNodes((System.Windows.Forms.TreeView)control, resources); } if (control.Controls.Count > 0) { RecurControls(control, resources, toolTip); } } } }
// Culture public static string GetMensagem(System.Globalization.CultureInfo ciMensagem, string strMensagem) { string strRetorno = ""; System.Resources.ResourceManager rmMensagens = null; switch (ciMensagem.Name) { case "en": rmMensagens = new System.Resources.ResourceManager("mdlMensagens.MensagensEn", System.Reflection.Assembly.GetExecutingAssembly()); break; default: rmMensagens = new System.Resources.ResourceManager("mdlMensagens.Mensagens", System.Reflection.Assembly.GetExecutingAssembly()); break; } strRetorno = rmMensagens.GetString(strMensagem, System.Globalization.CultureInfo.CurrentUICulture); if (strRetorno == null) { strRetorno = ""; } if (strRetorno == "") { strRetorno = "INDEFINIDO: Idioma: " + ciMensagem.Name + " MENSAGEM: " + strMensagem; } return(strRetorno); }
/// <summary>Реализация метода OnConnection интерфейса IDTExtensibility2. Получение уведомления о загрузке надстройки.</summary> /// <param term='Application'>Корневой объект ведущего приложения.</param> /// <param term='ConnectMode'>Описание способа загрузки надстройки.</param> /// <param term='AddInInst'>Объект, представляющий данную надстройку.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object Application, ext_ConnectMode ConnectMode, object AddInInst, ref Array custom) { applicationObject = (DTE2)Application; addInInstance = (AddIn)AddInInst; if (ConnectMode == ext_ConnectMode.ext_cm_UISetup) { object[] contextGUIDS = new object[] { }; Commands2 commands = (Commands2)applicationObject.Commands; try { CommandBar menuBarCommandBar; CommandBarControl toolsControl; CommandBarPopup toolsPopup; CommandBarControl commandBarControl; //Добавление команды в коллекцию Commands: Command command = commands.AddNamedCommand2(addInInstance, "PasteXmlAsLinq", "Paste XML as XElement", "Pastes the XML on the clipboard as C# Linq To Xml code", true, 59, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)vsCommandStyle.vsCommandStylePictAndText, vsCommandControlType.vsCommandControlTypeButton); String editMenuName; //Поиск панели команд верхнего уровня MenuBar, в которой содержатся все элементы главного меню: menuBarCommandBar = ((CommandBars)applicationObject.CommandBars)["MenuBar"]; try { // С помощью этого кода можно получить региональный язык и региональные параметры, добавить имя элемента меню, // а затем добавить команду в меню. Список всех меню верхнего уровня можно найти в файле // CommandBar.resx. System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("PasteXmlAsLinq.CommandBar", System.Reflection.Assembly.GetExecutingAssembly()); System.Threading.Thread thread = System.Threading.Thread.CurrentThread; System.Globalization.CultureInfo cultureInfo = thread.CurrentUICulture; editMenuName = resourceManager.GetString(String.Concat(cultureInfo.TwoLetterISOLanguageName, "Edit")); toolsControl = menuBarCommandBar.Controls["Edit"]; } catch (Exception) { // Мы пытаемся найти локализованную версию слова Edit, но безуспешно. // По умолчанию текст установлен в формат en-US, для используемого языка и региональных параметров этот вариант может оказаться приемлемым. toolsControl = menuBarCommandBar.Controls["Edit"]; } //Размещение команды в меню редактирования. toolsPopup = (CommandBarPopup)toolsControl; int pasteControlIndex = 1; //Поиск элемента управления вставкой для добавления после него нового элемента. foreach (CommandBarControl commandBar in toolsPopup.CommandBar.Controls) { if (String.Compare(commandBar.Caption, "&Paste", StringComparison.OrdinalIgnoreCase) == 0) { pasteControlIndex = commandBar.Index + 1; break; } } //Поиск подходящей панели команд на панели MenuBar: commandBarControl = (CommandBarControl)command.AddControl(toolsPopup.CommandBar, pasteControlIndex); } catch (Exception) { } } }
private static string GetSQLRes(string ResKey, object ParaObj) { string retval = string.Empty; if (resSQLMgr == null) { throw new NullReferenceException("Resources Not Exist"); } try { if ((object)(retval = resSQLMgr.GetString(ResKey)) == null) { retval = ""; } } catch (Exception) { throw new Exception("Localization.TranslateRes"); } if (ParaObj != null) { try { retval = string.Format(retval, (string[])ParaObj); } catch (Exception) { throw new ArgumentException("Paramter Absent"); } } return(retval); }
/// <summary> Returns a string representing the Ldap result code. The message /// is obtained from the locale specific ResultCodeMessage resource. /// /// </summary> /// <param name="code"> the result code /// /// </param> /// <param name="locale"> The Locale that should be used to pull message /// strings out of ResultMessages. /// /// </param> /// <returns> the String representing the result code. /// </returns> public static System.String getResultString(int code, System.Globalization.CultureInfo locale) { if (defaultResultCodes == null) { /* * defaultResultCodes = ResourceManager.CreateFileBasedResourceManager("ResultCodeMessages", "Resources", null);*/ defaultResultCodes = new ResourceManager("ResultCodeMessages", Assembly.GetExecutingAssembly()); } if (defaultLocale == null) { defaultLocale = Thread.CurrentThread.CurrentUICulture; } if (locale == null) { locale = defaultLocale; } string result; try { result = defaultResultCodes.GetString(Convert.ToString(code), defaultLocale); } catch (ArgumentNullException mre) { result = getMessage(ExceptionMessages.UNKNOWN_RESULT, new Object[] { code }, locale); } return(result); }
private void InitializeComponent() { this.text1 = new System.Windows.Forms.Label(); this.SuspendLayout(); string greeting = res.GetString("greeting"); // text1 this.text1.Dock = System.Windows.Forms.DockStyle.Top; this.text1.Location = new System.Drawing.Point(0, 0); this.text1.Name = "text1"; this.text1.Text = greeting + Func.func3(4).ToString(); this.text1.Size = new System.Drawing.Size(289, 369); this.text1.TabIndex = 0; /// text1 // FormFuni this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(200, 200); this.Controls.Add(this.text1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Name = "FormFuni"; this.Text = greeting; /// FormFuni this.ResumeLayout(false); }
/// <summary> /// 根据key值获取默认的资源中对应的value /// </summary> /// <param name="key">key值</param> /// <param name="defaultValue">当资源中不存在时返回的默认值</param> /// <returns></returns> public static string GetResourse(string key, string defaultValue = "") { try { return(_resourceManager.GetString(key)); } catch (Exception) { if (string.IsNullOrEmpty(defaultValue)) { return(""); } return(defaultValue); } }
/// <summary> /// Retrieve string resource according to the string name. /// </summary> /// <param name="resourceKey">string name</param> /// <returns>the value of <c>name</c> if successful, /// <c>name</c>, otherwise. /// </returns> public string GetString(string resourceKey) { string resourceValue = ""; try { resourceValue = resourceManager.GetString(resourceKey); if (resourceValue == null) { // if the resource not exist, retrieve the default value ResourceSet resourceSet = resourceManager.GetResourceSet(new CultureInfo("en"), true, false); resourceValue = resourceSet.GetString(resourceKey); } } catch (System.Exception) { resourceValue = resourceKey; } finally { if (resourceValue == null || resourceValue == "") { resourceValue = resourceKey; } } return(resourceValue); }
public static void checkLicenseFile() { System.Resources.ResourceManager rm = null; rm = new System.Resources.ResourceManager("QuestionannaireApp.Localization", Assembly.GetExecutingAssembly()); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Properties.Settings.Default.culture); using (IsolatedStorageFile isolatedStorageFile = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null)) { try { using (IsolatedStorageFileStream isolatedStorageFileStream = new IsolatedStorageFileStream("license.lic", System.IO.FileMode.Open, isolatedStorageFile)) { using (System.IO.StreamReader sr = new System.IO.StreamReader(isolatedStorageFileStream)) { var activated = LicenseCheck.isActivated(sr.ReadLine()); if (!activated) { MessageBox.Show(rm.GetString("activationExpired"), rm.GetString("activation"), MessageBoxButtons.OK); Properties.Settings.Default.block = true; } else { Properties.Settings.Default.block = false; } } } } catch { if (CheckForInternetConnection() == true && !isolatedStorageFile.FileExists("license.lic")) { License license = new License(); license.ShowDialog(); } else if (CheckForInternetConnection() == false && !isolatedStorageFile.FileExists("license.lic")) { Properties.Settings.Default.block = true; } else { Properties.Settings.Default.block = false; } } } }
private static string ReadResourceString(string rn) { ResourceManager rm = new System.Resources.ResourceManager( "WinSMTPTest.Resource", Assembly.GetExecutingAssembly() ); return(rm.GetString(rn)); }
private static string ReadResourceString(string rn) { ResourceManager rm = new System.Resources.ResourceManager( "Sgart.RegularExpression.Resource", Assembly.GetExecutingAssembly() ); return(rm.GetString(rn)); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); System.Resources.ResourceManager rm = null; rm = new System.Resources.ResourceManager("QuestionannaireApp.Localization", Assembly.GetExecutingAssembly()); System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Properties.Settings.Default.culture); ProgressBox progressBox = new ProgressBox(); License license = new License(); progressBox.Show(); checkLicenseFile(); string setupPath = Path.GetTempPath() + "questionnaireAppSetup.msi"; if (File.Exists(setupPath)) { File.Delete(setupPath); } UpdateManager updateManager = new UpdateManager(); if (updateManager.CheckConnection() == true) { if (updateManager.CheckUpdate() == true) { Process.Start(setupPath); Environment.Exit(0); } else { progressBox.Close(); Application.Run(new MainForm()); } } else { MessageBox.Show(rm.GetString("serverUnreachable"), rm.GetString("cantEstablish"), MessageBoxButtons.OK, MessageBoxIcon.Error); progressBox.Close(); Application.Run(new MainForm()); } }
private string[] CarregarFrases(System.Resources.ResourceManager rm) { List <string> textoLocal = new List <string>(); for (int i = 0; i < QTD_FRASES; i++) { textoLocal.Add(rm.GetString("TEXTO_" + i.ToString() + "_ARQUIVO_LPK").PadRight(TAM_MAX_FRASE, '\0')); } return(textoLocal.ToArray()); }
/// <summary>Gets the string from the resource files using specified name.</summary> /// <param name='name'>The unique name of the localized text.</param> /// <returns>The text from the resouce file that is associated with custom name.</returns> public string GetString(string name) { if (_rm != null) { return(_rm.GetString(name, _ci)); } else { throw new InvalidOperationException("The internal System.Resources.ResourceManager is null. Make sure that the CallingAssembly property has a valid reference to the assembly being localized prior to calling this method."); } }
private String GetBaseMessage( ErrorMessage errorMessage, CultureInfo currentCulture) { if (errorMessage.ResourceTypeName == null) { return(errorMessage.Message); } System.Resources.ResourceManager rm = GetResourceManager(errorMessage.ResourceTypeName); return(rm.GetString(errorMessage.Message, currentCulture)); }
public static String getString(String key) { try { return(_resourceManager.GetString(key, _resourceCulture)); } catch (MissingManifestResourceException e) { return('!' + key + '!'); } }
public static string getMsginThread(string skey, params string[] argv) { if (EcoLanguage.ass == null) { EcoLanguage.ass = System.Reflection.Assembly.GetExecutingAssembly(); } System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager("EcoSensors._Lang.LangRes", EcoLanguage.ass); string @string = resourceManager.GetString(skey, EcoLanguage._SelectedCulture); return(string.Format(@string, argv)); }
/// <summary> /// Localizes the specified resource key for the current MetasysClient locale or specified culture. /// </summary> /// <remarks> /// The resource parameter must be the key of a Metasys enumeration resource, /// otherwise no translation will be found. /// </remarks> /// <param name="resource">The key for the localization resource.</param> /// <param name="cultureInfo">Optional culture specification.</param> /// <returns> /// Localized string if the resource was found, the default en-US localized string if not found, /// or the resource parameter value if neither resource is found. /// </returns> public static string Localize(string resource, CultureInfo cultureInfo = null) { try { return(Resource.GetString(resource, cultureInfo)); } catch (MissingManifestResourceException) { try { // Fallback to en-US language if no resource found. return(Resource.GetString(resource, CultureEnUS)); } catch (MissingManifestResourceException) { // Just return resource placeholder when no translation found. return(resource); } } }
/// <summary> /// Opens the port passed in as a parameter. /// </summary> /// <param name="portName"> /// The communication port to open. /// </param> /// <exception cref="CommPortException"> /// Thrown when a port failure occurs. /// </exception> /// <example> /// <code> /// Communication comm = new Communication(); /// comm.OpenPort("COM4:"); /// </code> /// </example> /// Revision History /// MM/DD/YY who Version Issue# Description /// -------- --- ------- ------ --------------------------------------- /// 08/01/05 bdm 7.13.00 N/A Created public void OpenPort(string portName) { byte[] abytReadBuf = new Byte[m_uintRxBufSz]; string strDesc; try { //Only support one port at a time. if (m_SerialPort.IsOpen) { strDesc = string.Format(CultureInfo.CurrentCulture, m_rmStrings.GetString("PORT_ALREADY_OPEN")); throw (new Exception(strDesc)); } m_strPortName = portName; m_SerialPort.PortName = m_strPortName; //This must be performed after the Init() and before the Open(); SetupSerialPort(); // create the transmit and receive buffers m_abytRxBuf = new byte[m_uintRxBufSz]; m_abytTxBuf = new byte[m_uintTxBufSz]; m_SerialPort.Open(); //Allow the open port response to be received by the buffer and //then ReadExisting to remove any of the open port bytes received System.Threading.Thread.Sleep(100); m_SerialPort.ReadExisting(); m_uintRxBufIx = 0; } catch (Exception e) { strDesc = string.Format(CultureInfo.CurrentCulture, m_rmStrings.GetString("OPEN_PORT_FAILED"), e.Message); throw (new CommPortException(strDesc, e)); } }
public string GetText(string key, string baseName) { try { ResourceManager resourceManager = new System.Resources.ResourceManager(baseName, Assembly.GetExecutingAssembly()); return((resourceManager == null) ? "" : resourceManager.GetString(key)); } catch { return(""); } }
private void rmtcbLang_SelectedIndexChanged(object sender, System.EventArgs e) { int selectedIndex = this.rmtcbLang.SelectedIndex; EcoLanguage.ChangeLang(selectedIndex); System.Resources.ResourceManager resourceManager = new System.Resources.ResourceManager(base.GetType()); this.Text = resourceManager.GetString("$this.Text"); this.rmtlbSrvIP.Text = resourceManager.GetString("rmtlbSrvIP.Text"); this.rmtlbSrvPort.Text = resourceManager.GetString("rmtlbSrvPort.Text"); this.rmtlbusrnm.Text = resourceManager.GetString("label8.Text"); this.rmtlbpsw.Text = resourceManager.GetString("label7.Text"); this.rmtlbLang.Text = resourceManager.GetString("label6.Text"); this.rmtbutLogin.Text = resourceManager.GetString("butlogin.Text"); this.rmtbutcancel.Text = resourceManager.GetString("butcancel.Text"); }
public static string GetMessage(string messageid, params string[] values) { string message = ""; ResourceManager rm = new System.Resources.ResourceManager("Com.GainWinSoft.Common.Resources.Message", Assembly.GetExecutingAssembly()); message = rm.GetString(messageid); for (int i = 0; i < values.Length; i++) { message = message.Replace("%" + (i + 1), values[i]); } return(message); }
/// <summary> /// Changes <c>Text</c> properties associated with following /// controls: <c>AxHost</c>, <c>ButtonBase</c>, <c>GroupBox</c>, /// <c>Label</c>, <c>ScrollableControl</c>, <c>StatusBar</c>, /// <c>TabControl</c>, <c>ToolBar</c>. Method is made virtual so it /// can be overriden in derived class to redefine types. /// </summary> /// <param name="parent"> /// <c>Control</c> object. /// </param> /// <param name="resources"> /// <c>ResourceManager</c> object. /// </param> protected virtual void ReloadTextForSelectedControls(System.Windows.Forms.Control control, System.Resources.ResourceManager resources) { if (control is System.Windows.Forms.AxHost || control is System.Windows.Forms.ButtonBase || control is System.Windows.Forms.GroupBox || control is System.Windows.Forms.Label || control is System.Windows.Forms.ScrollableControl || control is System.Windows.Forms.StatusBar || control is System.Windows.Forms.TabControl || control is System.Windows.Forms.ToolBar) { control.Text = resources.GetString(control.Name + ".Text", m_cultureInfo); } }
//Create the Nodes and add into the DiagramModel private Node addNode(String name, double width, double height, double offsetx, double offsety, Shapes shape, String content, string fill) { Node node = new Node(); node.Width = width; node.Height = height; node.OffsetX = offsetx; node.OffsetY = offsety; node.Shape = shape; node.Label = manager.GetString(content); node.LabelForeground = new SolidColorBrush(Colors.White); node.LabelTextWrapping = TextWrapping.Wrap; node.LabelWidth = 98; node.LabelTextAlignment = TextAlignment.Center; node.LabelVerticalTextAlignment = VerticalAlignment.Center; node.LabelHorizontalTextAlignment = HorizontalAlignment.Center; node.CustomPathStyle = Getstyle(fill); //Add the node into DiagramModel diagramModel.Nodes.Add(node); return(node); }