When we decide to develop an application, such as for WP7, using the MVVM pattern but without adopting an available framework (see MVVMLight, Caliburn Micro, ...) we can expect to have to solve some problems for guarantee decoupling between the UI and presentation and business logic. One of these problems can be for example the need to display a MessageBox, a component of the IU, starting from a method of ViewModel corresponding to the page in which we stand. This problem can be solved by implementing a service that will be "injected" into the ViewModel and that task will be to display the MessageBox on request. Because we must ensure that there isn’t strict dependence between the ViewModel and the implementation of the service, we must think in terms of interfaces. We can define an interface for that service in order to give the possibility to implement it from time to time in a different way, in our case we realize that the implementation will make use of the MessageBox from which we take a starting p ...
Read the rest of entry »
View this page in another language: