Skip to content

Commit 9023ac7

Browse files
committed
Convert stream to memory stream for universal app example.
1 parent b153fe3 commit 9023ac7

File tree

1 file changed

+7
-1
lines changed
  • Examples/UniversalDemo/UniversalDemo/UniversalDemo.Shared/ViewModel

1 file changed

+7
-1
lines changed

Examples/UniversalDemo/UniversalDemo/UniversalDemo.Shared/ViewModel/AppImage.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,14 @@ public async Task Update(bool replaceImage = false)
7373
using (var download = await client.Files.DownloadAsync("/" + this.Name))
7474
{
7575
var stream = await download.GetContentAsStreamAsync();
76+
77+
// Convert the stream to the memory stream, because a memory stream supports seeking.
78+
var memStream = new MemoryStream();
79+
await stream.CopyToAsync(memStream);
80+
memStream.Position = 0;
81+
7682
var bitmap = new BitmapImage();
77-
await bitmap.SetSourceAsync(stream.AsRandomAccessStream());
83+
await bitmap.SetSourceAsync(memStream.AsRandomAccessStream());
7884
this.Image = bitmap;
7985
this.NotifyPropertyChanged("Image");
8086

0 commit comments

Comments
 (0)