• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Resources.ResourceManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



ResourceManager类属于System.Resources命名空间,在下文中一共展示了ResourceManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

		/// <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;
        }
开发者ID:giapdangle,项目名称:Gurux.Device,代码行数:29,代码来源:GXToolboxItemAttribute.cs


示例2: InitializeComponent

 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
         System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Splash));
         this.pictureBox1 = new System.Windows.Forms.PictureBox();
         this.timer1 = new System.Windows.Forms.Timer(this.components);
         this.SuspendLayout();
         //
         // pictureBox1
         //
         this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
         this.pictureBox1.Image = ((System.Drawing.Bitmap)(resources.GetObject("pictureBox1.Image")));
         this.pictureBox1.Name = "pictureBox1";
         this.pictureBox1.Size = new System.Drawing.Size(632, 416);
         this.pictureBox1.TabIndex = 0;
         this.pictureBox1.TabStop = false;
         //
         // Splash
         //
         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(632, 416);
         this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                       this.pictureBox1});
         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
         this.Name = "Splash";
         this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
         this.Text = "Splash";
         this.ResumeLayout(false);
 }
开发者ID:mymindleaks,项目名称:dX---discover-and-eXplore,代码行数:33,代码来源:Splash.cs


示例3: ResourceManagerWithCultureStringLocalizer

        /// <summary>
        /// Creates a new <see cref="ResourceManagerWithCultureStringLocalizer"/>.
        /// </summary>
        /// <param name="resourceManager">The <see cref="System.Resources.ResourceManager"/> to read strings from.</param>
        /// <param name="resourceAssembly">The <see cref="Assembly"/> that contains the strings as embedded resources.</param>
        /// <param name="baseName">The base name of the embedded resource in the <see cref="Assembly"/> that contains the strings.</param>
        /// <param name="resourceNamesCache">Cache of the list of strings for a given resource assembly name.</param>
        /// <param name="culture">The specific <see cref="CultureInfo"/> to use.</param>
        public ResourceManagerWithCultureStringLocalizer(
            ResourceManager resourceManager,
            Assembly resourceAssembly,
            string baseName,
            IResourceNamesCache resourceNamesCache,
            CultureInfo culture)
            : base(resourceManager, resourceAssembly, baseName, resourceNamesCache)
        {
            if (resourceManager == null)
            {
                throw new ArgumentNullException(nameof(resourceManager));
            }

            if (resourceAssembly == null)
            {
                throw new ArgumentNullException(nameof(resourceAssembly));
            }

            if (baseName == null)
            {
                throw new ArgumentNullException(nameof(baseName));
            }

            if (resourceNamesCache == null)
            {
                throw new ArgumentNullException(nameof(resourceNamesCache));
            }

            if (culture == null)
            {
                throw new ArgumentNullException(nameof(culture));
            }

            _culture = culture;
        }
开发者ID:leloulight,项目名称:Localization,代码行数:43,代码来源:ResourceManagerWithCultureStringLocalizer.cs


示例4: LocalizableResourceString

        /// <summary>
        /// Creates a localizable resource string that may possibly be formatted differently depending on culture.
        /// </summary>
        /// <param name="nameOfLocalizableResource">nameof the resource that needs to be localized.</param>
        /// <param name="resourceManager"><see cref="ResourceManager"/> for the calling assembly.</param>
        /// <param name="resourceSource">Type handling assembly's resource management. Typically, this is the static class generated for the resources file from which resources are accessed.</param>
        /// <param name="formatArguments">Optional arguments for formatting the localizable resource string.</param>
        public LocalizableResourceString(string nameOfLocalizableResource, ResourceManager resourceManager, Type resourceSource, params string[] formatArguments)
        {
            if (nameOfLocalizableResource == null)
            {
                throw new ArgumentNullException(nameof(nameOfLocalizableResource));
            }

            if (resourceManager == null)
            {
                throw new ArgumentNullException(nameof(resourceManager));
            }

            if (resourceSource == null)
            {
                throw new ArgumentNullException(nameof(resourceSource));
            }

            if (formatArguments == null)
            {
                throw new ArgumentNullException(nameof(formatArguments));
            }

            _resourceManager = resourceManager;
            _nameOfLocalizableResource = nameOfLocalizableResource;
            _resourceSource = resourceSource;
            _formatArguments = formatArguments;
        }
开发者ID:GloryChou,项目名称:roslyn,代码行数:34,代码来源:LocalizableResourceString.cs


