using System.Windows; using System.Windows.Input; namespace VulcanGUI.UtilityDialogs.ViewModels { public class ErrorDialogViewModel : DialogViewModelBase { public ErrorDialogViewModel() { this.okCommand = new RelayCommand(OnOkClicked); } private string _message; public string Message { get { return _message; } set { SetProperty(ref _message, value); } } private ICommand okCommand = null; public ICommand OKCommand { get { return okCommand; } set { okCommand = value; } } private void OnOkClicked(object parameter) { CloseDialogWithResult(parameter as Window, DialogResult.Yes); } } } using Prism.Mvvm; using System.Windows; namespace VulcanGUI.UtilityDialogs { public abstract class DialogViewModelBase : BindableBase { public DialogResult UserDialogResult { get; set; } public void CloseDialogWithResult(Window dialog, DialogResult result) { this.UserDialogResult = result; if (dialog != null) dialog.DialogResult = true; } } } private void LoadJobErrorNotification(string errMsg) { var vm = new ErrorDialogViewModel() { Message = errMsg }; var result = DialogService.OpenDialog(vm); }