using Avalonia.Media;
using HeroIconsAvalonia.Enums;
using ReactiveUI;
namespace AuroraDesk.Presentation.ViewModels;
///
/// 关闭确认对话框的 ViewModel
///
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 = "取消";
///
/// 对话框标题
///
public string Title
{
get => _title;
set => this.RaiseAndSetIfChanged(ref _title, value);
}
///
/// 对话框消息
///
public string Message
{
get => _message;
set => this.RaiseAndSetIfChanged(ref _message, value);
}
///
/// 对话框图标
///
public IconType Icon
{
get => _icon;
set => this.RaiseAndSetIfChanged(ref _icon, value);
}
///
/// 对话框强调色
///
public IBrush AccentBrush
{
get => _accentBrush;
set => this.RaiseAndSetIfChanged(ref _accentBrush, value);
}
///
/// 主操作按钮文本
///
public string PrimaryButtonText
{
get => _primaryButtonText;
set => this.RaiseAndSetIfChanged(ref _primaryButtonText, value);
}
///
/// 次操作按钮文本
///
public string SecondaryButtonText
{
get => _secondaryButtonText;
set
{
this.RaiseAndSetIfChanged(ref _secondaryButtonText, value);
this.RaisePropertyChanged(nameof(HasSecondaryButton));
}
}
///
/// 是否显示次操作按钮
///
public bool HasSecondaryButton => !string.IsNullOrWhiteSpace(_secondaryButtonText);
}