Files
downkyicore/DownKyi/ViewModels/Dialogs/ViewAlreadyDownloadedDialogViewModel.cs
2023-12-24 01:06:29 +08:00

66 lines
1.5 KiB
C#

using DownKyi.Images;
using Prism.Commands;
using Prism.Services.Dialogs;
namespace DownKyi.ViewModels.Dialogs;
public class ViewAlreadyDownloadedDialogViewModel : BaseDialogViewModel
{
public const string Tag = "AlreadyDownloadedAlert";
#region
private VectorImage? _image;
public VectorImage? Image
{
get => _image;
set => SetProperty(ref _image, value);
}
private string? _message;
public string? Message
{
get => _message;
set => SetProperty(ref _message, value);
}
#endregion
public ViewAlreadyDownloadedDialogViewModel()
{
Title = "提示";
Image = SystemIcon.Instance().Warning;
}
#region
private DelegateCommand? _yesCommand;
public DelegateCommand YesCommand => _yesCommand ??= new DelegateCommand(ExecuteYesCommand);
private void ExecuteYesCommand()
{
RaiseRequestClose(new DialogResult(ButtonResult.OK));
}
// 关闭窗口事件
private DelegateCommand? _closeCommand;
public new DelegateCommand CloseCommand => _closeCommand ??= new DelegateCommand(ExecuteCloseCommand);
/// <summary>
/// 关闭窗口事件
/// </summary>
private void ExecuteCloseCommand()
{
RaiseRequestClose(new DialogResult(ButtonResult.Cancel));
}
#endregion
public override void OnDialogOpened(IDialogParameters parameters)
{
Message = parameters.GetValue<string>("message");
}
}