我正在使用列表框,用具有绝对 uri 的图像填充列表框。现在我需要将图像保存到手机内的媒体库中。但是当我尝试时:
Application.GetResourceStream(new Uri(imageurl, UriKind.absolute))
它会引发异常。有什么办法可以解决这个问题吗?
提前致谢。
这是我找到的解决方案并且有效:
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));
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)