Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: EventAggregator Update GUI

$
0
0
OK,now I think I understand what you mean by the UI not updating. Is the Start method being called on the UI thread or a separate thread? When you use ThreadOption.UIThread, under the covers it does a Dispatcher.BeginInvoke kind of operation (actually using SynchronizationContext.Post), which queues up the execution for the UI thread once the current execution on the UI thread is complete. So that would explain why you are seeing what you describe.

The right way to get the updates to show at the right time depends on what thread this Start method is executing on as well as other things it calls out to that do similar attempts to update the UI (i.e. your IsServiceAvailable method?).

You can subscribe using ThreadOption.PublisherThread (the default), and then in the handling method use Dispatcher.Invoke - which blocks the current thread execution until the work you give it is done executing on the UI thread - which should mean you will see the transient text in your case before it moves on to the next stage of async execution.

Hope that helps.
Brian

Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>