Problem – user clicks “do something” button (view), view model receives command and passes it to model (function call). Some time passes and model is done processing data (async). How does model notifies viewmodel about “need update”/”done”?
What is the best aproach? How can i seperate Model from ViewModel in this scenario?
Problem – user clicks do something button (view), view model receives command and passes
Share
You could implement a plain old event in your Model which can be subscribed to from the ViewModel.
Update
In response to your comment.
If you are using multiple threads, then you will need to know about the “Dispatcher” framework to ensure that calls from non-UI threads are properly synchronized onto the UI thread. This is a requirement of WPF. Please see:
http://msdn.microsoft.com/en-us/magazine/cc163328.aspx