I got a bit carried away with the EventAggregator as I was building my framework and was passing it down to base classes all over the place. I had a few auto unsubscribe/subcribe scenarios and then I ran into an issue where I spawed a second instance
of a view model and the first VM started responding to the requests I only expected the second instance to respond to. Of course it makes sense I have a single EA that I was passing all over the place.
So then I started trying to subscribe/unsubscribe in the active/deactivate(saw that in the forums) and of course everything fell apart.
Now, while I have to re-think exactly how useful it is to publish data out to children, in stead of pushing through direct access to the objects, I do need some help on the basic best practice.
1) Do I just have one EA for the shell view that I pass around? I assumed yes because I want to send message to the Shell from anywhere when I need to spawn a new window, but then I end up with this multiple instances responding when they don't need
2a) Should I be subscribing/unsubscribing as I tried doing in the activate/deactivate?
or 2b)should I check in my IHandle method and ignore if it shouldn't fire when deactivated?
As I'm typing I'm thinking that 1 is a yes and 2b is a better approach.
What are people doing? Should I be passing the EA down? In some instances I'm using MEF and just pulling in the shellview's created instance.
Sorry for the babble... it's getting late.