I'm working on a project which uses the following technologies:
I'm currently making an asynchronous call to one of our Web Services using the Begin/End methods generated by a proxy. The call is successful and the client is able to receive the Web Service's response on a worker thread.
Once the response is received, I proceed to raise an event. The class subscribed to the event proceeds to request a UI navigation using PRISM:
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
this.RegionManager.RequestNavigate(RegionNames.LoginContentRegion, projectSelectionViewUri)));
Since the asynchronous WCF response is not captured on the UI thread, I'm forced to invoke the UI thread using Application.Current.Dispatcher.BeginInvoke(...)
.
The problem here is that the invoke seems to do nothing. The UI is not updated, and no exception is thrown.
How should I invoke the UI thread from within an event that is raised on a worker thread?
Edit: This question has been re-asked at the following link, since the supposed duplicate does not provide an answer:
Request UI navigation using PRISM 4 on an asynchronous WCF response thread
You need to make sure you are invoking on the actual UI Dispatcher
, not necessarily the Current
. You could try passing in the UI Dispatcher
, or have some form of callback that will be handled by the UI somewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With