using Avalonia.Controls;
using Avalonia.Input;

namespace LindtLeerformPlugin.Views;

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

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

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