I am moving my traditional WPF code-behind app to a MVVM pattern.
I have moved all the button handlers into the ModelView so far.
Now is the turn of some of the logic which performs the functions. Alot of logic has been placed in separate classes as they involve no UI interaction, but the main part of the logic involves running some tasks, and then updating the UI during those stages, including a progress bar fed from background worker updates.
I looked into putting this logic in the Model, but it seems difficult to Update the UI (View) from the model, so was going to place in to the ViewModel.
Is this a bad idea? If so, why?
If this logic should really be placed in the Model, how should I update the UI - these are some of the existing functions in that logic:
//if task is run update UI:
txtCurrentStatus.Text = "Preparing job...";
progressBar.IsIndeterminate = true;
progressBar.Value = 0;
txtPercentage.Text = "0%";
//When progress updates from reading a log, update progress bar
txtPercentage.Text = (percentOutput) + "%";
progressBar.Value = Convert.ToDouble(percentOutput);