I recently found out about messaging between Threads in my application using AutoResetEvent. In a console app I would make a while(true) loop and rely on AutoResetEvent.WaitOne() to wait for a thread to signal that e.g. data is ready to be processed with AutoResetEvent.Set(). I know how to share data between threads using a Class that has a method for the worker thread, and data elements to share between the worker thread and the main thread.
My question is how to utilize AutoResetEvent in a Winforms app, where I normally don't see a command loop. Where should I put the WaitOne() call in a Winforms app?
Aucun commentaire:
Enregistrer un commentaire