52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
#nullable enable
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using ReminderOrganizer.Core;
|
|
using ReminderOrganizer.Models;
|
|
using ReminderOrganizer.Services;
|
|
|
|
namespace ReminderOrganizer
|
|
{
|
|
public partial class InputDialog : Window
|
|
{
|
|
public string ResponseText { get; private set; } = "";
|
|
|
|
public InputDialog(string title, string prompt, string defaultValue = "", ILocalizationService? localizationService = null)
|
|
{
|
|
InitializeComponent();
|
|
Title = title;
|
|
TxtPrompt.Text = prompt;
|
|
TxtInput.Text = defaultValue;
|
|
|
|
// Localize buttons if localization service is provided
|
|
if (localizationService != null)
|
|
{
|
|
BtnCancel.Content = localizationService.GetString("Cancel");
|
|
BtnOk.Content = localizationService.GetString("OK");
|
|
}
|
|
|
|
TxtInput.SelectAll();
|
|
TxtInput.Focus();
|
|
}
|
|
|
|
private void BtnOk_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
ResponseText = TxtInput.Text;
|
|
DialogResult = true;
|
|
}
|
|
|
|
private void BtnCancel_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
DialogResult = false;
|
|
}
|
|
|
|
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
|
{
|
|
if (e.LeftButton == MouseButtonState.Pressed)
|
|
{
|
|
DragMove();
|
|
}
|
|
}
|
|
}
|
|
}
|