private GetThumbnailAsync ( [ mode ) : IAsyncOperation |
||
mode | [ | |
return | IAsyncOperation |
public async static Task<MusicLibraryViewModel.AlbumItem> GetAlbumItemFromFolder(StorageFolder item, StorageFolderQueryResult albumQueryResult, int artistId) { var albumDataRepository = new AlbumDataRepository(); var musicAttr = await item.Properties.GetMusicPropertiesAsync(); var albumItem = await albumDataRepository.LoadAlbumViaName(artistId, musicAttr.Album); if (albumItem == null) { var thumbnail = await item.GetThumbnailAsync(ThumbnailMode.MusicView, 250); albumItem = new MusicLibraryViewModel.AlbumItem(thumbnail, musicAttr.Album, albumQueryResult.Folder.DisplayName) { ArtistId = artistId }; await albumDataRepository.Add(albumItem); } var files = await item.GetFilesAsync(CommonFileQuery.OrderByMusicProperties); await albumItem.LoadTracks(files); return albumItem; }
private async Task<AlbumViewModel> CreateAlbumViewModel(StorageFolder folder) { var files = await folder.GetFilesAsync(); if (files.Count == 0) return null; byte[] thumb = null; var thumbnail = await folder.GetThumbnailAsync(Windows.Storage.FileProperties.ThumbnailMode.PicturesView); if (thumbnail != null) { var stream = thumbnail.AsStreamForRead(); using (BinaryReader br = new BinaryReader(stream)) { thumb = br.ReadBytes((int)stream.Length); } } return new AlbumViewModel(App.AlbumService, folder.DisplayName, folder.Path, thumb); }
private async Task<BitmapImage> getthumbnail(StorageFolder sf) { using (StorageItemThumbnail thumbnail = await sf.GetThumbnailAsync(ThumbnailMode.SingleItem, 100)) { BitmapImage bitmapImage = new BitmapImage(); bitmapImage.SetSource(thumbnail); return bitmapImage; } }