- Birthday becomes "anniversary" with a category: birthday, wedding
anniversary (with Silver/Gold/... names), jubilee, memorial day
- Own categories: Settings > Categories (icon, color, text with {0}/{o})
- Sidebar "Categories" lists anniversaries across folders with counts
- Group by month (any view), groups fold with a click
- Folders named Hochzeit/Wedding migrate yearly tasks once
- Old files keep working (JSON "IsBirthday" maps to IsAnniversary)
- 74 tests
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
51 lines
1.7 KiB
C#
51 lines
1.7 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;
|
|
|
|
/// <param name="defaultCategory">Opens a new entry as anniversary of this category (null = appointment).</param>
|
|
public TaskWindow(ReminderTask? existingTask, bool darkMode,
|
|
System.Collections.Generic.IEnumerable<Category> categories, string? defaultCategory = null)
|
|
{
|
|
InitializeComponent();
|
|
Theme.Apply(Resources, darkMode);
|
|
|
|
var localizationService = (ILocalizationService)ServiceLocator.Services.GetService(typeof(ILocalizationService))!;
|
|
_viewModel = new TaskViewModel(localizationService, existingTask, defaultCategory, categories);
|
|
_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();
|
|
}
|
|
}
|
|
}
|
|
}
|