1

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?

  • Did you find out the reason why MyViewModel->Insert("WriteProgress", progress) was never reached? – Md. Faisal Habib Nov 17 '22 at 12:29
  • Sadly no. I've given up on this since, I guess the operations are either fast enough to complete without reporting anything, or simply don't report correctly. –  Nov 23 '22 at 21:17

0 Answers0