如何将 httpclient 下载的图像 (jpeg) 保存在 windows phone localstorage 中?

How to Save an image(jpeg) downloaded by httpclient in windows phone localstorage?

我正在寻找将从 httpClient 下载的图像保存到本地存储的任何示例。我知道如何将文件从本地资源保存到本地存储。但是没有找到任何关于从uri下载后如何保存图像的例子?

目前我已经达到了这一点

try
        {
            if (string.IsNullOrEmpty(imageUrl))
                return;
            var url = new Uri(imageUrl);
            var thumbnail = RandomAccessStreamReference.CreateFromUri(url);

            var imageFile = await ApplicationData.Current.LocalFolder.CreateFileAsync(Constants.Profile_Picture_Name, CreationCollisionOption.ReplaceExisting);

            //How to save RandomAccessStream to file here!
        }
        catch
        {

        }

得到解决方案

 var url = new Uri(httpUrl);
            var fileName = Path.GetFileName(url.LocalPath);
            if (folder == null)
                folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync(Constants.Member_Images_Folder, CreationCollisionOption.OpenIfExists);    

            HttpClient client = new HttpClient();
            var bytes = await client.GetByteArrayAsync(url);

            var imageFile = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);
            await FileIO.WriteBytesAsync(imageFile, bytes);