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


C# System.Resources.ResourceManager.ReleaseAllResources方法代码示例

本文整理汇总了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);
        }
开发者ID:SpiderLoveFish,项目名称:GB_Order,代码行数:28,代码来源:ResourceFile.cs

示例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();
            }
        }
开发者ID:dmay,项目名称:gitextensions,代码行数:33,代码来源:ScriptsSettingsPage.cs

示例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];
 }
开发者ID:Kayomani,项目名称:FAP,代码行数:18,代码来源:App.xaml.cs


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