Depending upon certain conditions a WPF app I'm working on has to be able to bring up a dialog box, to remind the user to save their data. We're using ModernUI for our basic look-and-feel. We're also using MVVM Light. The problem I'm struggling with is how to invoke a ModernUI's ModernDialog from within one of the commands in a viewmodel. We have a class (DialogViewService) to make it a bit easier in using the ModernDialog, and do I initially tried this:
var dial = new CoreServices.DialogViewService();
var ret = dial.ShowMessage("Unsaved Data", "Save Current Data?");
I don't like that, though because it's in my VM. So I then put a property into our ServiceLocator and changed the above code to this:
var dial = ViewModelLocator.DialogViewSrv;
var ret = dial.ShowMessage("Unsaved Data", "Save Current Data?");
Really though, this is the same thing as the previous one.
So how do I get it so that I can invoke the ModernDialog from a VM, without giving the VM "knowledge" of the UI?