We are trying to fasten to the server, written on the basis of Workflow Foundation, an alert about the progress of operations on the client.

The problem is that I did not find any methods that would allow the Activity to run and wait for its completion in the calling thread (in general, just run synchronously) - Workflow itself creates threads that you cannot reach from the code and runs Activity in them. There was no waiting method for completion either.

    1 answer 1

    For such purposes, the Workflow Foundation uses AutoResetEvent .

    Your task is to set up the necessary actions for the Workflow Application object on the events Completed , Unloaded , etc. and make sure that all the normal ways to end your program result in AutoResetEvent.Set()

    After that, to lock the current thread , simply use AutoResetEvent.WaitOne()