I am trying to use the Unity event aggregator to do messaging between various parts of an application. Currently, this is the only feature of the Prism framework that I would like to use. I am having some trouble understand basic concepts I think.
My goal is in some places to be able to broadcast a certain event, and then pick that event up in other places. The code that I have found to do that requires access to the Unity Container, which from what I can tell requires configuration in a bootstrapper and the bootstrapper needs to instantiate the window. This seems like a lot of extra hoops to jump through in my situation of just wanting to use the event aggregator.
Can somebody point me in the right direction for the bare minimum code to use the event aggregator and nothing else from Prism?
It turns out all that needs to be done is instantiate an instance of the EventAggregator class that prism provides. No container needed. I did it in a singleton. Here's the code I used:
public class MyEventAggregator
{
private static MyEventAggregator instance = new MyEventAggregator();
public static MyEventAggregator GetInstance()
{
return instance;
}
private EventAggregator _Aggregator;
public EventAggregator Aggregator
{
get
{
return _Aggregator;
}
}
private MyEventAggregator()
{
_Aggregator = new EventAggregator();
}
}