Files
ReminderOrganizer/TaskWindow.xaml
Michi 1918712f7f Fix data loss risk, reminder bugs; theme, credits, tests
- Store tasks in %APPDATA% (single-file extract dir lost data on update),
  atomic serialized saves, corrupt-file backup, migration of old tasks.json
- Reminders without description never showed (empty balloon text threw)
- Catch up missed reminders on start; monthly recurrence no longer drifts
- Task dialog: date pick kept 00:00, cancel leaked recurrence changes
- CSV import understands quoted fields written by export
- Confirm before deleting; name folders on create; tasks sorted by date
- Single instance, autostart starts hidden in tray, tray icon disposed
- Theme helper for all dialogs, MDL2/Path icons instead of emojis,
  fixed folder selection/badge, localized counts and messages
- Credits (c) Michael Media + Discord link, exe Company/Copyright
- Locales embedded; xUnit tests (24); README, CLAUDE.md, sprite-generator

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 14:08:53 +01:00

198 lines
13 KiB
XML

<Window x:Class="ReminderOrganizer.TaskWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding WindowTitle}"
Width="440" SizeToContent="Height"
WindowStartupLocation="CenterOwner"
ResizeMode="NoResize"
ShowInTaskbar="False"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.Resources>
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
<SolidColorBrush x:Key="WarningBrush" Color="#F59E0B"/>
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
<SolidColorBrush x:Key="HoverBrush" Color="#E2E8F0"/>
<Style x:Key="Label" TargetType="TextBlock">
<Setter Property="FontSize" Value="11"/>
<Setter Property="FontWeight" Value="SemiBold"/>
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
<Setter Property="Margin" Value="0,0,0,4"/>
</Style>
<Style x:Key="Input" TargetType="TextBox">
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="10,8"/>
<Setter Property="FontSize" Value="13"/>
</Style>
<Style x:Key="Chip" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="FontSize" Value="11"/>
<Setter Property="Margin" Value="0,0,6,0"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="1" CornerRadius="12" Padding="10,4">
<ContentPresenter HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="DialogButton" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="Padding" Value="18,8"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter TargetName="bd" Property="Opacity" Value="0.4"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="bd" Property="Opacity" Value="0.85"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Border CornerRadius="12" Background="{DynamicResource CardBrush}" Margin="8">
<Border.Effect>
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.25" Direction="270" Color="Black"/>
</Border.Effect>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- Header -->
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,10">
<Grid>
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xEA8F;" FontFamily="Segoe MDL2 Assets" FontSize="15" Foreground="White" VerticalAlignment="Center"/>
<TextBlock Text="{Binding WindowTitle}" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="10,0,0,0"/>
</StackPanel>
<Button Content="&#xE8BB;" FontFamily="Segoe MDL2 Assets" FontSize="10" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
Width="28" Height="28" Cursor="Hand" Command="{Binding CancelCommand}" IsCancel="True"/>
</Grid>
</Border>
<!-- Content -->
<StackPanel Grid.Row="1" Margin="18,16,18,18">
<TextBlock Text="{Binding NameLabel}" Style="{StaticResource Label}"/>
<TextBox x:Name="NameBox" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
<TextBlock Text="{Binding ErrorMessage}" Foreground="#EF4444" FontSize="11" Margin="0,4,0,0"
Visibility="{Binding HasError, Converter={StaticResource BoolToVisibility}}"/>
<TextBlock Text="{Binding DateLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DatePicker Grid.Column="0" SelectedDate="{Binding SelectedDay, Mode=TwoWay}" Height="32" VerticalContentAlignment="Center"/>
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="8,0,0,0">
<ComboBox Width="56" Height="32" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedHourIndex}">
<ComboBoxItem Content="00"/><ComboBoxItem Content="01"/><ComboBoxItem Content="02"/>
<ComboBoxItem Content="03"/><ComboBoxItem Content="04"/><ComboBoxItem Content="05"/>
<ComboBoxItem Content="06"/><ComboBoxItem Content="07"/><ComboBoxItem Content="08"/>
<ComboBoxItem Content="09"/><ComboBoxItem Content="10"/><ComboBoxItem Content="11"/>
<ComboBoxItem Content="12"/><ComboBoxItem Content="13"/><ComboBoxItem Content="14"/>
<ComboBoxItem Content="15"/><ComboBoxItem Content="16"/><ComboBoxItem Content="17"/>
<ComboBoxItem Content="18"/><ComboBoxItem Content="19"/><ComboBoxItem Content="20"/>
<ComboBoxItem Content="21"/><ComboBoxItem Content="22"/><ComboBoxItem Content="23"/>
</ComboBox>
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" FontSize="14" Foreground="{DynamicResource TextPrimaryBrush}"/>
<ComboBox Width="56" Height="32" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedMinuteIndex}">
<ComboBoxItem Content="00"/><ComboBoxItem Content="05"/>
<ComboBoxItem Content="10"/><ComboBoxItem Content="15"/>
<ComboBoxItem Content="20"/><ComboBoxItem Content="25"/>
<ComboBoxItem Content="30"/><ComboBoxItem Content="35"/>
<ComboBoxItem Content="40"/><ComboBoxItem Content="45"/>
<ComboBoxItem Content="50"/><ComboBoxItem Content="55"/>
</ComboBox>
</StackPanel>
</Grid>
<!-- Quick picks -->
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
<TextBlock Text="{Binding QuickLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center" Margin="0,0,8,0"/>
<Button Content="{Binding TomorrowText}" Command="{Binding SetTomorrowCommand}" Style="{StaticResource Chip}"/>
<Button Content="{Binding NextWeekText}" Command="{Binding SetNextWeekCommand}" Style="{StaticResource Chip}"/>
<Button Content="{Binding NextMonthText}" Command="{Binding SetNextMonthCommand}" Style="{StaticResource Chip}"/>
</StackPanel>
<TextBlock Text="{Binding PastDateWarning}" Foreground="{DynamicResource WarningBrush}" FontSize="11" Margin="0,6,0,0"
Visibility="{Binding IsInPast, Converter={StaticResource BoolToVisibility}}"/>
<!-- Recurrence -->
<StackPanel Orientation="Horizontal" Margin="0,14,0,0">
<CheckBox IsChecked="{Binding IsRecurring, Mode=TwoWay}" VerticalAlignment="Center"
Foreground="{DynamicResource TextPrimaryBrush}">
<StackPanel Orientation="Horizontal">
<TextBlock Text="&#xE8EE;" FontFamily="Segoe MDL2 Assets" FontSize="12" VerticalAlignment="Center" Foreground="{DynamicResource TextPrimaryBrush}"/>
<TextBlock Text="{Binding RecurringLabel}" FontSize="12" Margin="6,0,0,0" VerticalAlignment="Center" Foreground="{DynamicResource TextPrimaryBrush}"/>
</StackPanel>
</CheckBox>
<ComboBox Margin="10,0,0,0" Width="100" Height="28" VerticalContentAlignment="Center"
SelectedIndex="{Binding SelectedRecurrenceIndex}" IsEnabled="{Binding IsRecurring}">
<ComboBoxItem Content="{Binding DailyText}"/>
<ComboBoxItem Content="{Binding WeeklyText}"/>
<ComboBoxItem Content="{Binding MonthlyText}"/>
<ComboBoxItem Content="{Binding YearlyText}"/>
</ComboBox>
</StackPanel>
<StackPanel Orientation="Horizontal" Margin="0,6,0,0"
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}">
<TextBlock Text="{Binding NextOccurrenceLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
<TextBlock Text="{Binding NextOccurrenceText}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" Margin="4,0,0,0"/>
</StackPanel>
<TextBlock Text="{Binding DescriptionLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"
Height="72" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" FontSize="12"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,18,0,0">
<Button Content="{Binding CancelText}" Command="{Binding CancelCommand}" Style="{StaticResource DialogButton}"/>
<Button Content="{Binding SaveText}" Command="{Binding SaveCommand}" Style="{StaticResource DialogButton}" IsDefault="True"
Background="{DynamicResource PrimaryBrush}" Foreground="White" BorderThickness="0" Margin="8,0,0,0"/>
</StackPanel>
</StackPanel>
</Grid>
</Border>
</Window>