Files
ReminderOrganizer/TaskWindow.xaml.cs
Michi bb6612420d Birthday entry type, relative dates, list/compact/cards views
- Task dialog: Appointment | Birthday switch. Birthday = name + "19.03." or
  "19.03.1986" (no time), live preview with weekday, age and days left
- Birthday folders open the birthday form; yearly tasks in such folders are
  migrated once
- Birthdays show "19. Maerz" instead of date + time; every task shows
  "in 15 days" / "3 days ago" (red when overdue)
- View switch: list, compact (one line), cards (calendar tiles), persisted
- ICS: birthdays as all-day events
- 59 tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 14:42:16 +01:00

49 lines
1.4 KiB
C#

#nullable enable
using System.Windows;
using System.Windows.Input;
using ReminderOrganizer.Core;
using ReminderOrganizer.Models;
using ReminderOrganizer.Services;
using ReminderOrganizer.ViewModels;
namespace ReminderOrganizer
{
public partial class TaskWindow : Window
{
private readonly TaskViewModel _viewModel;
public ReminderTask TaskResult => _viewModel.TaskResult;
public TaskWindow(ReminderTask? existingTask, bool darkMode, bool defaultBirthday = false)
{
InitializeComponent();
Theme.Apply(Resources, darkMode);
var localizationService = (ILocalizationService)ServiceLocator.Services.GetService(typeof(ILocalizationService))!;
_viewModel = new TaskViewModel(localizationService, existingTask, defaultBirthday);
_viewModel.RequestClose += OnRequestClose;
DataContext = _viewModel;
Loaded += (_, _) =>
{
NameBox.Focus();
NameBox.SelectAll();
};
}
private void OnRequestClose(object? sender, bool result)
{
DialogResult = result;
Close();
}
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed && e.OriginalSource is not System.Windows.Controls.TextBox)
{
DragMove();
}
}
}
}