Używanie taglib do wyświetlania okładki w polu obrazu w WPF

Tworzę gracza i utknąłem w pozornie prostym problemie. Muszę, aby okładka utworu była wyświetlana w jednym polu obrazu. Znalazłem te dwa rozwiązania:

To:

var file = TagLib.File.Create(filename);
    if (file.Tag.Pictures.Length >= 1)
    {
        var bin = (byte[])(file.Tag.Pictures[0].Data.Data);
        PreviewPictureBox.Image = Image.FromStream(new MemoryStream(bin)).GetThumbnailImage(100, 100, null, IntPtr.Zero);
    }

i to:

System.Drawing.Image currentImage = null;

// In method onclick of the listbox showing all mp3's
TagLib.File f = new TagLib.Mpeg.AudioFile(file);
if (f.Tag.Pictures.Length > 0)
{
  TagLib.IPicture pic = f.Tag.Pictures[0];
  MemoryStream ms = new MemoryStream(pic.Data.Data);
  if (ms != null && ms.Length > 4096)
  {
       currentImage = System.Drawing.Image.FromStream(ms);
       // Load thumbnail into PictureBox
       AlbumArt.Image = currentImage.GetThumbnailImage(100,100, null, System.IntPtr.Zero);
  }
  ms.Close();
}

Ale oba są w Windows Forms, jak sądzę, ponieważ mam z nimi problemy.

Nie jestem pewien, które rozwiązanie jest najbardziej sensowne. Czy ktoś mógłby mi dać jakieś wskazówki?

questionAnswers(1)

yourAnswerToTheQuestion