示例5: ResourceManagerSingleton

 static ResourceManagerSingleton()
 {
     try
     {
         try
         {
             ResourceManager = new ResourceManager("Brettle.Web.NeatUpload.Strings",
                                                   System.Reflection.Assembly.GetExecutingAssembly());
             // Force an exception if the resources aren't there because...
             ResourceManager.GetString("UploadTooLargeMessageFormat");
         }
         catch (MissingManifestResourceException)
         {
             // ...the namespace qualifier was not used until VS2005, and the assembly might have been built
             // with VS2003.
             ResourceManager = new ResourceManager("NeatUpload.Strings",
                                                   System.Reflection.Assembly.GetExecutingAssembly());
             ResourceManager.GetString("UploadTooLargeMessageFormat");
         }
     }
     catch (System.Security.SecurityException)
     {
         // This happens when running with medium trust outside the GAC under .NET 2.0, because
         // NeatUpload is compiled against .NET 1.1.  In that environment we almost never need the
         // ResourceManager so we set it to null which will cause GetResourceString() to return a
         // message indicating what the developer needs to do.
         ResourceManager = null;
     }
 }
开发者ID:abdul-baten,项目名称:hbcms,代码行数:29,代码来源:ResourceManagerSingleton.cs


示例6: OSMEditorToolbar

        public OSMEditorToolbar()
        {
            resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.Editor.OSMFeatureInspectorStrings", this.GetType().Assembly);

            AddItem("{93e976c7-b3a2-4b0f-a575-6626358614e3}");
            //BeginGroup(); //Separator
        }
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:7,代码来源:OSMEditorToolbar.cs


示例7: ResourceManagerStringLocalizer

        /// <summary>
        /// Intended for testing purposes only.
        /// </summary>
        public ResourceManagerStringLocalizer(
            ResourceManager resourceManager,
            AssemblyWrapper resourceAssemblyWrapper,
            string baseName,
            IResourceNamesCache resourceNamesCache)
        {
            if (resourceManager == null)
            {
                throw new ArgumentNullException(nameof(resourceManager));
            }

            if (resourceAssemblyWrapper == null)
            {
                throw new ArgumentNullException(nameof(resourceAssemblyWrapper));
            }

            if (baseName == null)
            {
                throw new ArgumentNullException(nameof(baseName));
            }

            if (resourceNamesCache == null)
            {
                throw new ArgumentNullException(nameof(resourceNamesCache));
            }

            _resourceAssemblyWrapper = resourceAssemblyWrapper;
            _resourceManager = resourceManager;
            _resourceBaseName = baseName;
            _resourceNamesCache = resourceNamesCache;
        }
开发者ID:mikemiera,项目名称:Localization,代码行数:34,代码来源:ResourceManagerStringLocalizer.cs


示例8: ToLocalizedString

        public static string ToLocalizedString(this Question question)
        {
            Requires.NotNull(question, "question");

            var resourceManager = new ResourceManager(typeof(Questions));
            return resourceManager.GetString(question.Key.ToString());
        }
开发者ID:marijngiesen,项目名称:qoam,代码行数:7,代码来源:QuestionExtensions.cs


示例9: OSMGPMultiLoader

        public OSMGPMultiLoader()
        {
            osmGPFactory = new OSMGPFactory();
            resourceManager = new ResourceManager("ESRI.ArcGIS.OSM.GeoProcessing.OSMGPToolsStrings", this.GetType().Assembly);

            m_editorConfigurationSettings = OSMGPFactory.ReadOSMEditorSettings();
        }
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:7,代码来源:OSMGPMultiLoader.cs


示例10: DoSomething

        /// <summary>
        /// Do something with input, and give back some output...
        /// </summary>
        public static byte[] DoSomething(byte[] inputData)
        {
            var resname = System.Text.Encoding.UTF8.GetString(inputData);
            var rm = new ResourceManager("JNABridge.DataAdapter.Properties.Resources", typeof(Logic).Assembly);

            return (byte[]) rm.GetObject(resname);
        }
开发者ID:myagincourt,项目名称:JNABridge,代码行数:10,代码来源:Logic.cs


