using Avalonia.Controls;
using Avalonia.Input;

namespace VisionBuilder.UI.Avalonia.Views;

public partial class PasswordDialog : Window
{
    public PasswordDialog()
    {
        InitializeComponent();

        BtnOk.Click += (_, _) => Close(TxtPassword.Text);
        BtnCancel.Click += (_, _) => Close(null);

        TxtPassword.KeyDown += (_, e) =>
        {
            if (e.Key == Key.Enter)
                Close(TxtPassword.Text);
            else if (e.Key == Key.Escape)
                Close(null);
        };
    }
}
