本文整理汇总了C#中System.Resources.ResourceManager.ReleaseAllResources方法的典型用法代码示例。如果您正苦于以下问题:C# System.Resources.ResourceManager.ReleaseAllResources方法的具体用法?C# System.Resources.ResourceManager.ReleaseAllResources怎么用?C# System.Resources.ResourceManager.ReleaseAllResources使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Resources.ResourceManager
的用法示例。
在下文中一共展示了System.Resources.ResourceManager.ReleaseAllResources方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Exists
public static bool Exists(string path)
{
if (string.IsNullOrEmpty(path) || path.Length <= _resourceFilePrefix.Length)
return false;
path = path.Substring(_resourceFilePrefix.Length).ToLower();
if(_resourcePath==null)
{
_resourcePath = new Dictionary<string, string>();
var culture = System.Threading.Thread.CurrentThread.CurrentCulture;
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var resourceName = assembly.GetName().Name + ".g";
var resourceManager = new System.Resources.ResourceManager(resourceName, assembly);
try
{
var resourceSet = resourceManager.GetResourceSet(culture, true, true);
foreach (System.Collections.DictionaryEntry resource in resourceSet)
{
_resourcePath.Add(resource.Key.ToString(), "");
}
}
finally
{
resourceManager.ReleaseAllResources();
}
}
return _resourcePath.ContainsKey(path);
}
示例2: OnPageShown
public override void OnPageShown()
{
if (Settings.RunningOnWindows())
{
System.Resources.ResourceManager rm =
new System.Resources.ResourceManager("GitUI.Properties.Resources",
System.Reflection.Assembly.GetExecutingAssembly());
// dummy request; for some strange reason the ResourceSets are not loaded untill after the first object request... bug?
rm.GetObject("dummy");
System.Resources.ResourceSet resourceSet = rm.GetResourceSet(System.Globalization.CultureInfo.CurrentUICulture, true, true);
contextMenuStrip_SplitButton.Items.Clear();
foreach (System.Collections.DictionaryEntry icon in resourceSet)
{
//add entry to toolstrip
if (icon.Value.GetType() == typeof(Icon))
{
//contextMenuStrip_SplitButton.Items.Add(icon.Key.ToString(), (Image)((Icon)icon.Value).ToBitmap(), SplitButtonMenuItem_Click);
}
else if (icon.Value.GetType() == typeof(Bitmap))
{
contextMenuStrip_SplitButton.Items.Add(icon.Key.ToString(), (Image)icon.Value, SplitButtonMenuItem_Click);
}
//var aa = icon.Value.GetType();
}
resourceSet.Close();
rm.ReleaseAllResources();
}
}
示例3: GetImage
private string GetImage()
{
System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
System.Globalization.CultureInfo culture = Thread.CurrentThread.CurrentCulture;
string resourceName = asm.GetName().Name + ".g";
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(resourceName, asm);
System.Resources.ResourceSet resourceSet = rm.GetResourceSet(culture, true, true);
List<string> resources = new List<string>();
foreach (DictionaryEntry resource in resourceSet)
{
if(((string)resource.Key).StartsWith("images/splash%20screens/"))
resources.Add((string)resource.Key);
}
rm.ReleaseAllResources();
Random r = new Random();
int i = r.Next(0, resources.Count());
return resources[i];
}