I am building a tool which goal is to download a file based on a few parameters.
First step is to set (or retrieve) those parameters.
The different parameters sets are retrieved (let's say via configuration files) by a FileDownloadsManager : it knows exactly which parameters to use in order to download the right file.
those parameters are stored in a class, and I have a list of instances of this class.
That means that I can download my file with multiple possible parameters sets.
Around those ParameterSets, I've built ParametersSetsViewModels so that I can display them in a list, and add some View-Only properties. Internally, the ParametersSetsViewModels have a reference to the underlying ParametersSets used as a source for the members of the View Model.
now, when I select my parameters set, I would like the related file to be downloaded.
Whose responsibility should this be ?
I have this feeling that if the ViewModel is too active, by having a method that returns the downloaded file, this would be against the MVVM pattern; what is your take on this ?
Bonus : the download should be feasible in the background with BackgroundWorkers or WebClient's asynchronous methods.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…