在MediaLibrary中保存图像 [英] Saving Image in MediaLibrary
本文介绍了在MediaLibrary中保存图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用列表框,其中用绝对uri的图像填充列表框.现在,我需要将图像保存到手机中的媒体库中.但是当我尝试:
I am using listbox where I am populating the listbox with the images with the absolute uri. Now i need to save the images to my media library within my phone. But when I try:
Application.GetResourceStream(new Uri(imageurl, UriKind.absolute))
它会引发异常.有什么办法可以解决这个问题.
it fires an exception. Is there any way to solve this problem.
谢谢.
推荐答案
这是我发现的解决方案,并且有效:
Here's what I found as solution and it worked:
WebClient client = new WebClient();
client.OpenReadCompleted += (s, e) =>
{
if (e.Error == null)
{
MediaLibrary library = new MediaLibrary();
library.SavePicture(imageName, e.Result);
}
};
client.OpenReadAsync(new Uri(imageAbsoluteUrl, UriKind.Absolute));
这篇关于在MediaLibrary中保存图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文