tags:

views:

59

answers:

2

First of all i must say i am new to wpf and mvvm. I want to develop a client-server application(clients send info to the server and the serer notifies one or more of them..consider something like yahoo messenger(some user changes his status..sends info to the server and the sever notifies his friends and changes to their UI are made) My question is: does mvvm suits well with this kind of application?

A: 

The short answer is yes. MVVM would be convenient here. It's always convenient when it comes to linking UI to model.

In your case a client could have a service class, that listens to your server. Every time it receives a message it triggers an event (it may be brokered event, standard event, etc.). ViewModel listens to this event and updates its properties accordingly.

Cheers, Anvaka.

Anvaka
A: 

Yes you can apply MVVM to structure the client side of the application.

The model layer will consist in web services interface (WCF is the most common way of doing that) to remote methods. The view model part will prepare data coming from the model to be displayed by the UI and send notifications.

The main problem is to notify all your clients of some changes. The best way is to use a persistent connection between your clients and the server, so that the server can "push" notifications to the clients, which could not be always a possible solution. The other solution, heavier but more standard, is to use polling : your clients will regularly (each 5 seconds for example) ask to the server if some notifications are availables and update their interfaces if so.

Serious