我想将从图片库中选择的图像设置为背景。所以我在IsolatedStorageSetting 中取所选照片的原始名称。但后来我没有设法从路径中获取文件流..这里的代码:
bitmapimage.UriSource = new Uri(Settings.BackgroundPhotoUrl, UriKind.Absolute);
BackgroundImg.ImageSource = bitmapimage;
但是这段代码不起作用。没有例外。只是背景是黑色的。所以我试图将 Stream 保存在 IsolatedStorageSetting 中(我不喜欢这个解决方案!!)但在这种情况下我得到了一个异常:
Operation denied
这里的代码:
Settings.MyStream = e.ChosenPhoto
最后,我尝试将图像保存在隔离存储中:
using (System.IO.IsolatedStorage.IsolatedStorageFile isf = System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForApplication())
{
isf.CopyFile(e.OriginalFileName, "background" + System.IO.Path.GetExtension(e.OriginalFileName), true);
}
但在这种情况下,我也获得了操作被拒绝的异常
我该如何解决这个问题?谢谢