G'day folks, Aside from Application.Run() and Form.ShowDialog(), are there any other ways to run a message loop in a .NET app? I'm not keen on rolling my own message loop, I'm just wondering if there are other options already available.
Why do I want to do this? Well I'm developing an add-in for a native app that hosts .NET (3.5). The native app calls a method exposed by the add-in which is then free to do whatever it needs to do before returning control to the native app. One caveat is that the add-in can only talk to the native app's API on the thread that invoked it, attempting to do so on another thread is unstable at best. In my add-in I want to host a WCF service for a client running in another process. The service needs to be able to talk to the API so I'd rather not host it on another thread. The problem is that I need to prevent my add-in from returning control to the native app before the client has finished with the service. I've looked at Application.Run(Form) and Application.Run(ApplicationContext) but the native app immediately resumes when these are called, then when the add-in eventually returns the native app blows up. Form.ShowDialog() seems to be the only option that works, but I'm not keen on showing a form whose sole purpose is to block execution until the client is finished with the service. Thanks, Matt.
