Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: event subscription after new module is created

$
0
0

Hello, I have a problem with modular application with events. Here is a situation:
1) Module A (products) is loaded, it contains a list of products - I choose ProductX on list
2) event is published and I know what product is currently selected

eventAggregator.GetEvent<ProductSelectedEvent>().Publish(selectedProduct);

3) on Module A i click a button "Show product orders" to load Module B
4) Module B (orders) is loaded and in constructor I try to subscribe selected product

this.eventAggregator.GetEvent<ProductSelectedEvent>().Subscribe(ProductSelectedEventSubscribed);

Now there is a problem that on Module B event is not triggered until I select product again (then event is published again and everything works fine).

How to solve that it ?


Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>