ImageHelper.cs 561 B

1234567891011121314151617181920212223
  1. using System;
  2. using System.Windows.Media.Imaging;
  3. namespace MuchInfo.Chart.Infrastructure.Helpers
  4. {
  5. public class ImageHelper
  6. {
  7. public static BitmapImage GetImage(string imageName)
  8. {
  9. try
  10. {
  11. var uri = new Uri("pack://application:,,,/MuchInfo.Chart.Infrastructure;component/Images/" + imageName);
  12. var bitmapImage = new BitmapImage(uri);
  13. return bitmapImage;
  14. }
  15. catch
  16. {
  17. return null;
  18. }
  19. }
  20. }
  21. }