private async void DownloadBlob(CloudBlobContainer container, string fileName, int fileId, long fileSize) { StorageFolder pictureFolder = KnownFolders.PicturesLibrary; StorageFile file = await pictureFolder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting); using (var fileStream = await file.OpenStreamForWriteAsync()) { // Retrieve reference to a blob CloudBlockBlob blob = container.GetBlockBlobReference(fileName); Stream stream = new MemoryStream(); AzureProgressStream progressStream = new AzureProgressStream(stream); progressStream.ProgressChanged += pstream_ProgressChanged; progressStream.SetLength(fileSize); progressStream.FileId = fileId; IOutputStream outputStream = WindowsRuntimeStreamExtensions.AsOutputStream(progressStream); await blob.DownloadToStreamAsync(outputStream); stream.Position = 0; stream.CopyTo(fileStream); fileStream.Flush(); } }