If I want to open a new Window, without needing any immediate information, is it ok to open it this way? I know with Dialogs I should use a service, but if I don’t need any information back, it is quite troublesome and messy to add a new function into the service just to open a window?
// in ShellViewModel
public ICommand AboutCommand
{
get
{
if (_aboutCommand == null) {
_aboutCommand = new RelayCommand(delegate
{
var aboutView = new QuickImageUpload.Views.AboutView();
aboutView.Show();
});
}
return _aboutCommand;
}
}
You “could” do this, but you will be defeating the purpose of the MVVM pattern. The view models’ purpose is to support unit testing (non STA thread execution) so when you start showing UI windows, your unit test will not work.
So to correct your understanding of using the service mediator for dialog boxes is not that it requires a return response of some kind, but to still allow view models to be executed in non STA threads, hence happy unit testers.
Hope that clears it up for you.