locked
i used create_async, but ui still get blocked

    Question

  • hi all,

    some code:

    task<String^> InternalProcess(IStorageFile^ input)
    {
    StorageFolder^ localFolder =  ApplicationData::Current->LocalFolder;
    task<StorageFile^>(input->CopyAsync(localFolder, "tmpfile", NameCollisionOption::ReplaceExisting));
    auto op = input->CopyAsync(localFolder, "tmpfile", NameCollisionOption::ReplaceExisting);
    task<StorageFile^> copyTask(op);
    return copyTask.then([](StorageFile^ file){
                       //process image
                       String^ result;
                       return result;
              });
    }

    IAsyncOperation<String^>^ winrt::ProcessImage(IStorageFile^ input)
    {
    m_inputFile = input;
    return create_async([this]() -> task<String^>{
    return InternalProcess(m_inputFile);
    });
    }

    why does the ui still get blocked when calling this ProcessImage method from Javascript?



    • Edited by adewang82 Thursday, May 10, 2012 3:16 AM
    Thursday, May 10, 2012 3:15 AM

Answers

  • it turns out that i have to use another create_async to wrap the process of image...
    • Marked as answer by adewang82 Thursday, May 10, 2012 5:37 AM
    Thursday, May 10, 2012 5:36 AM

All replies

  • it turns out that i have to use another create_async to wrap the process of image...
    • Marked as answer by adewang82 Thursday, May 10, 2012 5:37 AM
    Thursday, May 10, 2012 5:36 AM
  • Thanks for sharing the solution.

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, May 11, 2012 3:23 AM