Currently I know the following objects Dispatcher.
If you have a text view, you can use IWpfTextView.VisualElement.Dispatcher.
If your class is constructed by MEF (marked [Export]and not built directly from your own code), you can use the fact that the algorithm and construction of the resolution of the MEF part occurs in the user interface stream, which allows use Dispatcher.CurrentDispatcher. For example:
[Export(typeof(ISomeInterface))]
public class MyClass : ISomeInterface {
private readonly Dispatcher _dispatcher;
public MyClass() {
_dispatcher = Dispatcher.CurrentDispatcher.
}
}
You can use Application.Current.Dispatcherfrom any code.
What, if any, is the recommended practice for receiving Dispatcher?