When I asked about how to implement a dialog in MVVM someone advised me to read this thread:
MVVM, DialogService and Dialog Result
In the view model, the dialog is called in this way:
var dialog = new DialogViewmodel();
var result = _dialogservice.ShowDialog("My Dialog", dialog);
if(result.HasValue && result.Value)
{
//accept true
}
else
{
//Cancel or false
}
But is this different than using a messageBox in this way?
DialogResult result = MessageBox.Show("Hello");
if(result == DialgoResult-OK)
{
//accept true
}
else
{
//Cancel or false
}
In this second case, I use MessageBox instead of the custom dialog, so I don't see any difference.
Anyway, in many cases I have read that to use a MessageBox in MVVM application it is a bad idea because it breaks the MVVM pattern. But really if this is true, I don't see how the first solution doesn't break the MVVM pattern and the second one breaks it.