Righty oh now I believe ive set this application up right but correct me if im wrong, for simple sake i have in my bootstrapper 3 modules loaded, one is a navigation module, and two others the views.
Independently in code if i load the modules and in the initialize method add them to a region that all works fine, however ofcourse id like some more control.
Now in the navigation view model i have an event aggregator which publishes an event (class that inherits from EventArgs if thats important) the other two modules have subscribed to this event but neither recieve it,
/// <summary>
/// Carries the out menu item selection methods.
/// </summary>
/// <param name="e">The <see cref="TMBL.Web.TMBLCore.Controls.Assets.NavigationViewSelectionEventArgs"/> instance containing the event data.</param>
public void CarryOutMenuItemSelectionMethods(NavigationViewSelectionEventArgs e)
{
_eventAggregator.GetEvent<NavigationMenuItemSelectedEvent>().Publish(e);
}
in navigation ViewModel,and then subscribed to in news module
_eventAggregator.GetEvent<NavigationMenuItemSelectedEvent>().Subscribe(NavigationMenuReturnedEvent,
ThreadOption.UIThread);
Seemed simple enough, i can subscribe to this event in my navigation module and it picks it up, it just wont go outside the module, what does one need to do to achieve this?
Also the event aggregator is pushed in through dependency injection to the modules constructor, then stored there and passed onthrough constructors to the viewsand view models (views first approach by the way). Whilst im here I dont know if this is the cause of the problem or not but is it bad to have the module store an instance of event aggregator and pass it on this way eg
_displayNewsView = new DisplayNewsView(new DisplayNewsViewModel(_eventAggregator));
Or should the event aggregator get to the viewmodels a different way?
Thanks for you time