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


C# ResourceManager.ReleaseAllResources方法代码示例

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


在下文中一共展示了ResourceManager.ReleaseAllResources方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: load_images

        public void load_images()
        {
            List<string> resource_paths = new List<string>();
            var assembly = Assembly.GetExecutingAssembly();
            var buffer = new ResourceManager(assembly.GetName().Name + ".g", assembly);
            try
            {
                var list = buffer.GetResourceSet(CultureInfo.CurrentCulture, true, true);
                foreach (DictionaryEntry item in list)
                {
                    resource_paths.Add((string)item.Key);
                }
            }
            finally
            {
                buffer.ReleaseAllResources();
            }

            all_images = new List<photo>();
            foreach (string current_path in resource_paths)
            {
                if (current_path.Contains(".jpg"))
                {
                    BitmapImage another_image = new BitmapImage(new Uri(@"/" + current_path, UriKind.Relative));
                    all_images.Add(new photo(another_image));
                }
            }

            faces_combo_box.ItemsSource = all_images;
            faces_combo_box.SelectedItem = faces_combo_box.Items[0];
        }
开发者ID:Saroko-dnd,项目名称:My_DZ,代码行数:31,代码来源:change_image_window.xaml.cs

示例2: Window1

        public Window1()
        {
            InitializeComponent();

            drawing = new Drawing(canvas1);
            Assembly asm = typeof(Window1).Assembly;
            string resourceName = asm.GetName().Name + ".g";
            ResourceManager rm = new ResourceManager(resourceName, asm);
            ResourceSet resourceSet = rm.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true);
            List<string> resources = new List<string>();
            foreach (DictionaryEntry resource in resourceSet)
            {
                Debug.WriteLine(resource.Key);
            }
            rm.ReleaseAllResources();

            toolBar1.ItemsSource = Behavior.Singletons;
        }
开发者ID:wcatykid,项目名称:GeoShader,代码行数:18,代码来源:Window1.xaml.cs

示例3: GetResourcePaths

		public static IEnumerable<object> GetResourcePaths(Assembly assembly)
		{
			var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
            var resourceName = new System.Reflection.AssemblyName(assembly.FullName).Name + ".g";
			var resourceManager = new ResourceManager(resourceName, assembly);

			try
			{
				var resourceSet = resourceManager.GetResourceSet(culture, true, true);

				foreach (System.Collections.DictionaryEntry resource in resourceSet)
				{
					yield return resource.Key;
				}
			}
			finally
			{
				resourceManager.ReleaseAllResources();
			}
		}
开发者ID:netintellect,项目名称:PluralsightSpaJumpStartFinal,代码行数:20,代码来源:ResourceToStreamHelper.cs

示例4: GetResourcePaths

        /// <summary>Enumerates all resource keys within this assembly.</summary>
        /// <returns>Collection of keys.</returns>
        private static IEnumerable<object> GetResourcePaths()
        {
            var currentAssembly = Assembly.GetExecutingAssembly();

            var culture = Thread.CurrentThread.CurrentCulture;
            var resourceName = currentAssembly.GetName().Name + ".g";
            var resourceManager = new ResourceManager(resourceName, currentAssembly);

            try
            {
                var resourceSet = resourceManager.GetResourceSet(culture, true, true);

                foreach (DictionaryEntry resource in resourceSet)
                {
                    yield return resource.Key;
                }
            }
            finally
            {
                resourceManager.ReleaseAllResources();
            }
        }
开发者ID:tu-tran,项目名称:SubSearch,代码行数:24,代码来源:ResourceExtensions.cs

示例5: GetStrInRes

 public static string GetStrInRes(string resdata, string resname)
 {
     ResourceManager resourceManager = new ResourceManager(resname, Form1.asm);
     string result = (string)resourceManager.GetObject(resdata);
     resourceManager.ReleaseAllResources();
     return result;
 }
开发者ID:destnity,项目名称:DNPDeobfuscator,代码行数:7,代码来源:StrDec.cs

示例6: GetStream_Name_Null

		public void GetStream_Name_Null ()
		{
			ResourceManager rm = new ResourceManager (typeof (string));
			try {
				rm.GetStream ((string) null);
				Assert.Fail ("#A1");
			} catch (ArgumentNullException ex) {
				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
				Assert.IsNull (ex.InnerException, "#A3");
				Assert.IsNotNull (ex.Message, "#A4");
				Assert.IsNotNull (ex.ParamName, "#A5");
				Assert.AreEqual ("name", ex.ParamName, "#A6");
			}

			try {
				rm.GetStream ((string) null, CultureInfo.InvariantCulture);
				Assert.Fail ("#A1");
			} catch (ArgumentNullException ex) {
				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#A2");
				Assert.IsNull (ex.InnerException, "#A3");
				Assert.IsNotNull (ex.Message, "#A4");
				Assert.IsNotNull (ex.ParamName, "#A5");
				Assert.AreEqual ("name", ex.ParamName, "#A6");
			}
			rm.ReleaseAllResources ();
		}
开发者ID:sjlangley,项目名称:mono,代码行数:26,代码来源:ResourceManagerTest.cs

示例7: GetResourceSet_Culture_Null

		public void GetResourceSet_Culture_Null ()
		{
			ResourceManager rm = new ResourceManager (typeof (string));
			try {
				rm.GetResourceSet ((CultureInfo) null, false, false);
				Assert.Fail ("#1");
			} catch (ArgumentNullException ex) {
				Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
				Assert.IsNull (ex.InnerException, "#3");
				Assert.IsNotNull (ex.Message, "#4");
				Assert.IsNotNull (ex.ParamName, "#5");
				Assert.AreEqual ("culture", ex.ParamName, "#6");
			}
			rm.ReleaseAllResources ();
		}
开发者ID:sjlangley,项目名称:mono,代码行数:15,代码来源:ResourceManagerTest.cs

示例8: LoadMessages

		/// -----------------------------------------------------------------------------------
		/// <summary>
		/// Loads the resource strings.
		/// </summary>
		/// -----------------------------------------------------------------------------------
		private void LoadMessages()
		{
			string resID = "SIL.WordWorks.GAFAWS.PositionAnalysis.StringsResource";
			ResourceManager LocRM = new ResourceManager(resID, this.GetType().Assembly);

			string stid = "kstidBadPrefixes";
			m_messages.Add(stid, LocRM.GetString(stid));
			stid = "kstidBadSuffixes";
			m_messages.Add(stid, LocRM.GetString(stid));

			LocRM.ReleaseAllResources();
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:17,代码来源:PositionAnalyzer.cs

示例9: CheckDefaultLanguageFile

 private static void CheckDefaultLanguageFile()
 {
     string defaultLanguageFile =
         Path.Combine(LanguageFolder, "language_zh-Hans.xml");
     if(!File.Exists(defaultLanguageFile))
     {
         ResourceManager manager =
             new ResourceManager("DevTools.Language.Resource",
                                 typeof(LanguageManager).Assembly);
         using (StreamWriter writer =
                new StreamWriter(defaultLanguageFile, false, Encoding.UTF8))
         {
             writer.Write(manager.GetString("language_zh-Hans"));
         }
         manager.ReleaseAllResources();
     }
 }
开发者ID:MuteG,项目名称:DevTools,代码行数:17,代码来源:LanguageManager.cs


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