using System; using Prism.Commands; using Prism.Services.Dialogs; namespace Dialogs { public class MessageBoxViewModel : IDialogAware { /// public bool CanCloseDialog() { return true; } /// public void OnDialogClosed() { } /// public void OnDialogOpened(IDialogParameters parameters) { } /// public string Title { get; } private DelegateCommand _closeDialogCommand; public DelegateCommand CloseDialogCommand => _closeDialogCommand ??= new DelegateCommand(CloseDialog); private void CloseDialog(string obj) { if (obj == "true") { RaiseRequestClose(new DialogResult(ButtonResult.OK)); } } /// public event Action RequestClose; public virtual void RaiseRequestClose(IDialogResult dialogResult) { RequestClose?.Invoke(dialogResult); } } }