LeftTwixWand / Inventory

New version of Microsoft Inventory sample, built on WinUI 3, using DDD and Clean Architecture approach
MIT License
71 stars 10 forks source link

Improve NavigationService for automatic ObservableRecipient activation #29

Open LeftTwixWand opened 1 year ago

LeftTwixWand commented 1 year ago

Issue #28 describes how to use CommunityToolkit.Mvvm.Messaging for ViewModels communication. The only one problem here, is every ViewModel which listens for a message, has to be manually activated: IsActive = true; to start listening. So, it would be good to automatically activate such ViewModels somewhere in the NavigationService. As a bad solution - all the ObservableRecipient instances can be activated in the Autofac container callback after they've being resolved.