How to wait for an IAsyncAction?

后端 未结 4 2146
深忆病人
深忆病人 2021-01-04 09:06

In Windows Store Apps, C++(C# is similar though), doing something like

IAsyncAction^ Action = CurrentAppSimulator::ReloadSimulatorAsync(proxyFile);
create_ta         


        
4条回答
  •  佛祖请我去吃肉
    2021-01-04 09:27

    Just in case anyone needs here is solution in C++/WinRT. Say you have function ProcessFeedAsync() that would return IAsyncAction, just need following simple code:

    winrt::init_apartment();
    
    auto processOp{ ProcessFeedAsync() };
    // do other work while the feed is being printed.
    processOp.get(); // no more work to do; call get() so that we see the printout before the application exits.
    

    source

提交回复
热议问题