将Uri反序列化为WriteableBitmap

时间:2016-10-12 14:59:50

标签: c# json serialization uwp

我将我的图片序列化为Uri,我在反序列化方面遇到了麻烦

var storageFile = await StorageFile.GetFileFromPathAsync(temp[0].BackStage.AbsoluteUri);
 using (var stream = await storageFile.OpenReadAsync())
 {
  await BackStageImg.SetSourceAsync(stream);
 }

这段代码不起作用,它说"你没有访问权限"当我尝试将Uri添加到StorageFile

1 个答案:

答案 0 :(得分:0)

我将文件复制到App Local Folder并选择

StorageFile localFile = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appdata:///local/background"));