ARUP.IssueTracker.Revit.Entry.AppMain.LoadPngImgSource C# (CSharp) Method

LoadPngImgSource() private method

Load an Image Source from File
private LoadPngImgSource ( string sourceName, string path ) : System.Windows.Media.ImageSource
sourceName string
path string
return System.Windows.Media.ImageSource
    private ImageSource LoadPngImgSource(string sourceName, string path)
    {

      try
      {
        // Assembly & Stream
        Assembly m_assembly = Assembly.LoadFrom(Path.Combine(path));
        Stream m_icon = m_assembly.GetManifestResourceStream(sourceName);

        // Decoder
        PngBitmapDecoder m_decoder = new PngBitmapDecoder(m_icon, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);

        // Source
        ImageSource m_source = m_decoder.Frames[0];
        return (m_source);

      }
      catch { }

      // Fail
      return null;

    }