本文整理汇总了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];
}
示例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;
}
示例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();
}
}
示例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();
}
}
示例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;
}
示例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 ();
}
示例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 ();
}
示例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();
}
示例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();
}
}