Initial commit: ReminderOrganizer WPF app
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
51
InputDialog.xaml.cs
Normal file
51
InputDialog.xaml.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
#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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user