private async Task <ImageSource> GetChachedThumbnail(Thumbnail thumbnail) { ImageSource imageSource = null; //캐싱 이미지 로드 ThumbnailDAO.FillThumnailData(thumbnail); await DispatcherHelper.RunAsync(async() => { //PNG의 경우 스트림으로 로드해야 정상적으로 출력이됨 (WriteableBitmapEx의 FromStream 또는 BitmapDecoder 사용시 await가 걸리지 않는 버그가 있음) BitmapImage image = new BitmapImage(); if (thumbnail.ThumbnailData != null) { using (InMemoryRandomAccessStream imras = new InMemoryRandomAccessStream()) { await imras.WriteAsync(thumbnail.ThumbnailData.AsBuffer()); imras.Seek(0); image.SetSource(imras); imageSource = image; } } else { Debugger.Break(); //여기 걸리면 안되는건디... } }); return(imageSource); }
protected void LoadCachedThumbnail(IMediaItemInfo item, Thumbnail thumbnail) { //캐싱 이미지 로드 ThumbnailDAO.FillThumnailData(thumbnail); DispatcherHelper.CheckBeginInvokeOnUI(async() => { //상영시간 item.Duration = thumbnail.RunningTime; //PNG의 경우 스트림으로 로드해야 정상적으로 출력이됨 using (MemoryStream ms = new MemoryStream(thumbnail.ThumbnailData)) { //item.ImageItemsSource = await BitmapFactory.New(0, 0).FromStream(ms); item.ImageItemsSource = await BitmapFactory.FromStream(ms); } }); }