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


C# Resources.ResourceManager类代码示例

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


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


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