Hello, I will ask to help with understanding the use of MVVM pattern. How do I imagine it for myself:
There is a separate self-sufficient project (or library) in which some ready-made functionality is written. The project user is provided with an interface in which properties are opened which determine the state of the service and events are opened for notification by the service (push / pull notification). For example, for notification, use ReactiveExt.
The task is to use this service, write UI for it. We create a new WPF project, to facilitate MVVM support, we use some kind of framework (I use Caliburn.Micro).
Create a View-ViewModel. We use Binding, we try not to use code behind (we use only for the functionality closed on View).
We debug the UI project separately. We check the work of all notifications, binding, etc.
We have 2 ready not connected projects. Service and UI.
Further ... The simplest way is to get an instance of the service in the ViewModel (create directly, transfer to the constructor, get through DI). And sign event handlers for service events. In the body of the handlers, use the properties of the ViewModel that participate in the binding. Also, the ViewModel refers to the state of the service to the open properties of the service. Thus, the work of the service will be associated with the UI.
And where is the Model in this structure?
If you do a mapping service on the Model object. Those. A copy of the service has only the necessary properties for the UI. And already to receive a copy of model in ViewModel.
But then you have to duplicate and events (notification).
Here I am a little confused))) ... Tell me where is the Model ???
Façade, but for him, by and large, you should not care. - Bulson