views:

71

answers:

2

I have a MVVM project that polls a feed every 10 seconds to see for updates. The result from the feed is displayed using a ObervableCollection. This works nice, but Im unsure as to where I can put my dispatchedtimer. Should it be in the Model.DataService or in the ViewModel.MainViewModel?

thanks

A: 

I think there is no right answer possible, without knowing more details about the project.



Regarding the MVVM-Pattern:

Do you think it's a matter of your BusinessObjects? (Yes => Place it in Model.DataService)

Or is it a feature of your View? Yes => Place it in the ViewModel.MainViewModel.

Are you going to develop a view that displays all the available updates at the moment the user push the button (Show me updates)? If so, I suggest to place the timer in the ViewModel layer.

WaltiD
A: 

I asume that your view is open the whole time and is bound to an Observable Collection that resides in you ViewModel. In that case I would definitely put a time in the ViewModel because the ViewModel is the owner of the Observable Collection.

Wouter Janssens - Xelos bvba