首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Windows8.1 FileOpenPicker

Windows8.1 FileOpenPicker
EN

Stack Overflow用户
提问于 2014-09-19 20:36:50
回答 1查看 242关注 0票数 0

我为windows商店制作了应用程序。在我将操作系统升级到Windows8.1之前,它运行得很好。在尝试FileOpenPicker时出现了一个错误:

元素找不到。(ИсключениеизHRESULT: 0x80070490)

下面是堆栈跟踪:

在Windows.Storage.Pickers.FileOpenPicker.PickSingleFileAsync() 在Crypto.Engine.d__13.MoveNext()

和代码:

代码语言:javascript
复制
    FileOpenPicker fop = new FileOpenPicker();
    fop.FileTypeFilter.Add(".jpg");//extension);
    fop.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
    try
    {
        StorageFile file = await fop.PickSingleFileAsync();
        return file;
    }
        catch(Exception ex) {}

我怎么才能修好它?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-10 10:59:57

我遇到了同样的问题,并通过将代码放在正确的线程中解决了:

代码语言:javascript
复制
CoreApplication::MainView->CoreWindow->Dispatcher->RunAsync(
    CoreDispatcherPriority::High,
    ref new DispatchedHandler([]()
{
    // **ATTANTION**: direct call `PickSingleFileAsync` in render loop will crash
    //http://sertacozercan.com/2013/10/fixing-element-not-found-exception-from-hresult-0x80070490-error-in-windows-8-x/
    FileOpenPicker^ openPicker = ref new FileOpenPicker();
    openPicker->ViewMode = PickerViewMode::Thumbnail;
    openPicker->SuggestedStartLocation = PickerLocationId::PicturesLibrary;
    openPicker->FileTypeFilter->Append(".png");
    openPicker->FileTypeFilter->Append(".jpg");
    openPicker->FileTypeFilter->Append(".jpeg");

    auto task = openPicker->PickSingleFileAsync();
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25942038

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档