本文介绍了将网络上的图像保存到Windows Phone 8.1 RT C#中的“已保存的图片”文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将图像保存到Windows Phone 8.1 RT中的已保存的图片文件夹中?我使用HttpClient从网上下载了图片。

How can I save an image to the Saved Pictures folder in Windows Phone 8.1 RT? I downloaded the image from the web using HttpClient.

推荐答案

您只需要这个

var url = "Some URL";
var fileName = Path.GetFileName(url.LocalPath);
var thumbnail = RandomAccessStreamReference.CreateFromUri(url);

var remoteFile = await StorageFile.CreateStreamedFileFromUriAsync(fileName, url, thumbnail);
await remoteFile.CopyAsync(KnownFolders.SavedPictures, fileName, NameCollisionOption.GenerateUniqueName);

您需要在清单中设置图片库功能。

You need to set the Pictures Library capability in your manifest.

这篇关于将网络上的图像保存到Windows Phone 8.1 RT C#中的“已保存的图片”文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:45