How to control the execute sequence of event handler with EventAggregator in Prism

2.2k views Asked by At

I'm using Prism EventAggregator in my app. In my scenario, it's a download module, when download completion, publish the event. Four ViewModels subscribe this event and have their own event handler, some for writing log file, some for updating user interface.

  • How to control these event handlers execution sequence?
  • Are there executing in parallel?
1

There are 1 answers

3
Gusdor On BEST ANSWER

By default, they execute on the same thread that the event was published. If you are specifying a thread (UI / Worker), then they may execute in parallel.

Invocation of the event handlers is generally the order in which they subscribed, but I wouldn't depend on this behavior.

Why do you care about the order? Is it because you have many phases of initialization? Send out a seperate message for each phase.