mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 23:03:49 +02:00
50 lines
1.1 KiB
C#
50 lines
1.1 KiB
C#
using System;
|
|
using Prism.Commands;
|
|
using Prism.Services.Dialogs;
|
|
|
|
namespace Dialogs
|
|
{
|
|
public class MessageBoxViewModel : IDialogAware
|
|
{
|
|
/// <inheritdoc />
|
|
public bool CanCloseDialog()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void OnDialogClosed()
|
|
{
|
|
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
{
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public string Title { get; }
|
|
|
|
|
|
private DelegateCommand<string> _closeDialogCommand;
|
|
public DelegateCommand<string> CloseDialogCommand => _closeDialogCommand ??= new DelegateCommand<string>(CloseDialog);
|
|
|
|
private void CloseDialog(string obj)
|
|
{
|
|
if (obj == "true")
|
|
{
|
|
RaiseRequestClose(new DialogResult(ButtonResult.OK));
|
|
}
|
|
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
public virtual void RaiseRequestClose(IDialogResult dialogResult)
|
|
{
|
|
RequestClose?.Invoke(dialogResult);
|
|
}
|
|
}
|
|
} |