using Avalonia;
using Avalonia.Controls;
using Avalonia.Interactivity;
namespace DispenserUI.Views.Windows;
///
/// 确认弹窗
///
public partial class ConfirmDialogWindow : Window
{
public static readonly StyledProperty ShowCancelProperty =
AvaloniaProperty.Register(nameof(ShowCancel), true);
public static readonly StyledProperty ShowConfirmProperty =
AvaloniaProperty.Register(nameof(ShowConfirm), true);
public static readonly StyledProperty ContentProperty =
AvaloniaProperty.Register(nameof(Content), "");
public static readonly StyledProperty CancelTextProperty =
AvaloniaProperty.Register(nameof(CancelText), "取消");
public static readonly StyledProperty ConfirmTextProperty =
AvaloniaProperty.Register(nameof(ConfirmText), "确认");
public string Content
{
get => GetValue(ContentProperty);
set => SetValue(ContentProperty, value);
}
public bool ShowCancel
{
get => GetValue(ShowCancelProperty);
set => SetValue(ShowCancelProperty, value);
}
public bool ShowConfirm
{
get => GetValue(ShowConfirmProperty);
set => SetValue(ShowConfirmProperty, value);
}
public string ConfirmText
{
get => GetValue(ConfirmTextProperty);
set => SetValue(ConfirmTextProperty, value);
}
public string CancelText
{
get => GetValue(CancelTextProperty);
set => SetValue(CancelTextProperty, value);
}
public ConfirmDialogWindow()
{
InitializeComponent();
}
private void Cancel(object? sender, RoutedEventArgs e)
{
Close(false);
}
private void Confirm(object? sender, RoutedEventArgs e)
{
Close(true);
}
}