'How can I get a progress report from an async write to an output stream?
In my app, I have to write an IBuffer to an IOutputStream. I'd like to show my user the progress of this operation, so I'm trying with the following code:
auto writeOp = strm->WriteAsync(buff);
writeOp->Progress = ref new AsyncOperationProgressHandler<unsigned int, unsigned int>(
[=](IAsyncOperationWithProgress<unsigned int, unsigned int>^ op, unsigned int progress)
{
MyViewModel->Insert("WriteProgress", progress);
});
auto writeToFileTask = create_task(writeOp);
writeToFileTask.then([this](unsigned int c)
{
(void)c; // Unused parameter
});
However, MyViewModel->Insert("WriteProgress", progress) is never reached when I set a breakpoint. I don't know what I'd do differently to get this to work and I can't use C++/WinRT, so, any ideas?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
