downkyi/DownKyi/ViewModels/Dialogs/ViewAlertDialogViewModel.cs
2022-05-07 12:55:09 +08:00

66 lines
1.5 KiB
C#

using DownKyi.Images;
using Prism.Commands;
using Prism.Services.Dialogs;
namespace DownKyi.ViewModels.Dialogs
{
public class ViewAlertDialogViewModel : BaseDialogViewModel
{
public const string Tag = "DialogAlert";
#region
private VectorImage image;
public VectorImage Image
{
get => image;
set => SetProperty(ref image, value);
}
private string message;
public string Message
{
get { return message; }
set { SetProperty(ref message, value); }
}
#endregion
public ViewAlertDialogViewModel()
{
}
#region
// 确认事件
private DelegateCommand allowCommand;
public DelegateCommand AllowCommand => allowCommand ?? (allowCommand = new DelegateCommand(ExecuteAllowCommand));
/// <summary>
/// 确认事件
/// </summary>
private void ExecuteAllowCommand()
{
ButtonResult result = ButtonResult.OK;
RaiseRequestClose(new DialogResult(result));
}
#endregion
#region
public override void OnDialogOpened(IDialogParameters parameters)
{
base.OnDialogOpened(parameters);
Image = parameters.GetValue<VectorImage>("image");
Title = parameters.GetValue<string>("title");
Message = parameters.GetValue<string>("message");
}
#endregion
}
}