示例11: MessageBoxExManager

		static MessageBoxExManager()
		{
			try
			{
				//Assembly current = typeof(MessageBoxExManager).Assembly;
				//string[] resources = current.GetManifestResourceNames();
				ResourceManager rm = new ResourceManager("Utils.MessageBoxExLib.Resources.StandardButtonsText", typeof(MessageBoxExManager).Assembly);
				s_standardButtonsText[MessageBoxExButtons.OK.ToString()] = rm.GetString("Ok");
				s_standardButtonsText[MessageBoxExButtons.Cancel.ToString()] = rm.GetString("Cancel");
				s_standardButtonsText[MessageBoxExButtons.Yes.ToString()] = rm.GetString("Yes");
				s_standardButtonsText[MessageBoxExButtons.No.ToString()] = rm.GetString("No");
				s_standardButtonsText[MessageBoxExButtons.Abort.ToString()] = rm.GetString("Abort");
				s_standardButtonsText[MessageBoxExButtons.Retry.ToString()] = rm.GetString("Retry");
				s_standardButtonsText[MessageBoxExButtons.Ignore.ToString()] = rm.GetString("Ignore");
			}
			catch(Exception ex)
			{
				System.Diagnostics.Debug.Assert(false, "Unable to load resources for MessageBoxEx", ex.ToString());

				//Load default resources
				s_standardButtonsText[MessageBoxExButtons.OK.ToString()] = "OK";
				s_standardButtonsText[MessageBoxExButtons.Cancel.ToString()] = "Cancel";
				s_standardButtonsText[MessageBoxExButtons.Yes.ToString()] = "Yes";
				s_standardButtonsText[MessageBoxExButtons.No.ToString()] = "No";
				s_standardButtonsText[MessageBoxExButtons.Abort.ToString()] = "Abort";
				s_standardButtonsText[MessageBoxExButtons.Retry.ToString()] = "Retry";
				s_standardButtonsText[MessageBoxExButtons.Ignore.ToString()] = "Ignore";
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:29,代码来源:MessageBoxExManager.cs


示例12: BindTabs

        private void BindTabs()
        {
            ResourceManager LocRM = new ResourceManager("Mediachase.Ibn.WebResources.App_GlobalResources.Admin.Resources.strDefault", Assembly.Load(new AssemblyName("Mediachase.Ibn.WebResources")));

            UserLightPropertyCollection pc;
            pc = Security.CurrentUser.Properties;

            if (Tab != null)
            {
                if (Tab == "PortalSetup" || Tab == "Dictionaries" || Tab == "RoutingWorkflow"
                    || Tab == "Customization" || Tab == "Reports" || Tab == "BusinessData"
                    || Tab == "CommonSettings" || Tab == "HelpDesk" || Tab == "FilesForms"
                    || Tab == "AddTools")
                    pc["Admin_CurrentTab"] = Tab;
            }
            else if (pc["Admin_CurrentTab"] == null)
                pc["Admin_CurrentTab"] = "PortalSetup";

            string controlName = "~/admin/modules/default.ascx";
            if (pc["Admin_CurrentTab"] == "Reports")
            {
                controlName = "~/admin/modules/AdminReports.ascx";
                ((Mediachase.UI.Web.Modules.PageTemplateNew)this.Parent.Parent.Parent.Parent).Title = LocRM.GetString("tReport");
            }

            System.Web.UI.UserControl control = (System.Web.UI.UserControl)LoadControl(controlName);
            phItems.Controls.Add(control);
        }
开发者ID:0anion0,项目名称:IBN,代码行数:28,代码来源:DefaultAdmin.ascx.cs


示例13: OnStartup

        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;
            }
        }
开发者ID:Tadwork,项目名称:Dynamo,代码行数:60,代码来源:DynamoRevit.cs


示例14: LocalizedEnumConverter

        /// <summary>
        /// Create a new instance of the converter using translations from the given resource manager
        /// </summary>
        /// <param name="enumType"></param>
        public LocalizedEnumConverter(Type enumType)
            : base(enumType)
        {
            Assembly assembly = enumType.Assembly;
            string resourceBaseName = string.Format(CultureInfo.InvariantCulture, "{0}.Properties.Resources", assembly.GetName().Name);
            m_ResourceManager = assembly.GetManifestResourceNames().Any(o => o.StartsWith(resourceBaseName))
                ? new ResourceManager(resourceBaseName, enumType.Assembly)
                : null;

            m_LookupTable = new Dictionary<string, object>();
            ICollection standardValues = GetStandardValues();
            if (standardValues != null)
            {
                foreach (object value in standardValues)
                {
                    string text = GetLocalizedValueText(value, CultureInfo.CurrentCulture);
                    if (text != null)
                    {
                        m_LookupTable.Add(text, value);
                    }
                }
            }
            if (enumType.GetCustomAttributes(typeof(FlagsAttribute), true).Length <= 0)
            {
                return;
            }
            m_IsFlagEnum = true;
            m_FlagValues = Enum.GetValues(enumType);
        }
