none
C++异步执行顺序 task.wait() error RRS feed

  • 问题

  • void ImagesShow::TimerShaft::GetImagePropertys(Platform::String^ folderName) { create_task(KnownFolders::PicturesLibrary->GetFolderAsync(folderName)).then([this](StorageFolder^ folder) { if (folder != nullptr) { create_task(folder->GetFilesAsync()).then( [folder](IVectorView<StorageFile^>^ files) { std::for_each(begin(files), end(files), [files]( StorageFile^ file) { if (file) {

    create_task(file->Properties->GetImagePropertiesAsync()).then([file]( ImageProperties^ ImgProperty ) { //(1)Do something }); create_task(file->GetThumbnailAsync(ThumbnailMode::SingleItem, 1024, ThumbnailOptions::UseCurrentScale)).then([file](StorageItemThumbnail^ thumbnail)

    { //(2)Do something }); } }); }); } //(3)Do something }); }

    大家好,请问一下怎么等待(1)(2)执行完再执行(3)呢??

    Thanks


    • 已编辑 Terry.hu 2013年6月13日 3:10 格式
    2013年6月9日 11:18

全部回复

  • void ImagesShow::TimerShaft::GetImagePropertys(Platform::String^ folderName) { create_task(KnownFolders::PicturesLibrary->GetFolderAsync(folderName)).then([this](StorageFolder^ folder) { if (folder != nullptr) { create_task(folder->GetFilesAsync()).then( [folder](IVectorView<StorageFile^>^ files) { std::for_each(begin(files), end(files), [files]( StorageFile^ file) { if (file) {

    create_task(file->Properties->GetImagePropertiesAsync()).then([file]( ImageProperties^ ImgProperty ) { //(1)Do something }); create_task(file->GetThumbnailAsync(ThumbnailMode::SingleItem, 1024, ThumbnailOptions::UseCurrentScale)).then([file](StorageItemThumbnail^ thumbnail)

    { //(2)Do something }); } }); }); } //(3)Do something }); }

    大家好,请问一下怎么等待(1)(2)执行完再执行(3)呢??

    Thanks



    求助啊!
    2013年6月13日 3:25