You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0 KiB

1 month ago
using Avalonia.Media;
using HeroIconsAvalonia.Enums;
using ReactiveUI;
namespace AuroraDesk.Presentation.ViewModels;
/// <summary>
/// 关闭确认对话框的 ViewModel
/// </summary>
public class CloseConfirmViewModel : ReactiveObject
{
private string _title = "确认关闭";
private string _message = "确定要退出程序吗?";
private IconType _icon = IconType.QuestionMarkCircle;
private IBrush _accentBrush = new SolidColorBrush(Color.FromRgb(59, 130, 246));
private string _primaryButtonText = "确认";
private string _secondaryButtonText = "取消";
/// <summary>
/// 对话框标题
/// </summary>
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
/// <summary>
/// 对话框消息
/// </summary>
public string Message
{
get => _message;
set => this.RaiseAndSetIfChanged(ref _message, value);
}
/// <summary>
/// 对话框图标
/// </summary>
public IconType Icon
{
get => _icon;
set => this.RaiseAndSetIfChanged(ref _icon, value);
}
/// <summary>
/// 对话框强调色
/// </summary>
public IBrush AccentBrush
{
get => _accentBrush;
set => this.RaiseAndSetIfChanged(ref _accentBrush, value);
}
/// <summary>
/// 主操作按钮文本
/// </summary>
public string PrimaryButtonText
{
get => _primaryButtonText;
set => this.RaiseAndSetIfChanged(ref _primaryButtonText, value);
}
/// <summary>
/// 次操作按钮文本
/// </summary>
public string SecondaryButtonText
{
get => _secondaryButtonText;
set
{
this.RaiseAndSetIfChanged(ref _secondaryButtonText, value);
this.RaisePropertyChanged(nameof(HasSecondaryButton));
}
}
/// <summary>
/// 是否显示次操作按钮
/// </summary>
public bool HasSecondaryButton => !string.IsNullOrWhiteSpace(_secondaryButtonText);
}