我想做一个我想使用FileOpenPicker的uwp应用程序,但该应用程序只能在windows 10上运行,而不能在windows 10 mobile上运行
在Windows10移动我的应用程序crash...and上,异常消息是:“找不到元素。(来自HRESULT的异常: 0x80070490)”
这是我的代码:
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
openPicker.FileTypeFilter.Add(".jpg");
openPicker.FileTypeFilter.Add(".jpeg");
openPicker.FileTypeFilter.Add(".png");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read);
var image = new BitmapImage();
ImageBrush ib = new ImageBrush();
ib.ImageSource = image;
image.SetSource(stream);
var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
var filePath = file.Path;
localSettings.Values["monimage"] = filePath;
set.Background = new ImageBrush { ImageSource = image, Stretch = Stretch.UniformToFill };
}
else
{
//
}我已经在Windows10Mobile 10.0.14393.693上测试了我的应用程序,我没有可能在其他Windows10Mobile版本上测试,但我认为问题不是Windows10版本,而是我的代码……
发布于 2017-01-17 05:26:41
我自己解决了这个问题,我测试了商店里使用FileOpenPicker的其他应用程序,他们都有相同的错误,所以我重新安装了Windows10移动版,现在一切正常:)
https://stackoverflow.com/questions/41656792
复制相似问题