using System.Windows;

namespace SharepointToolbox.Views.Dialogs;

public partial class InputDialog : Window
{
    public string ResponseText => ResponseBox.Text;

    public InputDialog(string prompt, string initialValue)
    {
        InitializeComponent();
        PromptText.Text = prompt;
        ResponseBox.Text = initialValue ?? string.Empty;
        Loaded += (_, _) => { ResponseBox.Focus(); ResponseBox.SelectAll(); };
    }

    private void Ok_Click(object sender, RoutedEventArgs e)
    {
        DialogResult = true;
        Close();
    }

    private void Cancel_Click(object sender, RoutedEventArgs e)
    {
        DialogResult = false;
        Close();
    }
}
