views:

687

answers:

1

I have an app with some background threads (actually an in-proc WCF-Service). Each thread runs its own Dispatcher to use some WPF-classes (MediaPlayer-objects to process some audio/video-files; it queues some delegates with BeginInvoke and finally call Dispatcher.Run). When the processing is done, I want to shutdown its dispatcher so that the thread can finish. A call to BeginInvokeShutdown shutdowns every dispatcher in the app, which results in closing the app.

Is there anything I can do, so the dispatcher finishes the message loop?

+1  A: 

Ok, when you host a WCF-Service inside a WPF-App, the called method of the service has the same dispatcher as the app. If I start a new thread with its own dispatcher, InvokeShutdown works as expected.

Lars