MVVM Tutorial / Sample Code with Internet Connection

I understand the parts of View and ViewModel MVVM, but what I'm still really fuzzy is how you connect your application to data sources on the Internet (let's say you grab some XML or JSON from the Internet) and in particular where this code goes into your application. Can someone provide or link some sample code or tutorial in which you can configure a simple WPF (or Silverlight) application that retrieves data from the Internet?

+4
source share
1 answer

Josh Smith has a small section in his MVVM article on the repository template.

Basically, it says that you have a repository that connects to your internet data source that pulls the data into your ViewModel. Your repository may contain an HttpWebRequest for your XML or Json source. Then format it in your ViewModel.

Here is another example that shows you how to savor a data source.

+1
source

Source: https://habr.com/ru/post/1337690/


All Articles