ResourceHelper.cs 646 B

12345678910111213141516171819202122232425
  1. using System.Windows;
  2. namespace Muchinfo.MTPClient.Data.Helper
  3. {
  4. internal class ResourceHelper
  5. {
  6. /// <summary>
  7. /// Gets the from resource.
  8. /// </summary>
  9. /// <typeparam name="T"></typeparam>
  10. /// <param name="resourceName">Name of the resource.</param>
  11. /// <returns>``0.</returns>
  12. internal static T GetFromResource<T>(string resourceName) where T : class
  13. {
  14. try
  15. {
  16. return (T)Application.Current.TryFindResource(resourceName);
  17. }
  18. catch
  19. {
  20. return null;
  21. }
  22. }
  23. }
  24. }