Have you tried opennet?  I seem to recall using something similar in
opennetcf.  ApplicationEx I think.

As a word of warning though, I discovered issues with click events
(and presumeably any event) being fired during the transition. ie, the
events would be lost when I was returning from the new message pump.


David

"If we can hit that bullseye, the rest of the dominoes
 will fall like a house of cards... checkmate!"
 -Zapp Brannigan, Futurama


On Fri, Oct 15, 2010 at 01:44, Matt Siebert <[email protected]> wrote:
> 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.

Reply via email to