Notify other viewmodel OnViewModelCommandExecuted or OnMessage

Topics: Issues / bugs, Questions
Sep 26, 2013 at 11:44 AM
Hello

I need Information in an other viewmodel if an command is executing and also executed. Like the propertychanging and propertychanged.

I think I ask already the same question. The answer was: Use IMessagemediator.

Now with this solution I have an other problem:

I use nested viewmodel with automatic gennerated viewmodels.
If I change the selection in a list a new Viewmodel vor the detailview is genarated.

If I send a message wit MessageMediator not only the latest generated viewmodel is notified. Also viewmodels generated before an can be deleted by GC.

With "InterestedIn" and "OnViewModelCommandExecuted" only the latest gereated viemodel get information.
Coordinator
Sep 26, 2013 at 10:10 PM
But you can unsubscribe the message mediator in the Close method. What you should actually do is:

1) Subscribe to the message mediator in the Initialize method
2) Unsubscribe from the message mediator in the Close method