5
votes

From following the Prism documentation it says there are four ways to communicate across modules -

  • Solution commanding
  • Region context
  • Shared services
  • Event aggregation

    1. Can I just chose one of these methods and apply it for all cross-module communcation? Or should I use different methods depending on the situation?
    2. In particular, in an application Im writing at the moment I have button in one module and when the user clicks it I want to start a thread in another module. Which method of communication would I use for this situation?
1

1 Answers

7
votes

Ans 1: Yes, you can use a single approach all-over. Most of the times it will be easier to do it that way.

Ans 2: I recommend you use Event Aggregation to do that. That way, you have a very loose coupling between the button click and the thread execution. That way, the listening module just has to be aware of a single event no matter where it was raised from.

Since, it is a single notification and not a bunch of inter-related notifications/communications, it is better to Aggregate an event rather than creating a Shared Service.