| 123456789101112131415161718192021222324252627 |
- using System.Windows;
- namespace Muchinfo.PC.Common.Helpers
- {
- public class ResourceHelper
- {
- /// <summary>
- /// 获取系统资源
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="resourceName">Name of the resource.</param>
- /// <returns>``0.</returns>
- public static T GetFromeResource<T>(string resourceName) where T : class
- {
- try
- {
- var brush = (T)Application.Current.TryFindResource(resourceName);
- if (brush == null) return default(T);
- return brush;
- }
- catch
- {
- return null;
- }
- }
- }
- }
|