i have multiple module(every module has his own project) and i try to share a object between each module.
The object is on the UserViewModel Module initialized but not on the other modules (Only after the property changed trigger). I tried it with the EventAggregator but it's not quit right. I miss something realy important here.
public UserClass User
{
get { return _user; }
set { SetProperty(ref _user, value);}
}
First Module
public UserViewModel(IEventAggregator userEventAggregator,
UnityContainer container)
{
_userEventAggregator= userEventAggregator;
_userEventAggregator.GetEvent<UserSentEvent>().Publish(User);
User.PropertyChanged += UserOnPropertyChanged;
}
private void UserOnPropertyChanged(object sender,
PropertyChangedEventArgs e)
{
_userEventAggregator.GetEvent<UserSentEvent>().Publish(User);
}
Second Module
public UserDetailsViewModel(IEventAggregator userEventAggregator,
IUnityContainer container)
{
_userEventAggregator= userEventAggregator;
_userEventAggregator.GetEvent<UserSentEvent>).Subscribe(UserUpdate);
}