windows phone 不能加载音乐封面


   
  private void getImage()
  
{
if (playSong_ != null)
{
//Song playSong_;SongName是TextBlock控件的name属性
SongName.Text = playSong_.Name;

Stream albumArtStream = playSong_.Album.GetAlbumArt();

//找不到时使用默认的封面
if (albumArtStream == null)
{
StreamResourceInfo albumArtPlaceHolder = Application.GetResourceStream(new Uri("ApplicationIcon.png",UriKind.Relative));
albumArtStream = albumArtPlaceHolder.Stream;
}

BitmapImage albumArtImage = new BitmapImage();
albumArtImage.SetSource(albumArtStream);

//cover是Image控件的name属性
cover.Source = albumArtImage;
}
}

c# WindowsPhone

十六夜☆咲夜 12 years, 10 months ago

Your Answer