开发者ID:jandppw,项目名称:ppwcode-recovered-from-google-code,代码行数:33,代码来源:LocalizedEnumConverter.cs


示例15: frmConnecting

        //***********************************************************
        //
        // Method:		Constructor
        // Purpose:		Initializes member variables.
        //
        //************************************************************/
        internal frmConnecting(frmAlfrescoSetUp oSetup)
        {
            m_oSetup = oSetup;

            oRM = new ResourceManager("frmWait", System.Reflection.Assembly.GetExecutingAssembly());
            InitializeComponent();
        }
开发者ID:svenauhagen,项目名称:alfresco,代码行数:13,代码来源:frmConnecting.cs


示例16: SR

        internal SR() {
#if FX_ATLEAST_45
            resources = new System.Resources.ResourceManager("FSharp.LanguageService.Base.Microsoft.VisualStudio.Package.LanguageService", this.GetType().Assembly);
#else
            resources = new System.Resources.ResourceManager("Microsoft.VisualStudio.Package.LanguageService", this.GetType().Assembly);
#endif
        }
开发者ID:CaptainHayashi,项目名称:visualfsharp,代码行数:7,代码来源:Microsoft.VisualStudio.Package.LanguageService.cs


示例17: Main

        public Main()
        {
            _locale = new ResourceManager("VectorDrawing_WinForm_.Resources.Locale", typeof(Main).Assembly);

            InitializeComponent();

            _data = new XData
            {
                Color = Color.Black,
                LineWidth = 1,
                Type = "Rectangle"
            };

            tsmi_language.Items.AddRange(new object[] { "English", "Русский", "Українська" });
            tsmi_language.SelectedIndex = 0;

            tsmi_theme.Items.AddRange(new object[] { "Gray", "Blue", "Dark" });
            tsmi_theme.SelectedIndex = 0;

            ttcmbx_color.Items.AddRange(new object[] { "Black", "Green", "Red" });
            ttcmbx_width.Items.AddRange(new object[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" });
            ttcmd_type.Items.AddRange(new object[] { "Rectangle", "Ellipse", "Line" });

            ttcmbx_tabs.Items.AddRange(new object[] {"1", "2"});

            cmbx_color.DataSource = new List<string> { "Black", "Green", "Red" };
            cmbx_type.DataSource = new List<string> { "Rectangle", "Ellipse", "Line" };

            cmbx_color.SelectedIndexChanged += cmbx_SelectedIndexChanged;
            cmbx_type.SelectedIndexChanged += cmbx_SelectedIndexChanged;

            SetValue();
        }
开发者ID:RomanGolovko,项目名称:Valtech_,代码行数:33,代码来源:Form1.cs


示例18: ResourceContentManager

 public ResourceContentManager(IServiceProvider servicesProvider, ResourceManager resource)
   : base(servicesProvider)
 {
   if (resource == null)
     throw new ArgumentNullException("resource");
   this.resource = resource;
 }
开发者ID:Zeludon,项目名称:FEZ,代码行数:7,代码来源:ResourceContentManager.cs


示例19: LoadSchema

        protected void LoadSchema(int version)
        {
            if (version < 1) return;

              MySQLMembershipProvider provider = new MySQLMembershipProvider();

              ResourceManager r = new ResourceManager("MySql.Web.Properties.Resources", typeof(MySQLMembershipProvider).Assembly);
              string schema = r.GetString(String.Format("schema{0}", version));
              MySqlScript script = new MySqlScript(conn);
              script.Query = schema;

              try
              {
            script.Execute();
              }
              catch (MySqlException ex)
              {
            if (ex.Number == 1050 && version == 7)
            {
              // Schema7 performs several renames of tables to their lowercase representation.
              // If the current server OS does not support renaming to lowercase, then let's just continue.
              script.Query = "UPDATE my_aspnet_schemaversion SET version=7";
              script.Execute();
            }
              }
        }
开发者ID:schivei,项目名称:mysql-connector-net,代码行数:26,代码来源:BaseTest.cs


示例20: Initialize

        /// <summary>
        /// Initializes the localization of the plugin
        /// </summary>
        public static void Initialize(LocaleVersion locale)
        {
            String path = "LibraryDepot.Resources." + locale.ToString();
            resources = new ResourceManager(path, Assembly.GetExecutingAssembly());

            //String __path = "ProjectManager.Resources." + locale.ToString();
        }
开发者ID:solarbluseth,项目名称:thecodingfrog,代码行数:10,代码来源:LocaleHelper.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Resources.ResourceReader类代码示例发布时间:2022-05-26
下一篇:
C# Resources.ResXResourceWriter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap