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

New Post: EventAggregator - duplicate subscriptions

$
0
0
Hello vikpea,

Based on my understanding there wouldn't be an exact time or interval of time where the Garbage Collector would execute. Therefore the ViewModels could remain alive the application lifetime, and its Event's weak reference would still be handled.

Regarding the destructor you implemented for calling the Garbage Collector, I suggest you to verify if strong references were held like the registration of the ViewModels in the corresponding Region.

Nevertheless, a possible workaround without using strong references would be by raising an event after the process ended in order to unsubscribe() each ViewModel's Subscription. You could accomplish this by subscribing to an event on each process's ViewModel, which its EventHandler would unsubscribe its proper event of progress update.
This way the old Event Subscriptions would be removed, although the ViewModels objects may still be alive.


I hope this helped you,

Gabriel Ostrowsky
https://blogs.southworks.net/gostrowsky

Viewing all articles
Browse latest Browse all 1878

Trending Articles



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