Upcoming view, search/filters, lead reminders, birthdays, folder colors, ICS, sound, undo
- Upcoming: all folders grouped by overdue/today/tomorrow/7 days/later/done - Search (Ctrl+F) + All/Today/Overdue filters + hide done (persisted) - Lead reminder 1/2/3 days or 1 week before; birth year shows age - Several due reminders are combined into one balloon - Folder colors and reordering (drag, context menu) - iCalendar export with RRULE and VALARM - Generated reminder chime (ComfyUI / Stable Audio), can be turned off - Undo snackbar for deleted tasks/folders (Ctrl+Z), Ctrl+N, Del, Esc - 41 tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2
App.xaml
2
App.xaml
@@ -12,5 +12,7 @@
|
|||||||
<converters:DatePassedConverter x:Key="DatePassed"/>
|
<converters:DatePassedConverter x:Key="DatePassed"/>
|
||||||
<converters:InverseBoolConverter x:Key="InverseBool"/>
|
<converters:InverseBoolConverter x:Key="InverseBool"/>
|
||||||
<converters:InverseBoolToVisibilityConverter x:Key="InverseBoolToVisibility"/>
|
<converters:InverseBoolToVisibilityConverter x:Key="InverseBoolToVisibility"/>
|
||||||
|
<converters:BucketHeaderConverter x:Key="BucketHeader"/>
|
||||||
|
<converters:HexToBrushConverter x:Key="HexToBrush"/>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
|||||||
BIN
Assets/Audio/sfx_reminder.mp3
Normal file
BIN
Assets/Audio/sfx_reminder.mp3
Normal file
Binary file not shown.
BIN
Assets/reminder.wav
Normal file
BIN
Assets/reminder.wav
Normal file
Binary file not shown.
56
Converters/TaskConverters.cs
Normal file
56
Converters/TaskConverters.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using ReminderOrganizer.Core;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Converters
|
||||||
|
{
|
||||||
|
/// <summary>Task → TaskBucket (group key for the "Upcoming" view).</summary>
|
||||||
|
public class TaskBucketConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
|
||||||
|
value is ReminderTask t ? TaskQuery.Bucket(t, DateTime.Now) : TaskBucket.Later;
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => Binding.DoNothing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>TaskBucket → localized group header ("Overdue", "Today", …).</summary>
|
||||||
|
public class BucketHeaderConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
var loc = ServiceLocator.Services.GetService(typeof(ILocalizationService)) as ILocalizationService;
|
||||||
|
var key = "Bucket" + value;
|
||||||
|
return loc?.GetString(key) ?? key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => Binding.DoNothing;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>"#RRGGBB" → brush; parameter = opacity 0..1 (optional).</summary>
|
||||||
|
public class HexToBrushConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var color = (Color)ColorConverter.ConvertFromString(value as string ?? Folder.DefaultColor);
|
||||||
|
if (parameter is string p && double.TryParse(p, NumberStyles.Float, CultureInfo.InvariantCulture, out var a))
|
||||||
|
color.A = (byte)(255 * Math.Clamp(a, 0, 1));
|
||||||
|
var brush = new SolidColorBrush(color);
|
||||||
|
brush.Freeze();
|
||||||
|
return brush;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return Brushes.SlateBlue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => Binding.DoNothing;
|
||||||
|
}
|
||||||
|
}
|
||||||
65
Core/TaskQuery.cs
Normal file
65
Core/TaskQuery.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Globalization;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Core
|
||||||
|
{
|
||||||
|
public enum TaskFilterMode { All, Today, Overdue }
|
||||||
|
|
||||||
|
/// <summary>Groups in the "Upcoming" view, in display order.</summary>
|
||||||
|
public enum TaskBucket { Overdue, Today, Tomorrow, ThisWeek, Later, Done }
|
||||||
|
|
||||||
|
/// <summary>Pure filter/sort/group rules for the task list.</summary>
|
||||||
|
public static class TaskQuery
|
||||||
|
{
|
||||||
|
public static TaskBucket Bucket(ReminderTask t, DateTime now)
|
||||||
|
{
|
||||||
|
if (t.IsNotified) return TaskBucket.Done;
|
||||||
|
if (t.ReminderDate < now) return TaskBucket.Overdue;
|
||||||
|
var days = (t.ReminderDate.Date - now.Date).Days;
|
||||||
|
return days switch
|
||||||
|
{
|
||||||
|
0 => TaskBucket.Today,
|
||||||
|
1 => TaskBucket.Tomorrow,
|
||||||
|
< 7 => TaskBucket.ThisWeek,
|
||||||
|
_ => TaskBucket.Later
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool Matches(ReminderTask t, string? search, TaskFilterMode mode, bool hideDone, DateTime now)
|
||||||
|
{
|
||||||
|
if (hideDone && t.IsNotified) return false;
|
||||||
|
switch (mode)
|
||||||
|
{
|
||||||
|
case TaskFilterMode.Today when t.ReminderDate.Date != now.Date: return false;
|
||||||
|
case TaskFilterMode.Overdue when t.IsNotified || t.ReminderDate >= now: return false;
|
||||||
|
}
|
||||||
|
if (string.IsNullOrWhiteSpace(search)) return true;
|
||||||
|
var s = search.Trim();
|
||||||
|
return Contains(t.Name, s) || Contains(t.Description, s) || Contains(t.FolderName, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool Contains(string? text, string s) =>
|
||||||
|
text != null && CultureInfo.CurrentCulture.CompareInfo.IndexOf(text, s, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace) >= 0;
|
||||||
|
|
||||||
|
/// <summary>Sort: bucket (overdue, today, … done), then date, then name.</summary>
|
||||||
|
public sealed class Comparer : IComparer
|
||||||
|
{
|
||||||
|
private readonly Func<DateTime> _now;
|
||||||
|
public Comparer(Func<DateTime>? now = null) => _now = now ?? (() => DateTime.Now);
|
||||||
|
|
||||||
|
public int Compare(object? x, object? y)
|
||||||
|
{
|
||||||
|
if (x is not ReminderTask a || y is not ReminderTask b) return 0;
|
||||||
|
var now = _now();
|
||||||
|
int c = Bucket(a, now).CompareTo(Bucket(b, now));
|
||||||
|
if (c != 0) return c;
|
||||||
|
c = a.IsNotified ? b.ReminderDate.CompareTo(a.ReminderDate) // done: newest first
|
||||||
|
: a.ReminderDate.CompareTo(b.ReminderDate);
|
||||||
|
return c != 0 ? c : string.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,5 +88,38 @@
|
|||||||
"ConfirmDeleteTask": "Aufgabe \"{0}\" löschen?",
|
"ConfirmDeleteTask": "Aufgabe \"{0}\" löschen?",
|
||||||
"ImportSkipped": "({0} Zeilen übersprungen)",
|
"ImportSkipped": "({0} Zeilen übersprungen)",
|
||||||
"PastDateWarning": "Das Datum liegt in der Vergangenheit – die Erinnerung kommt sofort.",
|
"PastDateWarning": "Das Datum liegt in der Vergangenheit – die Erinnerung kommt sofort.",
|
||||||
"MinimizedToTray": "Läuft weiter im Infobereich. Doppelklick aufs Symbol öffnet das Fenster."
|
"MinimizedToTray": "Läuft weiter im Infobereich. Doppelklick aufs Symbol öffnet das Fenster.",
|
||||||
|
"Upcoming": "Anstehend",
|
||||||
|
"CountOfTotal": "{0} von {1} Tasks",
|
||||||
|
"NoMatches": "Keine passenden Tasks",
|
||||||
|
"NoMatchesHint": "Andere Suche oder anderen Filter probieren.",
|
||||||
|
"SearchPlaceholder": "Suchen… (Strg+F)",
|
||||||
|
"FilterAll": "Alle",
|
||||||
|
"FilterToday": "Heute",
|
||||||
|
"FilterOverdue": "Überfällig",
|
||||||
|
"HideDone": "Erledigte ausblenden",
|
||||||
|
"PlaySound": "Erinnerungston",
|
||||||
|
"ExportIcs": "Kalender exportieren (.ics)",
|
||||||
|
"Color": "Farbe",
|
||||||
|
"MoveUp": "Nach oben",
|
||||||
|
"MoveDown": "Nach unten",
|
||||||
|
"Undo": "Rückgängig",
|
||||||
|
"DeletedItem": "„{0}“ gelöscht",
|
||||||
|
"TurnsAge": "wird {0}",
|
||||||
|
"LeadReminder": "Vorher erinnern",
|
||||||
|
"LeadNone": "Nein",
|
||||||
|
"LeadOneDay": "1 Tag vorher",
|
||||||
|
"LeadDays": "{0} Tage vorher",
|
||||||
|
"LeadWeek": "1 Woche vorher",
|
||||||
|
"BirthYear": "Geburtsjahr (optional)",
|
||||||
|
"TodayAt": "heute {0}",
|
||||||
|
"TomorrowAt": "morgen {0}",
|
||||||
|
"InDays": "in {0} Tagen",
|
||||||
|
"RemindersCount": "{0} Erinnerungen",
|
||||||
|
"BucketOverdue": "ÜBERFÄLLIG",
|
||||||
|
"BucketToday": "HEUTE",
|
||||||
|
"BucketTomorrow": "MORGEN",
|
||||||
|
"BucketThisWeek": "NÄCHSTE 7 TAGE",
|
||||||
|
"BucketLater": "SPÄTER",
|
||||||
|
"BucketDone": "ERLEDIGT"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,5 +88,38 @@
|
|||||||
"ConfirmDeleteTask": "Delete task \"{0}\"?",
|
"ConfirmDeleteTask": "Delete task \"{0}\"?",
|
||||||
"ImportSkipped": "({0} rows skipped)",
|
"ImportSkipped": "({0} rows skipped)",
|
||||||
"PastDateWarning": "This date is in the past – the reminder will show right away.",
|
"PastDateWarning": "This date is in the past – the reminder will show right away.",
|
||||||
"MinimizedToTray": "Still running in the tray. Double-click the icon to open."
|
"MinimizedToTray": "Still running in the tray. Double-click the icon to open.",
|
||||||
|
"Upcoming": "Upcoming",
|
||||||
|
"CountOfTotal": "{0} of {1} tasks",
|
||||||
|
"NoMatches": "No matching tasks",
|
||||||
|
"NoMatchesHint": "Try a different search or filter.",
|
||||||
|
"SearchPlaceholder": "Search… (Ctrl+F)",
|
||||||
|
"FilterAll": "All",
|
||||||
|
"FilterToday": "Today",
|
||||||
|
"FilterOverdue": "Overdue",
|
||||||
|
"HideDone": "Hide done",
|
||||||
|
"PlaySound": "Reminder sound",
|
||||||
|
"ExportIcs": "Export calendar (.ics)",
|
||||||
|
"Color": "Color",
|
||||||
|
"MoveUp": "Move up",
|
||||||
|
"MoveDown": "Move down",
|
||||||
|
"Undo": "Undo",
|
||||||
|
"DeletedItem": "\"{0}\" deleted",
|
||||||
|
"TurnsAge": "turns {0}",
|
||||||
|
"LeadReminder": "Remind in advance",
|
||||||
|
"LeadNone": "No",
|
||||||
|
"LeadOneDay": "1 day before",
|
||||||
|
"LeadDays": "{0} days before",
|
||||||
|
"LeadWeek": "1 week before",
|
||||||
|
"BirthYear": "Year of birth (optional)",
|
||||||
|
"TodayAt": "today {0}",
|
||||||
|
"TomorrowAt": "tomorrow {0}",
|
||||||
|
"InDays": "in {0} days",
|
||||||
|
"RemindersCount": "{0} reminders",
|
||||||
|
"BucketOverdue": "OVERDUE",
|
||||||
|
"BucketToday": "TODAY",
|
||||||
|
"BucketTomorrow": "TOMORROW",
|
||||||
|
"BucketThisWeek": "NEXT 7 DAYS",
|
||||||
|
"BucketLater": "LATER",
|
||||||
|
"BucketDone": "DONE"
|
||||||
}
|
}
|
||||||
|
|||||||
305
MainWindow.xaml
305
MainWindow.xaml
@@ -8,7 +8,8 @@
|
|||||||
MinHeight="550" MinWidth="900"
|
MinHeight="550" MinWidth="900"
|
||||||
WindowStyle="None"
|
WindowStyle="None"
|
||||||
AllowsTransparency="True"
|
AllowsTransparency="True"
|
||||||
Background="Transparent">
|
Background="Transparent"
|
||||||
|
PreviewKeyDown="Window_PreviewKeyDown">
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<!-- Animation Durations -->
|
<!-- Animation Durations -->
|
||||||
<Duration x:Key="QuickAnimation">0:0:0.15</Duration>
|
<Duration x:Key="QuickAnimation">0:0:0.15</Duration>
|
||||||
@@ -42,6 +43,34 @@
|
|||||||
<!-- Folder outline icon (16x16) -->
|
<!-- Folder outline icon (16x16) -->
|
||||||
<Geometry x:Key="FolderGeometry">M1.5,3.5 L6,3.5 L7.5,5 L14.5,5 L14.5,13.5 L1.5,13.5 Z</Geometry>
|
<Geometry x:Key="FolderGeometry">M1.5,3.5 L6,3.5 L7.5,5 L14.5,5 L14.5,13.5 L1.5,13.5 Z</Geometry>
|
||||||
|
|
||||||
|
<!-- Segmented filter chip -->
|
||||||
|
<Style x:Key="FilterChip" TargetType="RadioButton">
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="FontSize" Value="12"/>
|
||||||
|
<Setter Property="Margin" Value="0,0,6,0"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="RadioButton">
|
||||||
|
<Border x:Name="bd" CornerRadius="14" Padding="12,5" Background="Transparent"
|
||||||
|
BorderThickness="1" BorderBrush="{DynamicResource BorderBrush}">
|
||||||
|
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="bd" Property="Background" Value="{DynamicResource BadgeBrush}"/>
|
||||||
|
<Setter TargetName="bd" Property="BorderBrush" Value="{DynamicResource BadgeBrush}"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource BadgeTextBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
<!-- Round "done" check that follows the theme -->
|
<!-- Round "done" check that follows the theme -->
|
||||||
<Style x:Key="DoneCheck" TargetType="CheckBox">
|
<Style x:Key="DoneCheck" TargetType="CheckBox">
|
||||||
<Setter Property="Cursor" Value="Hand"/>
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
@@ -379,9 +408,9 @@
|
|||||||
<DockPanel Margin="8,4">
|
<DockPanel Margin="8,4">
|
||||||
<!-- Window Controls on Right -->
|
<!-- Window Controls on Right -->
|
||||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
<Button Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="MinimizeButton_Click" FontSize="10" ToolTip="{Binding MinimizeTooltip}"/>
|
<Button Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="MinimizeButton_Click" FontSize="10" ToolTip="{Binding [Minimize]}"/>
|
||||||
<Button x:Name="MaximizeButton" Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="MaximizeButton_Click" FontSize="10" ToolTip="{Binding MaximizeTooltip}"/>
|
<Button x:Name="MaximizeButton" Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="MaximizeButton_Click" FontSize="10" ToolTip="{Binding [Maximize]}"/>
|
||||||
<Button Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="CloseButton_Click" FontSize="10" Foreground="{DynamicResource DangerBrush}" ToolTip="{Binding CloseTooltip}"/>
|
<Button Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="CloseButton_Click" FontSize="10" Foreground="{DynamicResource DangerBrush}" ToolTip="{Binding [Close]}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Menu Bar on Left -->
|
<!-- Menu Bar on Left -->
|
||||||
@@ -389,22 +418,22 @@
|
|||||||
<!-- App Icon and Title -->
|
<!-- App Icon and Title -->
|
||||||
<StackPanel Orientation="Horizontal" Margin="8,0,20,0" VerticalAlignment="Center">
|
<StackPanel Orientation="Horizontal" Margin="8,0,20,0" VerticalAlignment="Center">
|
||||||
<Image Source="/Assets/app.png" Width="26" Height="26" Margin="0,0,10,0" RenderOptions.BitmapScalingMode="HighQuality"/>
|
<Image Source="/Assets/app.png" Width="26" Height="26" Margin="0,0,10,0" RenderOptions.BitmapScalingMode="HighQuality"/>
|
||||||
<TextBlock Text="{Binding AppTitleText}" FontSize="14" FontWeight="SemiBold"
|
<TextBlock Text="{Binding [AppTitle]}" FontSize="14" FontWeight="SemiBold"
|
||||||
Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Menus -->
|
<!-- Menus -->
|
||||||
<Menu Background="Transparent" Foreground="{DynamicResource TextPrimaryBrush}">
|
<Menu Background="Transparent" Foreground="{DynamicResource TextPrimaryBrush}">
|
||||||
<MenuItem Header="{Binding FileText}" Foreground="{DynamicResource TextPrimaryBrush}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [File]}" Foreground="{DynamicResource TextPrimaryBrush}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem Header="{Binding SettingsText}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [Settings]}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem Header="{Binding LanguageText}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [Language]}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem Header="{Binding GermanText}" Command="{Binding SetLanguageDeCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [German]}" Command="{Binding SetLanguageDeCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||||
Visibility="{Binding IsGerman, Converter={StaticResource BoolToVisibility}}"/>
|
Visibility="{Binding IsGerman, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{Binding EnglishText}" Command="{Binding SetLanguageEnCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [English]}" Command="{Binding SetLanguageEnCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||||
Visibility="{Binding IsEnglish, Converter={StaticResource BoolToVisibility}}"/>
|
Visibility="{Binding IsEnglish, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
@@ -412,36 +441,48 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="{Binding AutostartText}" Command="{Binding ToggleAutostartCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [Autostart]}" Command="{Binding ToggleAutostartCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||||
Visibility="{Binding IsAutostartEnabled, Converter={StaticResource BoolToVisibility}}"/>
|
Visibility="{Binding IsAutostartEnabled, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{Binding TestNotificationText}" Command="{Binding TestNotificationCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
<MenuItem Header="{Binding [PlaySound]}" Command="{Binding TogglePlaySoundCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||||
|
Visibility="{Binding PlaySound, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{Binding ImportCsvText}" Command="{Binding ImportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [TestNotification]}" Command="{Binding TestNotificationCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding [ImportCsv]}" Command="{Binding ImportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{Binding ExportCsvText}" Command="{Binding ExportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [ExportCsv]}" Command="{Binding ExportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{Binding DiscordText}" Command="{Binding OpenDiscordCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [ExportIcs]}" Command="{Binding ExportIcsCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
|
<MenuItem.Icon>
|
||||||
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
</MenuItem.Icon>
|
||||||
|
</MenuItem>
|
||||||
|
<Separator/>
|
||||||
|
<MenuItem Header="{Binding [Discord]}" Command="{Binding OpenDiscordCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem.Icon>
|
<MenuItem.Icon>
|
||||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
</MenuItem.Icon>
|
</MenuItem.Icon>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="{Binding ExitText}" Command="{Binding ExitCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
<MenuItem Header="{Binding [Exit]}" Command="{Binding ExitCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="{Binding ViewText}" Style="{StaticResource DarkMenuItemStyle}">
|
<MenuItem Header="{Binding [View]}" Style="{StaticResource DarkMenuItemStyle}">
|
||||||
<MenuItem Header="{Binding DarkModeText}" Command="{Binding ToggleDarkModeCommand}" Style="{StaticResource DarkMenuItemStyle}"
|
<MenuItem Header="{Binding [DarkMode]}" Command="{Binding ToggleDarkModeCommand}" Style="{StaticResource DarkMenuItemStyle}"
|
||||||
Visibility="{Binding IsDarkMode, Converter={StaticResource InverseBoolToVisibility}}"/>
|
Visibility="{Binding IsDarkMode, Converter={StaticResource InverseBoolToVisibility}}"/>
|
||||||
<MenuItem Header="{Binding LightModeText}" Command="{Binding ToggleDarkModeCommand}" Style="{StaticResource DarkMenuItemStyle}"
|
<MenuItem Header="{Binding [LightMode]}" Command="{Binding ToggleDarkModeCommand}" Style="{StaticResource DarkMenuItemStyle}"
|
||||||
Visibility="{Binding IsDarkMode, Converter={StaticResource BoolToVisibility}}"/>
|
Visibility="{Binding IsDarkMode, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
@@ -463,7 +504,7 @@
|
|||||||
<StackPanel DockPanel.Dock="Bottom" Margin="16,0,16,12" Orientation="Horizontal" HorizontalAlignment="Center">
|
<StackPanel DockPanel.Dock="Bottom" Margin="16,0,16,12" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||||
<TextBlock Text="{Binding CopyrightText}" FontSize="11" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
<TextBlock Text="{Binding CopyrightText}" FontSize="11" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
||||||
<TextBlock Text=" · " FontSize="11" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
<TextBlock Text=" · " FontSize="11" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
||||||
<TextBlock FontSize="11" VerticalAlignment="Center" ToolTip="{Binding DiscordText}">
|
<TextBlock FontSize="11" VerticalAlignment="Center" ToolTip="{Binding [Discord]}">
|
||||||
<Hyperlink Command="{Binding OpenDiscordCommand}" Foreground="{DynamicResource PrimaryBrush}" TextDecorations="None">Discord</Hyperlink>
|
<Hyperlink Command="{Binding OpenDiscordCommand}" Foreground="{DynamicResource PrimaryBrush}" TextDecorations="None">Discord</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Text="{Binding VersionText}" FontSize="11" Margin="8,0,0,0" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
<TextBlock Text="{Binding VersionText}" FontSize="11" Margin="8,0,0,0" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
||||||
@@ -471,15 +512,48 @@
|
|||||||
|
|
||||||
<!-- Action Buttons -->
|
<!-- Action Buttons -->
|
||||||
<StackPanel DockPanel.Dock="Bottom" Margin="16,12,16,10">
|
<StackPanel DockPanel.Dock="Bottom" Margin="16,12,16,10">
|
||||||
<Button Content="{Binding AddFolderText}" Command="{Binding AddFolderCommand}"
|
<Button Content="{Binding [AddFolder]}" Command="{Binding AddFolderCommand}"
|
||||||
Style="{StaticResource ModernButton}" Height="36" FontSize="13" Margin="0"/>
|
Style="{StaticResource ModernButton}" Height="36" FontSize="13" Margin="0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- "Upcoming": all folders, grouped by date -->
|
||||||
|
<Border DockPanel.Dock="Top" x:Name="UpcomingEntry" Margin="14,16,14,0" Padding="10,7" CornerRadius="8" Cursor="Hand"
|
||||||
|
MouseLeftButtonUp="UpcomingEntry_Click">
|
||||||
|
<Border.Style>
|
||||||
|
<Style TargetType="Border">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="TextElement.Foreground" Value="{DynamicResource SidebarTextBrush}"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
<DataTrigger Binding="{Binding IsUpcomingMode}" Value="True">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
<Setter Property="TextElement.Foreground" Value="White"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="14" Margin="1,0,11,0" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Grid.Column="1" Text="{Binding [Upcoming]}" FontSize="13" FontWeight="Medium" VerticalAlignment="Center"/>
|
||||||
|
<Border Grid.Column="2" Background="{DynamicResource WarningBrush}" CornerRadius="9" MinWidth="22" Padding="6,1"
|
||||||
|
Visibility="{Binding UpcomingCount, Converter={StaticResource CountToVisibility}}">
|
||||||
|
<TextBlock Text="{Binding UpcomingCount}" FontSize="11" FontWeight="SemiBold" Foreground="White" HorizontalAlignment="Center"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
<!-- Folders Section (fills the remaining height) -->
|
<!-- Folders Section (fills the remaining height) -->
|
||||||
<TextBlock DockPanel.Dock="Top" Text="{Binding FoldersText}"
|
<TextBlock DockPanel.Dock="Top" Text="{Binding [Folders]}"
|
||||||
Foreground="{DynamicResource SidebarSecondaryBrush}"
|
Foreground="{DynamicResource SidebarSecondaryBrush}"
|
||||||
FontSize="11" FontWeight="SemiBold"
|
FontSize="11" FontWeight="SemiBold"
|
||||||
Margin="28,20,16,8"/>
|
Margin="28,16,16,6"/>
|
||||||
|
|
||||||
<TreeView x:Name="FolderTree" Margin="12,0,12,0"
|
<TreeView x:Name="FolderTree" Margin="12,0,12,0"
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
@@ -501,6 +575,8 @@
|
|||||||
<EventSetter Event="DragEnter" Handler="TreeViewItem_DragEnter"/>
|
<EventSetter Event="DragEnter" Handler="TreeViewItem_DragEnter"/>
|
||||||
<EventSetter Event="DragLeave" Handler="TreeViewItem_DragLeave"/>
|
<EventSetter Event="DragLeave" Handler="TreeViewItem_DragLeave"/>
|
||||||
<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_RightClick"/>
|
<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_RightClick"/>
|
||||||
|
<EventSetter Event="PreviewMouseLeftButtonDown" Handler="TreeViewItem_PreviewMouseLeftButtonDown"/>
|
||||||
|
<EventSetter Event="PreviewMouseMove" Handler="TreeViewItem_PreviewMouseMove"/>
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<Setter.Value>
|
<Setter.Value>
|
||||||
<ControlTemplate TargetType="TreeViewItem">
|
<ControlTemplate TargetType="TreeViewItem">
|
||||||
@@ -536,7 +612,8 @@
|
|||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Path Data="{StaticResource FolderGeometry}" Width="16" Height="16" Margin="0,0,10,0" VerticalAlignment="Center"
|
<Path Data="{StaticResource FolderGeometry}" Width="16" Height="16" Margin="0,0,10,0" VerticalAlignment="Center"
|
||||||
StrokeThickness="1.3" StrokeLineJoin="Round"
|
StrokeThickness="1.3" StrokeLineJoin="Round"
|
||||||
Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeViewItem}}"/>
|
Stroke="{Binding Color, Converter={StaticResource HexToBrush}}"
|
||||||
|
Fill="{Binding Color, Converter={StaticResource HexToBrush}, ConverterParameter=0.35}"/>
|
||||||
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="13" FontWeight="Medium" VerticalAlignment="Center"
|
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="13" FontWeight="Medium" VerticalAlignment="Center"
|
||||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding Name}"/>
|
TextTrimming="CharacterEllipsis" ToolTip="{Binding Name}"/>
|
||||||
<Border Grid.Column="2" Background="{DynamicResource BadgeBrush}" CornerRadius="9" MinWidth="22"
|
<Border Grid.Column="2" Background="{DynamicResource BadgeBrush}" CornerRadius="9" MinWidth="22"
|
||||||
@@ -549,10 +626,27 @@
|
|||||||
</TreeView.ItemTemplate>
|
</TreeView.ItemTemplate>
|
||||||
<TreeView.ContextMenu>
|
<TreeView.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem Header="{Binding AddTaskToFolderText}" Click="AddTaskToFolder_Click"/>
|
<MenuItem Header="{Binding [AddTaskToFolder]}" Click="AddTaskToFolder_Click"/>
|
||||||
<MenuItem Header="{Binding RenameText}" Command="{Binding RenameFolderCommand}"/>
|
<MenuItem Header="{Binding [Rename]}" Command="{Binding RenameFolderCommand}"/>
|
||||||
|
<MenuItem Header="{Binding [Color]}" ItemsSource="{Binding FolderColors}">
|
||||||
|
<MenuItem.ItemContainerStyle>
|
||||||
|
<Style TargetType="MenuItem">
|
||||||
|
<Setter Property="Command" Value="{Binding DataContext.SetFolderColorCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
|
||||||
|
<Setter Property="CommandParameter" Value="{Binding}"/>
|
||||||
|
<Setter Property="HeaderTemplate">
|
||||||
|
<Setter.Value>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border Width="60" Height="14" CornerRadius="7" Background="{Binding Converter={StaticResource HexToBrush}}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
</MenuItem.ItemContainerStyle>
|
||||||
|
</MenuItem>
|
||||||
|
<MenuItem Header="{Binding [MoveUp]}" Command="{Binding MoveFolderUpCommand}"/>
|
||||||
|
<MenuItem Header="{Binding [MoveDown]}" Command="{Binding MoveFolderDownCommand}"/>
|
||||||
<Separator/>
|
<Separator/>
|
||||||
<MenuItem Header="{Binding DeleteText}" Command="{Binding DeleteFolderCommand}" Foreground="{DynamicResource DangerBrush}"/>
|
<MenuItem Header="{Binding [Delete]}" Command="{Binding DeleteFolderCommand}" Foreground="{DynamicResource DangerBrush}"/>
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</TreeView.ContextMenu>
|
</TreeView.ContextMenu>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
@@ -562,37 +656,111 @@
|
|||||||
<!-- Main Content Area -->
|
<!-- Main Content Area -->
|
||||||
<Grid Grid.Column="1" Margin="24,20,24,24">
|
<Grid Grid.Column="1" Margin="24,20,24,24">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Header Section -->
|
<!-- Header Section -->
|
||||||
<DockPanel Grid.Row="0" Margin="0,0,0,16">
|
<DockPanel Grid.Row="0" Margin="0,0,0,16">
|
||||||
<Button DockPanel.Dock="Right" Content="{Binding AddTaskText}" Command="{Binding AddTaskCommand}"
|
<Button DockPanel.Dock="Right" Content="{Binding [AddTask]}" Command="{Binding AddTaskCommand}"
|
||||||
Style="{StaticResource ModernButton}" Padding="16,7" FontSize="13" Margin="0" VerticalAlignment="Center"/>
|
Style="{StaticResource ModernButton}" Padding="16,7" FontSize="13" Margin="0" VerticalAlignment="Center"/>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<Border Width="38" Height="38" CornerRadius="10" Background="{DynamicResource PrimaryBrush}"
|
<Border Width="38" Height="38" CornerRadius="10" Background="{Binding HeaderColor, Converter={StaticResource HexToBrush}}"
|
||||||
VerticalAlignment="Center" Margin="0,0,14,0">
|
VerticalAlignment="Center" Margin="0,0,14,0">
|
||||||
|
<Grid>
|
||||||
<Path Data="{StaticResource FolderGeometry}" Width="16" Height="16" Stretch="None" StrokeThickness="1.3" StrokeLineJoin="Round"
|
<Path Data="{StaticResource FolderGeometry}" Width="16" Height="16" Stretch="None" StrokeThickness="1.3" StrokeLineJoin="Round"
|
||||||
Stroke="White" HorizontalAlignment="Center" VerticalAlignment="Center">
|
Stroke="White" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Visibility="{Binding IsUpcomingMode, Converter={StaticResource InverseBoolToVisibility}}">
|
||||||
<Path.LayoutTransform>
|
<Path.LayoutTransform>
|
||||||
<ScaleTransform ScaleX="1.2" ScaleY="1.2"/>
|
<ScaleTransform ScaleX="1.2" ScaleY="1.2"/>
|
||||||
</Path.LayoutTransform>
|
</Path.LayoutTransform>
|
||||||
</Path>
|
</Path>
|
||||||
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="17" Foreground="White"
|
||||||
|
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||||
|
Visibility="{Binding IsUpcomingMode, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
<StackPanel VerticalAlignment="Center">
|
<StackPanel VerticalAlignment="Center">
|
||||||
<TextBlock Text="{Binding SelectedFolderName}" FontSize="19" FontWeight="Bold"
|
<TextBlock Text="{Binding HeaderTitle}" FontSize="19" FontWeight="Bold"
|
||||||
Foreground="{DynamicResource TextPrimaryBrush}" TextTrimming="CharacterEllipsis"/>
|
Foreground="{DynamicResource TextPrimaryBrush}" TextTrimming="CharacterEllipsis"/>
|
||||||
<TextBlock Text="{Binding TaskCountText}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,2,0,0"/>
|
<TextBlock Text="{Binding TaskCountText}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,2,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
|
<!-- Search + filters -->
|
||||||
|
<DockPanel Grid.Row="1" Margin="0,0,0,12" LastChildFill="False">
|
||||||
|
<Border DockPanel.Dock="Left" Width="280" Height="34" CornerRadius="8" BorderThickness="1"
|
||||||
|
Background="{DynamicResource CardBrush}" BorderBrush="{DynamicResource BorderBrush}">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Margin="11,0,0,0" VerticalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}" IsHitTestVisible="False"/>
|
||||||
|
<TextBox x:Name="SearchBox" Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged, Delay=150}"
|
||||||
|
Background="Transparent" BorderThickness="0" Padding="32,0,28,0" VerticalContentAlignment="Center" FontSize="13"
|
||||||
|
Foreground="{DynamicResource TextPrimaryBrush}" CaretBrush="{DynamicResource TextPrimaryBrush}"/>
|
||||||
|
<TextBlock Text="{Binding [SearchPlaceholder]}" FontSize="13" Margin="34,0,0,0" VerticalAlignment="Center" IsHitTestVisible="False"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}">
|
||||||
|
<TextBlock.Style>
|
||||||
|
<Style TargetType="TextBlock">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||||
|
<Setter Property="Visibility" Value="Visible"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</TextBlock.Style>
|
||||||
|
</TextBlock>
|
||||||
|
<Button Content="" FontFamily="Segoe MDL2 Assets" FontSize="10" HorizontalAlignment="Right" Width="28"
|
||||||
|
Background="Transparent" BorderThickness="0" Cursor="Hand" Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
Command="{Binding ClearSearchCommand}" ToolTip="Esc">
|
||||||
|
<Button.Style>
|
||||||
|
<Style TargetType="Button">
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding Text, ElementName=SearchBox}" Value="">
|
||||||
|
<Setter Property="Visibility" Value="Collapsed"/>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Button.Style>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<StackPanel DockPanel.Dock="Left" Orientation="Horizontal" Margin="12,0,0,0" VerticalAlignment="Center">
|
||||||
|
<RadioButton Content="{Binding [FilterAll]}" IsChecked="{Binding IsFilterAll}" Style="{StaticResource FilterChip}"/>
|
||||||
|
<RadioButton Content="{Binding [FilterToday]}" IsChecked="{Binding IsFilterToday}" Style="{StaticResource FilterChip}"/>
|
||||||
|
<RadioButton Content="{Binding [FilterOverdue]}" IsChecked="{Binding IsFilterOverdue}" Style="{StaticResource FilterChip}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<CheckBox DockPanel.Dock="Right" IsChecked="{Binding HideDone}" VerticalAlignment="Center" Cursor="Hand"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}" FontSize="12">
|
||||||
|
<CheckBox.Template>
|
||||||
|
<ControlTemplate TargetType="CheckBox">
|
||||||
|
<StackPanel Orientation="Horizontal" Background="Transparent">
|
||||||
|
<Border x:Name="track" Width="30" Height="16" CornerRadius="8" Background="{DynamicResource BorderBrush}">
|
||||||
|
<Ellipse x:Name="knob" Width="12" Height="12" Fill="White" HorizontalAlignment="Left" Margin="2,0"/>
|
||||||
|
</Border>
|
||||||
|
<ContentPresenter Margin="8,0,0,0" VerticalAlignment="Center"/>
|
||||||
|
</StackPanel>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter TargetName="track" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
<Setter TargetName="knob" Property="HorizontalAlignment" Value="Right"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</CheckBox.Template>
|
||||||
|
<TextBlock Text="{Binding [HideDone]}" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
</CheckBox>
|
||||||
|
</DockPanel>
|
||||||
|
|
||||||
<!-- Tasks List -->
|
<!-- Tasks List -->
|
||||||
<Border Grid.Row="1" Style="{StaticResource ModernCard}">
|
<Border Grid.Row="2" Style="{StaticResource ModernCard}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<!-- task list view -->
|
<!-- task list view -->
|
||||||
<Grid Visibility="{Binding SelectedFolderTasks.Count, Converter={StaticResource CountToVisibility}}">
|
<Grid Visibility="{Binding HasVisibleTasks, Converter={StaticResource BoolToVisibility}}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
@@ -608,15 +776,29 @@
|
|||||||
<ColumnDefinition Width="96"/>
|
<ColumnDefinition Width="96"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Text="" Grid.Column="0" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
<TextBlock Text="" Grid.Column="0" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
<TextBlock Text="{Binding NameColumnText}" Grid.Column="1" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
<TextBlock Text="{Binding [Name]}" Grid.Column="1" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
<TextBlock Text="{Binding DateColumnText}" Grid.Column="2" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
<TextBlock Text="{Binding [Date]}" Grid.Column="2" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
<TextBlock Text="" Grid.Column="3" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
<TextBlock Text="" Grid.Column="3" Foreground="{DynamicResource TextSecondaryBrush}" FontSize="11" FontWeight="SemiBold"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- Tasks -->
|
<!-- Tasks -->
|
||||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||||
<ItemsControl ItemsSource="{Binding SelectedFolderTasksView}" Margin="0,4,0,0">
|
<ItemsControl ItemsSource="{Binding TasksView}" Margin="0,4,0,0">
|
||||||
|
<ItemsControl.GroupStyle>
|
||||||
|
<GroupStyle>
|
||||||
|
<GroupStyle.HeaderTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="14,12,0,4">
|
||||||
|
<TextBlock Text="{Binding Name, Converter={StaticResource BucketHeader}}" FontSize="11" FontWeight="Bold"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
<TextBlock Text="{Binding ItemCount}" FontSize="11" Margin="6,0,0,0" Opacity="0.7"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
</StackPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</GroupStyle.HeaderTemplate>
|
||||||
|
</GroupStyle>
|
||||||
|
</ItemsControl.GroupStyle>
|
||||||
<ItemsControl.ItemTemplate>
|
<ItemsControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<!-- compact table row: no box, divider line, hover background -->
|
<!-- compact table row: no box, divider line, hover background -->
|
||||||
@@ -670,13 +852,33 @@
|
|||||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="11" Margin="8,0,0,0" VerticalAlignment="Center"
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="11" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||||
Foreground="{DynamicResource PrimaryBrush}"
|
Foreground="{DynamicResource PrimaryBrush}"
|
||||||
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}"
|
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}"
|
||||||
ToolTip="{Binding DataContext.RecurringTaskTooltipText, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
ToolTip="{Binding DataContext[RecurringTaskTooltip], RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||||
|
<!-- birthday age -->
|
||||||
|
<Border Margin="8,0,0,0" CornerRadius="8" Padding="7,0" VerticalAlignment="Center" Background="{DynamicResource BadgeBrush}"
|
||||||
|
Visibility="{Binding AgeText, Converter={StaticResource StringToVisibility}}">
|
||||||
|
<TextBlock Text="{Binding AgeText}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource BadgeTextBrush}"/>
|
||||||
|
</Border>
|
||||||
|
<!-- lead reminder -->
|
||||||
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="11" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
Visibility="{Binding LeadDays, Converter={StaticResource CountToVisibility}}"
|
||||||
|
ToolTip="{Binding DataContext[LeadReminder], RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,1,0,0">
|
||||||
|
<!-- folder tag (only in "Upcoming") -->
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,0,8,0"
|
||||||
|
Visibility="{Binding DataContext.IsUpcomingMode, RelativeSource={RelativeSource AncestorType=Window}, Converter={StaticResource BoolToVisibility}}">
|
||||||
|
<Ellipse Width="7" Height="7" Fill="{Binding FolderColor, Converter={StaticResource HexToBrush}}" VerticalAlignment="Center"/>
|
||||||
|
<TextBlock Text="{Binding FolderName}" FontSize="11.5" Margin="5,0,0,0" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||||
|
<TextBlock Text=" ·" FontSize="11.5" Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
|
Visibility="{Binding Description, Converter={StaticResource StringToVisibility}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Text="{Binding Description}" FontSize="11.5"
|
<TextBlock Text="{Binding Description}" FontSize="11.5"
|
||||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
TextTrimming="CharacterEllipsis" Margin="0,1,0,0"
|
TextTrimming="CharacterEllipsis"
|
||||||
Visibility="{Binding Description, Converter={StaticResource StringToVisibility}}"/>
|
Visibility="{Binding Description, Converter={StaticResource StringToVisibility}}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Date -->
|
<!-- Date -->
|
||||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||||
@@ -692,14 +894,14 @@
|
|||||||
Style="{StaticResource DoneCheck}"
|
Style="{StaticResource DoneCheck}"
|
||||||
Command="{Binding DataContext.ToggleDoneCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
Command="{Binding DataContext.ToggleDoneCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
ToolTip="{Binding DataContext.DoneTooltip, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
ToolTip="{Binding DataContext[DoneTooltip], RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||||
<Button Content="" FontFamily="Segoe MDL2 Assets"
|
<Button Content="" FontFamily="Segoe MDL2 Assets"
|
||||||
Command="{Binding DataContext.EditTaskCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
Command="{Binding DataContext.EditTaskCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||||
CommandParameter="{Binding}"
|
CommandParameter="{Binding}"
|
||||||
Background="Transparent" BorderThickness="0"
|
Background="Transparent" BorderThickness="0"
|
||||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
Cursor="Hand" FontSize="13" Padding="6,4"
|
Cursor="Hand" FontSize="13" Padding="6,4"
|
||||||
ToolTip="{Binding DataContext.EditTaskTooltip, RelativeSource={RelativeSource AncestorType=Window}}">
|
ToolTip="{Binding DataContext[EditTaskTooltip], RelativeSource={RelativeSource AncestorType=Window}}">
|
||||||
<Button.Style>
|
<Button.Style>
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
<Setter Property="Opacity" Value="0.5"/>
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
@@ -718,7 +920,7 @@
|
|||||||
Background="Transparent" BorderThickness="0"
|
Background="Transparent" BorderThickness="0"
|
||||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
Cursor="Hand" FontSize="13" Padding="6,4"
|
Cursor="Hand" FontSize="13" Padding="6,4"
|
||||||
ToolTip="{Binding DataContext.DeleteTaskTooltip, RelativeSource={RelativeSource AncestorType=Window}}">
|
ToolTip="{Binding DataContext[DeleteTaskTooltip], RelativeSource={RelativeSource AncestorType=Window}}">
|
||||||
<Button.Style>
|
<Button.Style>
|
||||||
<Style TargetType="Button">
|
<Style TargetType="Button">
|
||||||
<Setter Property="Opacity" Value="0.5"/>
|
<Setter Property="Opacity" Value="0.5"/>
|
||||||
@@ -742,7 +944,7 @@
|
|||||||
|
|
||||||
<!-- Empty State -->
|
<!-- Empty State -->
|
||||||
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"
|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center"
|
||||||
Visibility="{Binding SelectedFolderTasks.Count, Converter={StaticResource ZeroToVisibility}}">
|
Visibility="{Binding HasVisibleTasks, Converter={StaticResource InverseBoolToVisibility}}">
|
||||||
<Border Width="72" Height="72" CornerRadius="36" Margin="0,0,0,18">
|
<Border Width="72" Height="72" CornerRadius="36" Margin="0,0,0,18">
|
||||||
<Border.Background>
|
<Border.Background>
|
||||||
<RadialGradientBrush>
|
<RadialGradientBrush>
|
||||||
@@ -755,15 +957,28 @@
|
|||||||
</Border.Effect>
|
</Border.Effect>
|
||||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="28" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="28" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||||
</Border>
|
</Border>
|
||||||
<TextBlock Text="{Binding NoTasks}"
|
<TextBlock Text="{Binding EmptyTitle}"
|
||||||
FontSize="18" FontWeight="SemiBold"
|
FontSize="18" FontWeight="SemiBold"
|
||||||
Foreground="{DynamicResource TextPrimaryBrush}" HorizontalAlignment="Center"/>
|
Foreground="{DynamicResource TextPrimaryBrush}" HorizontalAlignment="Center"/>
|
||||||
<TextBlock Text="{Binding CreateTaskHint}"
|
<TextBlock Text="{Binding EmptyHint}"
|
||||||
FontSize="14" Foreground="{DynamicResource TextSecondaryBrush}"
|
FontSize="14" Foreground="{DynamicResource TextSecondaryBrush}"
|
||||||
HorizontalAlignment="Center" Margin="0,10,0,0"/>
|
HorizontalAlignment="Center" Margin="0,10,0,0"/>
|
||||||
<Button Content="{Binding AddTaskText}" Command="{Binding AddTaskCommand}"
|
<Button Content="{Binding [AddTask]}" Command="{Binding AddTaskCommand}"
|
||||||
Style="{StaticResource ModernButton}" Margin="0,20,0,0" Padding="24,12"/>
|
Style="{StaticResource ModernButton}" Margin="0,20,0,0" Padding="24,12"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Undo snackbar -->
|
||||||
|
<Border VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,8" CornerRadius="10" Padding="16,8,8,8"
|
||||||
|
Background="#1E1E2A" Visibility="{Binding IsUndoVisible, Converter={StaticResource BoolToVisibility}}">
|
||||||
|
<Border.Effect>
|
||||||
|
<DropShadowEffect BlurRadius="16" ShadowDepth="3" Opacity="0.3" Color="Black"/>
|
||||||
|
</Border.Effect>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<TextBlock Text="{Binding UndoText}" Foreground="White" FontSize="13" VerticalAlignment="Center" MaxWidth="380" TextTrimming="CharacterEllipsis"/>
|
||||||
|
<Button Content="{Binding [Undo]}" Command="{Binding UndoCommand}" Margin="16,0,0,0" Padding="10,4" Cursor="Hand"
|
||||||
|
Background="Transparent" BorderThickness="0" Foreground="#A5B4FC" FontWeight="SemiBold" FontSize="13"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -78,18 +78,24 @@ namespace ReminderOrganizer
|
|||||||
|
|
||||||
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(MainViewModel.SelectedFolder))
|
if (e.PropertyName is nameof(MainViewModel.SelectedFolder) or nameof(MainViewModel.IsUpcomingMode))
|
||||||
SyncTreeSelection();
|
SyncTreeSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>TreeView.SelectedItem is read-only – mirror the view model selection onto the container.</summary>
|
/// <summary>TreeView.SelectedItem is read-only – mirror the view model selection onto the container.</summary>
|
||||||
private void SyncTreeSelection()
|
private void SyncTreeSelection()
|
||||||
{
|
{
|
||||||
var folder = _viewModel.SelectedFolder;
|
|
||||||
if (folder == null) return;
|
|
||||||
Dispatcher.BeginInvoke(() =>
|
Dispatcher.BeginInvoke(() =>
|
||||||
{
|
{
|
||||||
if (FolderTree.ItemContainerGenerator.ContainerFromItem(folder) is TreeViewItem item && !item.IsSelected)
|
if (_viewModel.IsUpcomingMode)
|
||||||
|
{
|
||||||
|
if (FolderTree.SelectedItem != null &&
|
||||||
|
FolderTree.ItemContainerGenerator.ContainerFromItem(FolderTree.SelectedItem) is TreeViewItem sel)
|
||||||
|
sel.IsSelected = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var folder = _viewModel.SelectedFolder;
|
||||||
|
if (folder != null && FolderTree.ItemContainerGenerator.ContainerFromItem(folder) is TreeViewItem item && !item.IsSelected)
|
||||||
{
|
{
|
||||||
item.IsSelected = true;
|
item.IsSelected = true;
|
||||||
item.BringIntoView();
|
item.BringIntoView();
|
||||||
@@ -97,6 +103,44 @@ namespace ReminderOrganizer
|
|||||||
}, System.Windows.Threading.DispatcherPriority.Loaded);
|
}, System.Windows.Threading.DispatcherPriority.Loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpcomingEntry_Click(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
_viewModel.IsUpcomingMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
bool ctrl = (Keyboard.Modifiers & ModifierKeys.Control) != 0;
|
||||||
|
if (ctrl && e.Key == Key.N)
|
||||||
|
{
|
||||||
|
if (_viewModel.AddTaskCommand.CanExecute(null)) _viewModel.AddTaskCommand.Execute(null);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
else if (ctrl && e.Key == Key.F)
|
||||||
|
{
|
||||||
|
SearchBox.Focus();
|
||||||
|
SearchBox.SelectAll();
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
else if (e.Key == Key.Escape && (SearchBox.IsKeyboardFocusWithin || _viewModel.SearchText.Length > 0))
|
||||||
|
{
|
||||||
|
_viewModel.ClearSearchCommand.Execute(null);
|
||||||
|
FolderTree.Focus();
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
else if (ctrl && e.Key == Key.Z && _viewModel.IsUndoVisible)
|
||||||
|
{
|
||||||
|
_viewModel.UndoCommand.Execute(null);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
else if (e.Key == Key.Delete && !SearchBox.IsKeyboardFocusWithin && _viewModel.SelectedTask != null)
|
||||||
|
{
|
||||||
|
_viewModel.DeleteTaskCommand.Execute(_viewModel.SelectedTask);
|
||||||
|
_viewModel.SelectedTask = null;
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void OnEditTaskRequested(object? sender, ReminderTask? task)
|
private void OnEditTaskRequested(object? sender, ReminderTask? task)
|
||||||
{
|
{
|
||||||
if (task == null) return;
|
if (task == null) return;
|
||||||
@@ -224,18 +268,43 @@ namespace ReminderOrganizer
|
|||||||
private void FolderTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
private void FolderTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||||
{
|
{
|
||||||
if (e.NewValue is Folder folder)
|
if (e.NewValue is Folder folder)
|
||||||
_viewModel.SelectedFolder = folder;
|
_viewModel.SelectFolder(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TreeViewItem_RightClick(object sender, MouseButtonEventArgs e)
|
private void TreeViewItem_RightClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is TreeViewItem treeViewItem && treeViewItem.DataContext is Folder folder)
|
if (sender is TreeViewItem treeViewItem && treeViewItem.DataContext is Folder folder)
|
||||||
{
|
{
|
||||||
_viewModel.SelectedFolder = folder;
|
_viewModel.SelectFolder(folder);
|
||||||
treeViewItem.IsSelected = true;
|
treeViewItem.IsSelected = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A click on an already selected folder (e.g. coming back from "Upcoming") must switch too.
|
||||||
|
private Point _folderDragStart;
|
||||||
|
private Folder? _folderDragCandidate;
|
||||||
|
|
||||||
|
private void TreeViewItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is TreeViewItem item && item.DataContext is Folder folder)
|
||||||
|
{
|
||||||
|
_folderDragStart = e.GetPosition(this);
|
||||||
|
_folderDragCandidate = folder;
|
||||||
|
if (item.IsSelected) _viewModel.SelectFolder(folder);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void TreeViewItem_PreviewMouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton != MouseButtonState.Pressed || _folderDragCandidate == null || sender is not TreeViewItem item) return;
|
||||||
|
var delta = e.GetPosition(this) - _folderDragStart;
|
||||||
|
if (Math.Abs(delta.Y) < SystemParameters.MinimumVerticalDragDistance * 2 &&
|
||||||
|
Math.Abs(delta.X) < SystemParameters.MinimumHorizontalDragDistance * 2) return;
|
||||||
|
var folder = _folderDragCandidate;
|
||||||
|
_folderDragCandidate = null;
|
||||||
|
DragDrop.DoDragDrop(item, folder, DragDropEffects.Move);
|
||||||
|
}
|
||||||
|
|
||||||
private void AddTaskToFolder_Click(object sender, RoutedEventArgs e)
|
private void AddTaskToFolder_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_viewModel.SelectedFolder != null)
|
if (_viewModel.SelectedFolder != null)
|
||||||
@@ -329,15 +398,18 @@ namespace ReminderOrganizer
|
|||||||
// Drops on a folder are handled by TreeViewItem_Drop; empty space does nothing.
|
// Drops on a folder are handled by TreeViewItem_Drop; empty space does nothing.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsOurDrag(DragEventArgs e) =>
|
||||||
|
e.Data.GetDataPresent(typeof(ReminderTask)) || e.Data.GetDataPresent(typeof(Folder));
|
||||||
|
|
||||||
private void TreeViewItem_DragOver(object sender, DragEventArgs e)
|
private void TreeViewItem_DragOver(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
e.Effects = e.Data.GetDataPresent(typeof(ReminderTask)) ? DragDropEffects.Move : DragDropEffects.None;
|
e.Effects = IsOurDrag(e) ? DragDropEffects.Move : DragDropEffects.None;
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TreeViewItem_DragEnter(object sender, DragEventArgs e)
|
private void TreeViewItem_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is TreeViewItem item && e.Data.GetDataPresent(typeof(ReminderTask))) item.Tag = "DropTarget";
|
if (sender is TreeViewItem item && IsOurDrag(e)) item.Tag = "DropTarget";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TreeViewItem_DragLeave(object sender, DragEventArgs e)
|
private void TreeViewItem_DragLeave(object sender, DragEventArgs e)
|
||||||
@@ -350,10 +422,16 @@ namespace ReminderOrganizer
|
|||||||
if (sender is TreeViewItem treeViewItem)
|
if (sender is TreeViewItem treeViewItem)
|
||||||
{
|
{
|
||||||
treeViewItem.Tag = null;
|
treeViewItem.Tag = null;
|
||||||
if (e.Data.GetData(typeof(ReminderTask)) is ReminderTask task && treeViewItem.DataContext is Folder targetFolder)
|
if (treeViewItem.DataContext is not Folder targetFolder) return;
|
||||||
|
if (e.Data.GetData(typeof(ReminderTask)) is ReminderTask task)
|
||||||
{
|
{
|
||||||
_viewModel.MoveTaskToFolderCommand.Execute((task, targetFolder));
|
_viewModel.MoveTaskToFolderCommand.Execute((task, targetFolder));
|
||||||
}
|
}
|
||||||
|
else if (e.Data.GetData(typeof(Folder)) is Folder dragged && dragged != targetFolder)
|
||||||
|
{
|
||||||
|
_viewModel.MoveFolder(dragged, _viewModel.Folders.IndexOf(targetFolder));
|
||||||
|
_viewModel.SelectFolder(dragged);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace ReminderOrganizer.Models
|
|||||||
public DateTime ReminderDate
|
public DateTime ReminderDate
|
||||||
{
|
{
|
||||||
get => _reminderDate;
|
get => _reminderDate;
|
||||||
set => SetProperty(ref _reminderDate, value);
|
set { if (SetProperty(ref _reminderDate, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsNotified
|
public bool IsNotified
|
||||||
@@ -48,15 +48,60 @@ namespace ReminderOrganizer.Models
|
|||||||
public bool IsRecurring
|
public bool IsRecurring
|
||||||
{
|
{
|
||||||
get => _isRecurring;
|
get => _isRecurring;
|
||||||
set => SetProperty(ref _isRecurring, value);
|
set { if (SetProperty(ref _isRecurring, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecurrenceType RecurrenceType
|
public RecurrenceType RecurrenceType
|
||||||
{
|
{
|
||||||
get => _recurrenceType;
|
get => _recurrenceType;
|
||||||
set => SetProperty(ref _recurrenceType, value);
|
set { if (SetProperty(ref _recurrenceType, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int _leadDays;
|
||||||
|
/// <summary>Extra reminder this many days before the date (0 = none).</summary>
|
||||||
|
public int LeadDays
|
||||||
|
{
|
||||||
|
get => _leadDays;
|
||||||
|
set => SetProperty(ref _leadDays, Math.Max(0, value));
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool _isPreNotified;
|
||||||
|
/// <summary>Lead reminder already shown for the current occurrence.</summary>
|
||||||
|
public bool IsPreNotified
|
||||||
|
{
|
||||||
|
get => _isPreNotified;
|
||||||
|
set => SetProperty(ref _isPreNotified, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int? _birthYear;
|
||||||
|
/// <summary>Optional, for yearly birthdays: shows "turns 40".</summary>
|
||||||
|
public int? BirthYear
|
||||||
|
{
|
||||||
|
get => _birthYear;
|
||||||
|
set { if (SetProperty(ref _birthYear, value)) OnPropertyChanged(nameof(AgeText)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Age reached on the next date (yearly tasks with birth year only).</summary>
|
||||||
|
[System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public int? UpcomingAge =>
|
||||||
|
BirthYear is int y && IsRecurring && RecurrenceType == RecurrenceType.Yearly && ReminderDate.Year > y
|
||||||
|
? ReminderDate.Year - y : null;
|
||||||
|
|
||||||
|
/// <summary>Set once by the app (localized "turns {0}").</summary>
|
||||||
|
public static Func<int, string>? AgeFormatter { get; set; }
|
||||||
|
|
||||||
|
[System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public string? AgeText => UpcomingAge is int a ? (AgeFormatter?.Invoke(a) ?? a.ToString()) : null;
|
||||||
|
|
||||||
|
private string _folderName = "";
|
||||||
|
/// <summary>Runtime only: name of the folder holding this task (for the "Upcoming" view).</summary>
|
||||||
|
[System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public string FolderName { get => _folderName; set => SetProperty(ref _folderName, value); }
|
||||||
|
|
||||||
|
private string _folderColor = Folder.DefaultColor;
|
||||||
|
[System.Text.Json.Serialization.JsonIgnore]
|
||||||
|
public string FolderColor { get => _folderColor; set => SetProperty(ref _folderColor, value); }
|
||||||
|
|
||||||
public DateTime GetNextOccurrence() => GetNextOccurrence(DateTime.Now);
|
public DateTime GetNextOccurrence() => GetNextOccurrence(DateTime.Now);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -94,22 +139,32 @@ namespace ReminderOrganizer.Models
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Marks every due task: one-off tasks become notified, recurring ones move to their next date.
|
/// Marks every due task: one-off tasks become notified, recurring ones move to their next date.
|
||||||
/// Returns the tasks that should be shown as a notification now.
|
/// Also emits lead reminders (LeadDays before the date) once per occurrence.
|
||||||
|
/// Returns what should be shown now; for lead reminders <see cref="DueReminder.Date"/> is the upcoming date.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static System.Collections.Generic.List<ReminderTask> ProcessDue(System.Collections.Generic.IEnumerable<Folder> folders, DateTime now)
|
public static System.Collections.Generic.List<DueReminder> ProcessDue(System.Collections.Generic.IEnumerable<Folder> folders, DateTime now)
|
||||||
{
|
{
|
||||||
var due = new System.Collections.Generic.List<ReminderTask>();
|
var due = new System.Collections.Generic.List<DueReminder>();
|
||||||
foreach (var folder in folders)
|
foreach (var folder in folders)
|
||||||
{
|
{
|
||||||
foreach (var task in folder.Tasks)
|
foreach (var task in folder.Tasks)
|
||||||
{
|
{
|
||||||
if (task.IsNotified || task.ReminderDate > now) continue;
|
if (task.IsNotified) continue;
|
||||||
due.Add(task);
|
if (task.ReminderDate <= now)
|
||||||
|
{
|
||||||
|
due.Add(new DueReminder(task, task.ReminderDate, false, task.UpcomingAge));
|
||||||
|
task.IsPreNotified = false;
|
||||||
if (task.IsRecurring)
|
if (task.IsRecurring)
|
||||||
task.ReminderDate = task.GetNextOccurrence(now);
|
task.ReminderDate = task.GetNextOccurrence(now);
|
||||||
else
|
else
|
||||||
task.IsNotified = true;
|
task.IsNotified = true;
|
||||||
}
|
}
|
||||||
|
else if (task.LeadDays > 0 && !task.IsPreNotified && now >= task.ReminderDate.AddDays(-task.LeadDays))
|
||||||
|
{
|
||||||
|
due.Add(new DueReminder(task, task.ReminderDate, true, task.UpcomingAge));
|
||||||
|
task.IsPreNotified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return due;
|
return due;
|
||||||
}
|
}
|
||||||
@@ -124,6 +179,9 @@ namespace ReminderOrganizer.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>One notification to show. Age is the age reached on <paramref name="Date"/> (birthdays).</summary>
|
||||||
|
public record DueReminder(ReminderTask Task, DateTime Date, bool IsLead, int? Age);
|
||||||
|
|
||||||
public enum RecurrenceType
|
public enum RecurrenceType
|
||||||
{
|
{
|
||||||
Daily,
|
Daily,
|
||||||
@@ -156,6 +214,17 @@ namespace ReminderOrganizer.Models
|
|||||||
set => SetProperty(ref _tasks, value);
|
set => SetProperty(ref _tasks, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public const string DefaultColor = "#6366F1";
|
||||||
|
public static readonly string[] Palette =
|
||||||
|
{ "#6366F1", "#3B82F6", "#14B8A6", "#22C55E", "#F59E0B", "#F97316", "#EF4444", "#EC4899", "#64748B" };
|
||||||
|
|
||||||
|
private string _color = DefaultColor;
|
||||||
|
public string Color
|
||||||
|
{
|
||||||
|
get => _color;
|
||||||
|
set => SetProperty(ref _color, string.IsNullOrWhiteSpace(value) ? DefaultColor : value);
|
||||||
|
}
|
||||||
|
|
||||||
public Folder() { }
|
public Folder() { }
|
||||||
|
|
||||||
public Folder(string name)
|
public Folder(string name)
|
||||||
@@ -171,5 +240,7 @@ namespace ReminderOrganizer.Models
|
|||||||
public string Language { get; set; } = "";
|
public string Language { get; set; } = "";
|
||||||
/// <summary>null = not chosen yet → Windows app theme.</summary>
|
/// <summary>null = not chosen yet → Windows app theme.</summary>
|
||||||
public bool? IsDarkMode { get; set; }
|
public bool? IsDarkMode { get; set; }
|
||||||
|
public bool PlaySound { get; set; } = true;
|
||||||
|
public bool HideDone { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -7,12 +7,17 @@ It runs in the system tray (notification area).
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Folders with tasks (date, time, description), sorted by date: open tasks first
|
- Folders with tasks (date, time, description), sorted overdue → today → later → done
|
||||||
|
- **Upcoming** view: every folder in one list, grouped by Overdue, Today, Tomorrow, Next 7 days, Later
|
||||||
|
- **Search** (Ctrl+F), filters All/Today/Overdue, "Hide done"
|
||||||
- One-off or recurring reminders (daily, weekly, monthly, yearly)
|
- One-off or recurring reminders (daily, weekly, monthly, yearly)
|
||||||
- Reminders missed while the app was closed are shown at the next start
|
- **Remind in advance** (1, 2 or 3 days, or 1 week before); **birthdays** with year of birth show "turns 40"
|
||||||
- Drag a task onto a folder to move it
|
- Reminders missed while the app was closed are shown at the next start, with a reminder sound (can be turned off)
|
||||||
|
- **Folder colors** and order (drag or context menu); drag a task onto a folder to move it
|
||||||
|
- **Undo** after deleting (Ctrl+Z), shortcuts Ctrl+N (new task), Del, Esc
|
||||||
- CSV import/export (`Folder;Name;Description;Date;IsRecurring;RecurrenceType`, date `yyyy-MM-dd HH:mm`)
|
- CSV import/export (`Folder;Name;Description;Date;IsRecurring;RecurrenceType`, date `yyyy-MM-dd HH:mm`)
|
||||||
- Dark/light theme, German/English
|
- **Calendar export (.ics)** for Outlook, Google and Apple Calendar (recurrence + advance reminder included)
|
||||||
|
- Dark/light theme, German/English; the first start follows the Windows settings
|
||||||
- Autostart with Windows, starting hidden in the tray (`--minimized`)
|
- Autostart with Windows, starting hidden in the tray (`--minimized`)
|
||||||
|
|
||||||
## Data
|
## Data
|
||||||
|
|||||||
@@ -39,6 +39,7 @@
|
|||||||
<EmbeddedResource Include="Locales\*.json" LogicalName="Locales.%(Filename).json" />
|
<EmbeddedResource Include="Locales\*.json" LogicalName="Locales.%(Filename).json" />
|
||||||
<Resource Include="Assets\app.ico" />
|
<Resource Include="Assets\app.ico" />
|
||||||
<Resource Include="Assets\app.png" />
|
<Resource Include="Assets\app.png" />
|
||||||
|
<Resource Include="Assets\reminder.wav" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
81
Services/IcsExport.cs
Normal file
81
Services/IcsExport.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
/// <summary>iCalendar (.ics) export for Outlook, Google Calendar, Apple Calendar.</summary>
|
||||||
|
public static class IcsExport
|
||||||
|
{
|
||||||
|
public static string Build(AppData data, DateTime utcNow)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
void Line(string s) => sb.Append(Fold(s)).Append("\r\n");
|
||||||
|
|
||||||
|
Line("BEGIN:VCALENDAR");
|
||||||
|
Line("VERSION:2.0");
|
||||||
|
Line("PRODID:-//Michael Media//Reminder Organizer//EN");
|
||||||
|
Line("CALSCALE:GREGORIAN");
|
||||||
|
var stamp = utcNow.ToUniversalTime().ToString("yyyyMMdd'T'HHmmss'Z'", CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
foreach (var folder in data.Folders)
|
||||||
|
{
|
||||||
|
foreach (var t in folder.Tasks)
|
||||||
|
{
|
||||||
|
if (t.IsNotified) continue;
|
||||||
|
Line("BEGIN:VEVENT");
|
||||||
|
Line($"UID:{t.Id}@reminder-organizer");
|
||||||
|
Line($"DTSTAMP:{stamp}");
|
||||||
|
// floating local time: shows at the same clock time in every calendar
|
||||||
|
Line($"DTSTART:{t.ReminderDate.ToString("yyyyMMdd'T'HHmmss", CultureInfo.InvariantCulture)}");
|
||||||
|
Line("DURATION:PT30M");
|
||||||
|
var summary = t.UpcomingAge is int age ? $"{t.Name} ({age})" : t.Name;
|
||||||
|
Line($"SUMMARY:{Escape(summary)}");
|
||||||
|
if (!string.IsNullOrWhiteSpace(t.Description)) Line($"DESCRIPTION:{Escape(t.Description)}");
|
||||||
|
Line($"CATEGORIES:{Escape(folder.Name)}");
|
||||||
|
if (t.IsRecurring)
|
||||||
|
{
|
||||||
|
var freq = t.RecurrenceType switch
|
||||||
|
{
|
||||||
|
RecurrenceType.Daily => "DAILY",
|
||||||
|
RecurrenceType.Weekly => "WEEKLY",
|
||||||
|
RecurrenceType.Monthly => "MONTHLY",
|
||||||
|
_ => "YEARLY"
|
||||||
|
};
|
||||||
|
Line($"RRULE:FREQ={freq}");
|
||||||
|
}
|
||||||
|
Line("BEGIN:VALARM");
|
||||||
|
Line("ACTION:DISPLAY");
|
||||||
|
Line($"DESCRIPTION:{Escape(t.Name)}");
|
||||||
|
Line(t.LeadDays > 0 ? $"TRIGGER:-P{t.LeadDays}D" : "TRIGGER:PT0M");
|
||||||
|
Line("END:VALARM");
|
||||||
|
Line("END:VEVENT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Line("END:VCALENDAR");
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string Escape(string s) =>
|
||||||
|
s.Replace("\\", "\\\\").Replace(";", "\\;").Replace(",", "\\,").Replace("\r\n", "\\n").Replace("\n", "\\n").Replace("\r", "");
|
||||||
|
|
||||||
|
/// <summary>RFC 5545: lines longer than 75 octets continue with CRLF + space.</summary>
|
||||||
|
public static string Fold(string line)
|
||||||
|
{
|
||||||
|
var bytes = Encoding.UTF8.GetByteCount(line);
|
||||||
|
if (bytes <= 75) return line;
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
int count = 0;
|
||||||
|
foreach (var ch in line)
|
||||||
|
{
|
||||||
|
int n = Encoding.UTF8.GetByteCount(ch.ToString());
|
||||||
|
if (count + n > 75) { sb.Append("\r\n "); count = 1; }
|
||||||
|
sb.Append(ch);
|
||||||
|
count += n;
|
||||||
|
}
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
32
Services/SoundService.cs
Normal file
32
Services/SoundService.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
#nullable enable
|
||||||
|
using System;
|
||||||
|
using System.Media;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Services
|
||||||
|
{
|
||||||
|
/// <summary>Plays the reminder chime (Assets/reminder.wav, embedded as WPF resource).</summary>
|
||||||
|
public static class SoundService
|
||||||
|
{
|
||||||
|
private static SoundPlayer? _player;
|
||||||
|
|
||||||
|
public static void PlayReminder()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (_player == null)
|
||||||
|
{
|
||||||
|
var res = Application.GetResourceStream(new Uri("pack://application:,,,/Assets/reminder.wav"));
|
||||||
|
if (res == null) { SystemSounds.Asterisk.Play(); return; }
|
||||||
|
_player = new SoundPlayer(res.Stream);
|
||||||
|
_player.Load();
|
||||||
|
}
|
||||||
|
_player.Play();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
System.Diagnostics.Debug.WriteLine($"[Sound] {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -182,6 +182,27 @@
|
|||||||
<TextBlock Text="{Binding NextOccurrenceText}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" Margin="4,0,0,0"/>
|
<TextBlock Text="{Binding NextOccurrenceText}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" Margin="4,0,0,0"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Birth year (yearly only) -->
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"
|
||||||
|
Visibility="{Binding IsYearly, Converter={StaticResource BoolToVisibility}}">
|
||||||
|
<TextBlock Text="{Binding BirthYearLabel}" FontSize="12" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center" Width="150"/>
|
||||||
|
<TextBox Text="{Binding BirthYearText, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}" Width="80" Padding="8,4" MaxLength="4"/>
|
||||||
|
<TextBlock Text="!" Foreground="#EF4444" FontWeight="Bold" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||||
|
Visibility="{Binding BirthYearError, Converter={StaticResource BoolToVisibility}}"/>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<!-- Lead reminder -->
|
||||||
|
<StackPanel Orientation="Horizontal" Margin="0,10,0,0">
|
||||||
|
<TextBlock Text="{Binding LeadLabel}" FontSize="12" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center" Width="150"/>
|
||||||
|
<ComboBox Width="120" Height="28" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedLeadIndex}">
|
||||||
|
<ComboBoxItem Content="{Binding LeadNone}"/>
|
||||||
|
<ComboBoxItem Content="{Binding Lead1}"/>
|
||||||
|
<ComboBoxItem Content="{Binding Lead2}"/>
|
||||||
|
<ComboBoxItem Content="{Binding Lead3}"/>
|
||||||
|
<ComboBoxItem Content="{Binding Lead7}"/>
|
||||||
|
</ComboBox>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock Text="{Binding DescriptionLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
|
<TextBlock Text="{Binding DescriptionLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
|
||||||
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"
|
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"
|
||||||
Height="72" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" FontSize="12"/>
|
Height="72" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" FontSize="12"/>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -58,7 +58,7 @@ namespace ReminderOrganizer.Tests
|
|||||||
|
|
||||||
var due = ReminderTask.ProcessDue(new[] { f }, now);
|
var due = ReminderTask.ProcessDue(new[] { f }, now);
|
||||||
|
|
||||||
Assert.Equal(new[] { "once", "rec" }, due.Select(t => t.Name));
|
Assert.Equal(new[] { "once", "rec" }, due.Select(d => d.Task.Name));
|
||||||
Assert.True(once.IsNotified);
|
Assert.True(once.IsNotified);
|
||||||
Assert.False(rec.IsNotified);
|
Assert.False(rec.IsNotified);
|
||||||
Assert.True(rec.ReminderDate > now);
|
Assert.True(rec.ReminderDate > now);
|
||||||
@@ -234,3 +234,4 @@ namespace ReminderOrganizer.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
182
Tests/FeatureTests.cs
Normal file
182
Tests/FeatureTests.cs
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using ReminderOrganizer.Core;
|
||||||
|
using ReminderOrganizer.Models;
|
||||||
|
using ReminderOrganizer.Services;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace ReminderOrganizer.Tests
|
||||||
|
{
|
||||||
|
public class LeadReminderTests
|
||||||
|
{
|
||||||
|
private static Folder FolderWith(params ReminderTask[] tasks)
|
||||||
|
{
|
||||||
|
var f = new Folder("f");
|
||||||
|
foreach (var t in tasks) f.Tasks.Add(t);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Lead_reminder_fires_once_then_main_reminder()
|
||||||
|
{
|
||||||
|
var date = new DateTime(2026, 12, 24, 18, 0, 0);
|
||||||
|
var t = new ReminderTask("Xmas", "", date) { LeadDays = 2 };
|
||||||
|
var f = FolderWith(t);
|
||||||
|
|
||||||
|
Assert.Empty(ReminderTask.ProcessDue(new[] { f }, date.AddDays(-3)));
|
||||||
|
|
||||||
|
var lead = ReminderTask.ProcessDue(new[] { f }, date.AddDays(-2));
|
||||||
|
Assert.Single(lead);
|
||||||
|
Assert.True(lead[0].IsLead);
|
||||||
|
Assert.Empty(ReminderTask.ProcessDue(new[] { f }, date.AddDays(-1))); // not twice
|
||||||
|
|
||||||
|
var main = ReminderTask.ProcessDue(new[] { f }, date);
|
||||||
|
Assert.Single(main);
|
||||||
|
Assert.False(main[0].IsLead);
|
||||||
|
Assert.True(t.IsNotified);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Recurring_lead_resets_for_next_occurrence()
|
||||||
|
{
|
||||||
|
var date = new DateTime(2026, 3, 19, 9, 0, 0);
|
||||||
|
var t = new ReminderTask("Bday", "", date) { IsRecurring = true, RecurrenceType = RecurrenceType.Yearly, LeadDays = 1 };
|
||||||
|
var f = FolderWith(t);
|
||||||
|
|
||||||
|
ReminderTask.ProcessDue(new[] { f }, date.AddDays(-1)); // lead
|
||||||
|
ReminderTask.ProcessDue(new[] { f }, date); // main → next year
|
||||||
|
Assert.Equal(new DateTime(2027, 3, 19, 9, 0, 0), t.ReminderDate);
|
||||||
|
Assert.False(t.IsPreNotified);
|
||||||
|
Assert.Single(ReminderTask.ProcessDue(new[] { f }, new DateTime(2027, 3, 18, 9, 0, 0)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Birthday_age_is_for_the_reminded_date()
|
||||||
|
{
|
||||||
|
var date = new DateTime(2026, 3, 19, 9, 0, 0);
|
||||||
|
var t = new ReminderTask("Michael", "", date) { IsRecurring = true, RecurrenceType = RecurrenceType.Yearly, BirthYear = 1986 };
|
||||||
|
Assert.Equal(40, t.UpcomingAge);
|
||||||
|
var due = ReminderTask.ProcessDue(new[] { FolderWith(t) }, date);
|
||||||
|
Assert.Equal(40, due[0].Age);
|
||||||
|
Assert.Equal(41, t.UpcomingAge); // already moved to 2027
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Age_only_for_yearly_recurring()
|
||||||
|
{
|
||||||
|
var t = new ReminderTask("x", "", new DateTime(2026, 1, 1)) { BirthYear = 2000, IsRecurring = true, RecurrenceType = RecurrenceType.Monthly };
|
||||||
|
Assert.Null(t.UpcomingAge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TaskQueryTests
|
||||||
|
{
|
||||||
|
private static readonly DateTime Now = new(2026, 11, 25, 12, 0, 0);
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[InlineData(-1, TaskBucket.Overdue)]
|
||||||
|
[InlineData(2, TaskBucket.Today)]
|
||||||
|
[InlineData(24, TaskBucket.Tomorrow)]
|
||||||
|
[InlineData(24 * 5, TaskBucket.ThisWeek)]
|
||||||
|
[InlineData(24 * 10, TaskBucket.Later)]
|
||||||
|
public void Buckets_by_date(int hours, TaskBucket expected)
|
||||||
|
{
|
||||||
|
Assert.Equal(expected, TaskQuery.Bucket(new ReminderTask("x", "", Now.AddHours(hours)), Now));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Done_is_its_own_bucket()
|
||||||
|
{
|
||||||
|
Assert.Equal(TaskBucket.Done, TaskQuery.Bucket(new ReminderTask("x", "", Now.AddHours(-5)) { IsNotified = true }, Now));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Search_ignores_case_and_accents_and_matches_folder()
|
||||||
|
{
|
||||||
|
var t = new ReminderTask("Zahnärztin", "Kontrolle", Now) { FolderName = "Gesundheit" };
|
||||||
|
Assert.True(TaskQuery.Matches(t, "zahnarztin", TaskFilterMode.All, false, Now));
|
||||||
|
Assert.True(TaskQuery.Matches(t, "kontr", TaskFilterMode.All, false, Now));
|
||||||
|
Assert.True(TaskQuery.Matches(t, "gesund", TaskFilterMode.All, false, Now));
|
||||||
|
Assert.False(TaskQuery.Matches(t, "auto", TaskFilterMode.All, false, Now));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Filters_today_overdue_hide_done()
|
||||||
|
{
|
||||||
|
var today = new ReminderTask("a", "", Now.AddHours(3));
|
||||||
|
var overdue = new ReminderTask("b", "", Now.AddDays(-2));
|
||||||
|
var done = new ReminderTask("c", "", Now.AddDays(-2)) { IsNotified = true };
|
||||||
|
|
||||||
|
Assert.True(TaskQuery.Matches(today, "", TaskFilterMode.Today, false, Now));
|
||||||
|
Assert.False(TaskQuery.Matches(overdue, "", TaskFilterMode.Today, false, Now));
|
||||||
|
Assert.True(TaskQuery.Matches(overdue, "", TaskFilterMode.Overdue, false, Now));
|
||||||
|
Assert.False(TaskQuery.Matches(done, "", TaskFilterMode.Overdue, false, Now));
|
||||||
|
Assert.False(TaskQuery.Matches(done, "", TaskFilterMode.All, true, Now));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Sort_overdue_first_then_date_done_last()
|
||||||
|
{
|
||||||
|
var later = new ReminderTask("later", "", Now.AddDays(20));
|
||||||
|
var soon = new ReminderTask("soon", "", Now.AddHours(1));
|
||||||
|
var overdue = new ReminderTask("overdue", "", Now.AddDays(-1));
|
||||||
|
var done = new ReminderTask("done", "", Now.AddDays(-30)) { IsNotified = true };
|
||||||
|
var list = new[] { done, later, soon, overdue }.ToList();
|
||||||
|
list.Sort((a, b) => new TaskQuery.Comparer(() => Now).Compare(a, b));
|
||||||
|
Assert.Equal(new[] { "overdue", "soon", "later", "done" }, list.Select(t => t.Name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class IcsTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Builds_events_with_rrule_alarm_and_escaping()
|
||||||
|
{
|
||||||
|
var data = new AppData();
|
||||||
|
var f = new Folder("Fam, Freunde");
|
||||||
|
f.Tasks.Add(new ReminderTask("Michael", "Geschenk; Karte", new DateTime(2027, 3, 19, 9, 0, 0))
|
||||||
|
{ IsRecurring = true, RecurrenceType = RecurrenceType.Yearly, LeadDays = 1, BirthYear = 1986 });
|
||||||
|
f.Tasks.Add(new ReminderTask("Done", "", new DateTime(2020, 1, 1)) { IsNotified = true });
|
||||||
|
data.Folders.Add(f);
|
||||||
|
|
||||||
|
var ics = IcsExport.Build(data, new DateTime(2026, 11, 25, 12, 0, 0, DateTimeKind.Utc));
|
||||||
|
|
||||||
|
Assert.StartsWith("BEGIN:VCALENDAR\r\n", ics);
|
||||||
|
Assert.EndsWith("END:VCALENDAR\r\n", ics);
|
||||||
|
Assert.Equal(1, ics.Split("BEGIN:VEVENT").Length - 1);
|
||||||
|
Assert.Contains("DTSTART:20270319T090000", ics);
|
||||||
|
Assert.Contains("RRULE:FREQ=YEARLY", ics);
|
||||||
|
Assert.Contains("TRIGGER:-P1D", ics);
|
||||||
|
Assert.Contains("SUMMARY:Michael (41)", ics);
|
||||||
|
Assert.Contains("DESCRIPTION:Geschenk\\; Karte", ics);
|
||||||
|
Assert.Contains("CATEGORIES:Fam\\, Freunde", ics);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Long_lines_are_folded()
|
||||||
|
{
|
||||||
|
var folded = IcsExport.Fold("DESCRIPTION:" + new string('ä', 80));
|
||||||
|
Assert.All(folded.Split("\r\n"), l => Assert.True(System.Text.Encoding.UTF8.GetByteCount(l) <= 75));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class SettingsTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void Language_follows_windows_culture()
|
||||||
|
{
|
||||||
|
Assert.Equal("de", SystemPrefs.Language(new System.Globalization.CultureInfo("de-AT")));
|
||||||
|
Assert.Equal("en", SystemPrefs.Language(new System.Globalization.CultureInfo("fr-FR")));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Old_files_without_new_fields_still_load()
|
||||||
|
{
|
||||||
|
var json = "{\"Folders\":[{\"Name\":\"F\",\"Tasks\":[{\"Name\":\"T\",\"ReminderDate\":\"2027-01-01T10:00:00\"}]}],\"Language\":\"de\",\"IsDarkMode\":true}";
|
||||||
|
var data = System.Text.Json.JsonSerializer.Deserialize<AppData>(json)!;
|
||||||
|
Assert.Equal(Folder.DefaultColor, data.Folders[0].Color);
|
||||||
|
Assert.Equal(0, data.Folders[0].Tasks[0].LeadDays);
|
||||||
|
Assert.True(data.PlaySound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@@ -25,117 +26,159 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
private readonly ILocalizationService _localizationService;
|
private readonly ILocalizationService _localizationService;
|
||||||
private readonly IAutostartService _autostartService;
|
private readonly IAutostartService _autostartService;
|
||||||
private readonly DispatcherTimer _reminderTimer;
|
private readonly DispatcherTimer _reminderTimer;
|
||||||
|
private readonly DispatcherTimer _undoTimer;
|
||||||
|
|
||||||
private AppData _appData = new();
|
private AppData _appData = new();
|
||||||
private Folder? _selectedFolder;
|
private Folder? _selectedFolder;
|
||||||
private ReminderTask? _selectedTask;
|
private ReminderTask? _selectedTask;
|
||||||
private bool _isLoading;
|
private bool _isLoading;
|
||||||
private ICollectionView? _selectedFolderTasksView;
|
private bool _isUpcomingMode;
|
||||||
|
private ListCollectionView? _tasksView;
|
||||||
|
private readonly ObservableCollection<ReminderTask> _allTasks = new();
|
||||||
|
private DateTime _lastRefreshDay = DateTime.Today;
|
||||||
|
|
||||||
public bool IsLoading
|
// ---------- texts ----------
|
||||||
{
|
|
||||||
get => _isLoading;
|
/// <summary>Localized text for XAML: {Binding [Key]}. Refreshed with OnPropertyChanged("").</summary>
|
||||||
set => SetProperty(ref _isLoading, value);
|
public string this[string key] => L(key);
|
||||||
}
|
public string L(string key) => _localizationService.GetString(key);
|
||||||
|
|
||||||
|
public string CopyrightText => $"© {DateTime.Now.Year} Michael Media";
|
||||||
|
public string VersionText => "v" + (typeof(MainViewModel).Assembly.GetName().Version?.ToString(3) ?? "");
|
||||||
|
|
||||||
|
// ---------- state ----------
|
||||||
|
|
||||||
|
public bool IsLoading { get => _isLoading; set => SetProperty(ref _isLoading, value); }
|
||||||
|
|
||||||
public ObservableCollection<Folder> Folders => _appData.Folders;
|
public ObservableCollection<Folder> Folders => _appData.Folders;
|
||||||
|
public IReadOnlyList<string> FolderColors => Folder.Palette;
|
||||||
|
|
||||||
public Folder? SelectedFolder
|
public Folder? SelectedFolder
|
||||||
{
|
{
|
||||||
get => _selectedFolder;
|
get => _selectedFolder;
|
||||||
|
set => SelectFolder(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Folder chosen in the sidebar (always leaves the "Upcoming" view).</summary>
|
||||||
|
public void SelectFolder(Folder? folder)
|
||||||
|
{
|
||||||
|
bool changed = !ReferenceEquals(_selectedFolder, folder) || _isUpcomingMode;
|
||||||
|
_selectedFolder = folder;
|
||||||
|
_isUpcomingMode = false;
|
||||||
|
if (!changed) return;
|
||||||
|
OnPropertyChanged(nameof(SelectedFolder));
|
||||||
|
OnPropertyChanged(nameof(IsUpcomingMode));
|
||||||
|
RebuildView();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsUpcomingMode
|
||||||
|
{
|
||||||
|
get => _isUpcomingMode;
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var old = _selectedFolder;
|
if (_isUpcomingMode == value) return;
|
||||||
if (SetProperty(ref _selectedFolder, value))
|
_isUpcomingMode = value;
|
||||||
{
|
OnPropertyChanged();
|
||||||
if (old != null) old.Tasks.CollectionChanged -= OnSelectedTasksChanged;
|
RebuildView();
|
||||||
if (value != null) value.Tasks.CollectionChanged += OnSelectedTasksChanged;
|
|
||||||
_selectedFolderTasksView = CreateSortedView(value);
|
|
||||||
OnPropertyChanged(nameof(SelectedFolderTasks));
|
|
||||||
OnPropertyChanged(nameof(SelectedFolderTasksView));
|
|
||||||
OnPropertyChanged(nameof(SelectedFolderName));
|
|
||||||
OnPropertyChanged(nameof(TaskCountText));
|
|
||||||
OnPropertyChanged(nameof(HasSelectedFolder));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSelectedTasksChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
public ReminderTask? SelectedTask { get => _selectedTask; set => SetProperty(ref _selectedTask, value); }
|
||||||
{
|
|
||||||
OnPropertyChanged(nameof(TaskCountText));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ICollectionView? CreateSortedView(Folder? folder)
|
/// <summary>Tasks shown in the list (folder or all, filtered, sorted, grouped in "Upcoming").</summary>
|
||||||
{
|
public ICollectionView? TasksView => _tasksView;
|
||||||
if (folder == null) return null;
|
|
||||||
var view = new ListCollectionView(folder.Tasks);
|
|
||||||
view.SortDescriptions.Add(new SortDescription(nameof(ReminderTask.IsNotified), ListSortDirection.Ascending));
|
|
||||||
view.SortDescriptions.Add(new SortDescription(nameof(ReminderTask.ReminderDate), ListSortDirection.Ascending));
|
|
||||||
view.IsLiveSorting = true;
|
|
||||||
view.LiveSortingProperties.Add(nameof(ReminderTask.IsNotified));
|
|
||||||
view.LiveSortingProperties.Add(nameof(ReminderTask.ReminderDate));
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReminderTask? SelectedTask
|
|
||||||
{
|
|
||||||
get => _selectedTask;
|
|
||||||
set => SetProperty(ref _selectedTask, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObservableCollection<ReminderTask>? SelectedFolderTasks => SelectedFolder?.Tasks;
|
|
||||||
|
|
||||||
/// <summary>Tasks of the selected folder: open first, then by date.</summary>
|
|
||||||
public ICollectionView? SelectedFolderTasksView => _selectedFolderTasksView;
|
|
||||||
|
|
||||||
|
public int VisibleCount { get; private set; }
|
||||||
|
public bool HasVisibleTasks => VisibleCount > 0;
|
||||||
public bool HasSelectedFolder => SelectedFolder != null;
|
public bool HasSelectedFolder => SelectedFolder != null;
|
||||||
|
|
||||||
public string SelectedFolderName => SelectedFolder?.Name ?? L("Welcome");
|
public string HeaderTitle => IsUpcomingMode ? L("Upcoming") : SelectedFolder?.Name ?? L("Welcome");
|
||||||
|
public string HeaderColor => IsUpcomingMode ? Folder.DefaultColor : SelectedFolder?.Color ?? Folder.DefaultColor;
|
||||||
|
|
||||||
public string TaskCountText => $"{SelectedFolder?.Tasks.Count ?? 0} {L("Tasks")}";
|
public string TaskCountText
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int total = IsUpcomingMode ? _allTasks.Count : SelectedFolder?.Tasks.Count ?? 0;
|
||||||
|
return IsFiltering && VisibleCount != total
|
||||||
|
? string.Format(L("CountOfTotal"), VisibleCount, total)
|
||||||
|
: $"{total} {L("Tasks")}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public string AddFolderText => L("AddFolder");
|
/// <summary>Badge on "Upcoming": open tasks that are overdue or due within 7 days.</summary>
|
||||||
public string AddTaskText => L("AddTask");
|
public int UpcomingCount
|
||||||
public string AutostartText => L("Autostart");
|
{
|
||||||
public string ExitText => L("Exit");
|
get
|
||||||
public string FileText => L("File");
|
{
|
||||||
public string SettingsText => L("Settings");
|
var now = DateTime.Now;
|
||||||
public string LanguageText => L("Language");
|
return _allTasks.Count(t => TaskQuery.Bucket(t, now) is TaskBucket.Overdue or TaskBucket.Today or TaskBucket.Tomorrow or TaskBucket.ThisWeek);
|
||||||
public string GermanText => L("German");
|
}
|
||||||
public string EnglishText => L("English");
|
}
|
||||||
public string DeleteText => L("Delete");
|
|
||||||
public string RenameText => L("Rename");
|
public string EmptyTitle => IsFiltering ? L("NoMatches") : L("NoTasks");
|
||||||
public string ViewText => L("View");
|
public string EmptyHint => IsFiltering ? L("NoMatchesHint") : L("CreateTaskHint");
|
||||||
public string DarkModeText => L("DarkMode");
|
|
||||||
public string LightModeText => L("LightMode");
|
// ---------- search / filter ----------
|
||||||
public string AddTaskToFolderText => L("AddTaskToFolder");
|
|
||||||
public string MinimizeTooltip => L("Minimize");
|
private string _searchText = "";
|
||||||
public string MaximizeTooltip => L("Maximize");
|
public string SearchText
|
||||||
public string CloseTooltip => L("Close");
|
{
|
||||||
public string CreateTaskHint => L("CreateTaskHint");
|
get => _searchText;
|
||||||
public string NoTasks => L("NoTasks");
|
set { if (SetProperty(ref _searchText, value ?? "")) RefreshView(); }
|
||||||
public string FoldersText => L("Folders");
|
}
|
||||||
public string NameColumnText => L("Name");
|
|
||||||
public string DateColumnText => L("Date");
|
private TaskFilterMode _filterMode = TaskFilterMode.All;
|
||||||
public string EditTaskTooltip => L("EditTaskTooltip");
|
public TaskFilterMode FilterMode
|
||||||
public string DeleteTaskTooltip => L("DeleteTaskTooltip");
|
{
|
||||||
public string DoneTooltip => L("DoneTooltip");
|
get => _filterMode;
|
||||||
public string InfoText => L("Info");
|
set
|
||||||
public string DiscordText => L("Discord");
|
{
|
||||||
public string ImportText => L("Import");
|
if (!SetProperty(ref _filterMode, value)) return;
|
||||||
public string ExportText => L("Export");
|
OnPropertyChanged(nameof(IsFilterAll));
|
||||||
public string ImportCsvText => L("ImportCsv");
|
OnPropertyChanged(nameof(IsFilterToday));
|
||||||
public string ExportCsvText => L("ExportCsv");
|
OnPropertyChanged(nameof(IsFilterOverdue));
|
||||||
public string TestNotificationText => L("TestNotification");
|
RefreshView();
|
||||||
public string AppTitleText => L("AppTitle");
|
}
|
||||||
public string RecurringTaskTooltipText => L("RecurringTaskTooltip");
|
}
|
||||||
public string CopyrightText => $"© {DateTime.Now.Year} Michael Media";
|
|
||||||
public string VersionText => "v" + (typeof(MainViewModel).Assembly.GetName().Version?.ToString(3) ?? "");
|
public bool IsFilterAll { get => FilterMode == TaskFilterMode.All; set { if (value) FilterMode = TaskFilterMode.All; } }
|
||||||
|
public bool IsFilterToday { get => FilterMode == TaskFilterMode.Today; set { if (value) FilterMode = TaskFilterMode.Today; } }
|
||||||
|
public bool IsFilterOverdue { get => FilterMode == TaskFilterMode.Overdue; set { if (value) FilterMode = TaskFilterMode.Overdue; } }
|
||||||
|
|
||||||
|
public bool HideDone
|
||||||
|
{
|
||||||
|
get => _appData.HideDone;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_appData.HideDone == value) return;
|
||||||
|
_appData.HideDone = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
RefreshView();
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsFiltering => !string.IsNullOrWhiteSpace(SearchText) || FilterMode != TaskFilterMode.All || HideDone;
|
||||||
|
|
||||||
|
// ---------- settings ----------
|
||||||
|
|
||||||
public bool IsGerman => _localizationService.CurrentLanguage == "de";
|
public bool IsGerman => _localizationService.CurrentLanguage == "de";
|
||||||
public bool IsEnglish => _localizationService.CurrentLanguage == "en";
|
public bool IsEnglish => _localizationService.CurrentLanguage == "en";
|
||||||
public bool IsAutostartEnabled => _autostartService.IsAutostartEnabled;
|
public bool IsAutostartEnabled => _autostartService.IsAutostartEnabled;
|
||||||
|
|
||||||
|
public bool PlaySound
|
||||||
|
{
|
||||||
|
get => _appData.PlaySound;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_appData.PlaySound == value) return;
|
||||||
|
_appData.PlaySound = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool _isDarkMode = true;
|
private bool _isDarkMode = true;
|
||||||
public bool IsDarkMode
|
public bool IsDarkMode
|
||||||
{
|
{
|
||||||
@@ -151,6 +194,40 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- undo ----------
|
||||||
|
|
||||||
|
private Action? _undoAction;
|
||||||
|
private string _undoText = "";
|
||||||
|
public string UndoText { get => _undoText; private set => SetProperty(ref _undoText, value); }
|
||||||
|
public bool IsUndoVisible => _undoAction != null;
|
||||||
|
|
||||||
|
private void OfferUndo(string text, Action undo)
|
||||||
|
{
|
||||||
|
_undoAction = undo;
|
||||||
|
UndoText = text;
|
||||||
|
OnPropertyChanged(nameof(IsUndoVisible));
|
||||||
|
_undoTimer.Stop();
|
||||||
|
_undoTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HideUndo()
|
||||||
|
{
|
||||||
|
_undoTimer.Stop();
|
||||||
|
_undoAction = null;
|
||||||
|
OnPropertyChanged(nameof(IsUndoVisible));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Undo()
|
||||||
|
{
|
||||||
|
var action = _undoAction;
|
||||||
|
HideUndo();
|
||||||
|
if (action == null) return;
|
||||||
|
action();
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- events / commands ----------
|
||||||
|
|
||||||
public event EventHandler<bool>? ThemeChanged;
|
public event EventHandler<bool>? ThemeChanged;
|
||||||
public event EventHandler<ReminderTask?>? EditTaskRequested;
|
public event EventHandler<ReminderTask?>? EditTaskRequested;
|
||||||
|
|
||||||
@@ -164,15 +241,23 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
public ICommand ExitCommand { get; }
|
public ICommand ExitCommand { get; }
|
||||||
public ICommand DeleteFolderCommand { get; }
|
public ICommand DeleteFolderCommand { get; }
|
||||||
public ICommand RenameFolderCommand { get; }
|
public ICommand RenameFolderCommand { get; }
|
||||||
|
public ICommand MoveFolderUpCommand { get; }
|
||||||
|
public ICommand MoveFolderDownCommand { get; }
|
||||||
|
public ICommand SetFolderColorCommand { get; }
|
||||||
public ICommand SaveFolderCommand { get; }
|
public ICommand SaveFolderCommand { get; }
|
||||||
public ICommand SetLanguageDeCommand { get; }
|
public ICommand SetLanguageDeCommand { get; }
|
||||||
public ICommand SetLanguageEnCommand { get; }
|
public ICommand SetLanguageEnCommand { get; }
|
||||||
public ICommand ToggleDarkModeCommand { get; }
|
public ICommand ToggleDarkModeCommand { get; }
|
||||||
|
public ICommand TogglePlaySoundCommand { get; }
|
||||||
public ICommand MoveTaskToFolderCommand { get; }
|
public ICommand MoveTaskToFolderCommand { get; }
|
||||||
public ICommand TestNotificationCommand { get; }
|
public ICommand TestNotificationCommand { get; }
|
||||||
public ICommand ImportCsvCommand { get; }
|
public ICommand ImportCsvCommand { get; }
|
||||||
public ICommand ExportCsvCommand { get; }
|
public ICommand ExportCsvCommand { get; }
|
||||||
|
public ICommand ExportIcsCommand { get; }
|
||||||
public ICommand OpenDiscordCommand { get; }
|
public ICommand OpenDiscordCommand { get; }
|
||||||
|
public ICommand ShowUpcomingCommand { get; }
|
||||||
|
public ICommand UndoCommand { get; }
|
||||||
|
public ICommand ClearSearchCommand { get; }
|
||||||
|
|
||||||
public MainViewModel(
|
public MainViewModel(
|
||||||
IDataService dataService,
|
IDataService dataService,
|
||||||
@@ -185,31 +270,47 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
_localizationService = localizationService;
|
_localizationService = localizationService;
|
||||||
_autostartService = autostartService;
|
_autostartService = autostartService;
|
||||||
|
|
||||||
|
ReminderTask.AgeFormatter = age => string.Format(L("TurnsAge"), age);
|
||||||
|
|
||||||
// Empty name = refresh every binding (all texts depend on the language).
|
// Empty name = refresh every binding (all texts depend on the language).
|
||||||
_localizationService.StringsChanged += (s, e) => OnPropertyChanged(string.Empty);
|
_localizationService.StringsChanged += (s, e) =>
|
||||||
|
{
|
||||||
|
OnPropertyChanged(string.Empty);
|
||||||
|
_tasksView?.Refresh(); // group headers + age texts
|
||||||
|
};
|
||||||
|
|
||||||
AddFolderCommand = new RelayCommand(AddFolder);
|
AddFolderCommand = new RelayCommand(AddFolder);
|
||||||
AddTaskCommand = new RelayCommand(AddTask, () => SelectedFolder != null);
|
AddTaskCommand = new RelayCommand(AddTask, () => Folders.Count > 0);
|
||||||
AddTaskToFolderCommand = new RelayCommand<Folder>(AddTaskToFolder);
|
AddTaskToFolderCommand = new RelayCommand<Folder>(AddTaskToFolder);
|
||||||
DeleteTaskCommand = new RelayCommand<ReminderTask>(DeleteTask);
|
DeleteTaskCommand = new RelayCommand<ReminderTask>(DeleteTask);
|
||||||
EditTaskCommand = new RelayCommand<ReminderTask>(EditTask);
|
EditTaskCommand = new RelayCommand<ReminderTask>(EditTask);
|
||||||
ToggleDoneCommand = new RelayCommand<ReminderTask>(t => { _ = SaveAsync(); });
|
ToggleDoneCommand = new RelayCommand<ReminderTask>(t => { _ = SaveAsync(); });
|
||||||
DeleteFolderCommand = new RelayCommand(DeleteFolder, () => SelectedFolder != null);
|
DeleteFolderCommand = new RelayCommand(DeleteFolder, () => SelectedFolder != null);
|
||||||
RenameFolderCommand = new RelayCommand(RenameFolder, () => SelectedFolder != null);
|
RenameFolderCommand = new RelayCommand(RenameFolder, () => SelectedFolder != null);
|
||||||
|
MoveFolderUpCommand = new RelayCommand(() => MoveFolderBy(-1), () => SelectedFolder != null && Folders.IndexOf(SelectedFolder) > 0);
|
||||||
|
MoveFolderDownCommand = new RelayCommand(() => MoveFolderBy(1), () => SelectedFolder != null && Folders.IndexOf(SelectedFolder) < Folders.Count - 1);
|
||||||
|
SetFolderColorCommand = new RelayCommand<string>(SetFolderColor);
|
||||||
SaveFolderCommand = new RelayCommand(async () => await SaveAsync());
|
SaveFolderCommand = new RelayCommand(async () => await SaveAsync());
|
||||||
ToggleAutostartCommand = new RelayCommand(ToggleAutostart);
|
ToggleAutostartCommand = new RelayCommand(ToggleAutostart);
|
||||||
SetLanguageDeCommand = new RelayCommand(() => _localizationService.SetLanguage("de"));
|
SetLanguageDeCommand = new RelayCommand(() => _localizationService.SetLanguage("de"));
|
||||||
SetLanguageEnCommand = new RelayCommand(() => _localizationService.SetLanguage("en"));
|
SetLanguageEnCommand = new RelayCommand(() => _localizationService.SetLanguage("en"));
|
||||||
ToggleDarkModeCommand = new RelayCommand(() => IsDarkMode = !IsDarkMode);
|
ToggleDarkModeCommand = new RelayCommand(() => IsDarkMode = !IsDarkMode);
|
||||||
|
TogglePlaySoundCommand = new RelayCommand(() => PlaySound = !PlaySound);
|
||||||
ExitCommand = new RelayCommand(() => Application.Current.Shutdown());
|
ExitCommand = new RelayCommand(() => Application.Current.Shutdown());
|
||||||
MoveTaskToFolderCommand = new RelayCommand<(ReminderTask, Folder)>(MoveTaskToFolder);
|
MoveTaskToFolderCommand = new RelayCommand<(ReminderTask, Folder)>(MoveTaskToFolder);
|
||||||
TestNotificationCommand = new RelayCommand(TestNotification);
|
TestNotificationCommand = new RelayCommand(TestNotification);
|
||||||
ImportCsvCommand = new RelayCommand(ImportCsv);
|
ImportCsvCommand = new RelayCommand(ImportCsv);
|
||||||
ExportCsvCommand = new RelayCommand(ExportCsv);
|
ExportCsvCommand = new RelayCommand(ExportCsv);
|
||||||
|
ExportIcsCommand = new RelayCommand(ExportIcs);
|
||||||
OpenDiscordCommand = new RelayCommand(OpenDiscord);
|
OpenDiscordCommand = new RelayCommand(OpenDiscord);
|
||||||
|
ShowUpcomingCommand = new RelayCommand(() => IsUpcomingMode = true);
|
||||||
|
UndoCommand = new RelayCommand(Undo);
|
||||||
|
ClearSearchCommand = new RelayCommand(() => { SearchText = ""; FilterMode = TaskFilterMode.All; });
|
||||||
|
|
||||||
_reminderTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
|
_reminderTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
|
||||||
_reminderTimer.Tick += (s, e) => CheckReminders();
|
_reminderTimer.Tick += (s, e) => CheckReminders();
|
||||||
|
_undoTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(7) };
|
||||||
|
_undoTimer.Tick += (s, e) => HideUndo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task InitializeAsync()
|
public async Task InitializeAsync()
|
||||||
@@ -226,20 +327,106 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
await SaveAsync();
|
await SaveAsync();
|
||||||
|
|
||||||
_isDarkMode = _appData.IsDarkMode.Value;
|
_isDarkMode = _appData.IsDarkMode.Value;
|
||||||
OnPropertyChanged(nameof(IsDarkMode));
|
_appData.Folders.CollectionChanged += (s, e) => { HookFolders(); ReindexTasks(); };
|
||||||
OnPropertyChanged(nameof(Folders));
|
HookFolders();
|
||||||
SelectedFolder = _appData.Folders.FirstOrDefault();
|
ReindexTasks();
|
||||||
|
|
||||||
|
OnPropertyChanged(string.Empty);
|
||||||
|
SelectFolder(_appData.Folders.FirstOrDefault());
|
||||||
|
|
||||||
CheckReminders(); // catch up on reminders missed while the app was closed
|
CheckReminders(); // catch up on reminders missed while the app was closed
|
||||||
_reminderTimer.Start();
|
_reminderTimer.Start();
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string L(string key) => _localizationService.GetString(key);
|
// ---------- task index / view ----------
|
||||||
|
|
||||||
private bool Confirm(string message) =>
|
private readonly HashSet<Folder> _hooked = new();
|
||||||
MessageBox.Show(Application.Current.MainWindow, message, L("AppTitle"),
|
|
||||||
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;
|
private void HookFolders()
|
||||||
|
{
|
||||||
|
foreach (var f in _appData.Folders)
|
||||||
|
{
|
||||||
|
if (!_hooked.Add(f)) continue;
|
||||||
|
f.Tasks.CollectionChanged += OnFolderTasksChanged;
|
||||||
|
f.PropertyChanged += OnFolderPropertyChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnFolderTasksChanged(object? sender, NotifyCollectionChangedEventArgs e) => ReindexTasks();
|
||||||
|
|
||||||
|
private void OnFolderPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName is nameof(Folder.Name) or nameof(Folder.Color))
|
||||||
|
{
|
||||||
|
ReindexTasks();
|
||||||
|
OnPropertyChanged(nameof(HeaderTitle));
|
||||||
|
OnPropertyChanged(nameof(HeaderColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Keeps the flat list for "Upcoming" and each task's folder name/color in sync.</summary>
|
||||||
|
private void ReindexTasks()
|
||||||
|
{
|
||||||
|
_allTasks.Clear();
|
||||||
|
foreach (var f in _appData.Folders)
|
||||||
|
{
|
||||||
|
if (!_appData.Folders.Contains(f)) continue;
|
||||||
|
foreach (var t in f.Tasks)
|
||||||
|
{
|
||||||
|
t.FolderName = f.Name;
|
||||||
|
t.FolderColor = f.Color;
|
||||||
|
_allTasks.Add(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UpdateCounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RebuildView()
|
||||||
|
{
|
||||||
|
IEnumerable<ReminderTask>? source = IsUpcomingMode ? _allTasks : SelectedFolder?.Tasks;
|
||||||
|
if (source == null)
|
||||||
|
{
|
||||||
|
_tasksView = null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var view = new ListCollectionView((System.Collections.IList)source)
|
||||||
|
{
|
||||||
|
CustomSort = new TaskQuery.Comparer(),
|
||||||
|
Filter = o => o is ReminderTask t && TaskQuery.Matches(t, SearchText, FilterMode, HideDone, DateTime.Now)
|
||||||
|
};
|
||||||
|
if (IsUpcomingMode)
|
||||||
|
view.GroupDescriptions.Add(new PropertyGroupDescription(null, new Converters.TaskBucketConverter()));
|
||||||
|
_tasksView = view;
|
||||||
|
}
|
||||||
|
OnPropertyChanged(nameof(TasksView));
|
||||||
|
OnPropertyChanged(nameof(HeaderTitle));
|
||||||
|
OnPropertyChanged(nameof(HeaderColor));
|
||||||
|
OnPropertyChanged(nameof(HasSelectedFolder));
|
||||||
|
UpdateCounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Re-applies filter, sort and groups (after edits, search, time passing).</summary>
|
||||||
|
public void RefreshView()
|
||||||
|
{
|
||||||
|
_tasksView?.Refresh();
|
||||||
|
_lastRefreshDay = DateTime.Today;
|
||||||
|
UpdateCounts();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateCounts()
|
||||||
|
{
|
||||||
|
VisibleCount = _tasksView?.Cast<object>().Count() ?? 0;
|
||||||
|
OnPropertyChanged(nameof(VisibleCount));
|
||||||
|
OnPropertyChanged(nameof(HasVisibleTasks));
|
||||||
|
OnPropertyChanged(nameof(TaskCountText));
|
||||||
|
OnPropertyChanged(nameof(UpcomingCount));
|
||||||
|
OnPropertyChanged(nameof(EmptyTitle));
|
||||||
|
OnPropertyChanged(nameof(EmptyHint));
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- dialogs ----------
|
||||||
|
|
||||||
private string? AskName(string title, string current)
|
private string? AskName(string title, string current)
|
||||||
{
|
{
|
||||||
@@ -249,13 +436,15 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
return string.IsNullOrEmpty(name) ? null : name;
|
return string.IsNullOrEmpty(name) ? null : name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- folders ----------
|
||||||
|
|
||||||
private void AddFolder()
|
private void AddFolder()
|
||||||
{
|
{
|
||||||
var name = AskName(L("NewFolder"), L("NewFolder"));
|
var name = AskName(L("NewFolder"), L("NewFolder"));
|
||||||
if (name == null) return;
|
if (name == null) return;
|
||||||
var folder = new Folder(name);
|
var folder = new Folder(name);
|
||||||
_appData.Folders.Add(folder);
|
_appData.Folders.Add(folder);
|
||||||
SelectedFolder = folder;
|
SelectFolder(folder);
|
||||||
_ = SaveAsync();
|
_ = SaveAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -265,23 +454,54 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
var name = AskName(L("RenameFolder"), SelectedFolder.Name);
|
var name = AskName(L("RenameFolder"), SelectedFolder.Name);
|
||||||
if (name == null) return;
|
if (name == null) return;
|
||||||
SelectedFolder.Name = name;
|
SelectedFolder.Name = name;
|
||||||
OnPropertyChanged(nameof(SelectedFolderName));
|
|
||||||
_ = SaveAsync();
|
_ = SaveAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteFolder()
|
private void DeleteFolder()
|
||||||
{
|
{
|
||||||
if (SelectedFolder == null) return;
|
var folder = SelectedFolder;
|
||||||
if (SelectedFolder.Tasks.Count > 0 &&
|
if (folder == null) return;
|
||||||
!Confirm(string.Format(L("ConfirmDeleteFolder"), SelectedFolder.Name, SelectedFolder.Tasks.Count)))
|
int index = _appData.Folders.IndexOf(folder);
|
||||||
return;
|
_appData.Folders.Remove(folder);
|
||||||
|
_hooked.Remove(folder);
|
||||||
|
folder.Tasks.CollectionChanged -= OnFolderTasksChanged;
|
||||||
|
folder.PropertyChanged -= OnFolderPropertyChanged;
|
||||||
|
SelectFolder(_appData.Folders.ElementAtOrDefault(Math.Max(0, index - 1)));
|
||||||
|
_ = SaveAsync();
|
||||||
|
|
||||||
_appData.Folders.Remove(SelectedFolder);
|
OfferUndo(string.Format(L("DeletedItem"), folder.Name), () =>
|
||||||
SelectedFolder = _appData.Folders.FirstOrDefault();
|
{
|
||||||
|
_appData.Folders.Insert(Math.Min(index, _appData.Folders.Count), folder);
|
||||||
|
SelectFolder(folder);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Moves a folder to a new position (drag & drop or up/down).</summary>
|
||||||
|
public void MoveFolder(Folder folder, int newIndex)
|
||||||
|
{
|
||||||
|
int old = _appData.Folders.IndexOf(folder);
|
||||||
|
newIndex = Math.Clamp(newIndex, 0, _appData.Folders.Count - 1);
|
||||||
|
if (old < 0 || old == newIndex) return;
|
||||||
|
_appData.Folders.Move(old, newIndex);
|
||||||
_ = SaveAsync();
|
_ = SaveAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddTask() => AddTaskInternal(SelectedFolder);
|
private void MoveFolderBy(int delta)
|
||||||
|
{
|
||||||
|
if (SelectedFolder != null)
|
||||||
|
MoveFolder(SelectedFolder, _appData.Folders.IndexOf(SelectedFolder) + delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetFolderColor(string? color)
|
||||||
|
{
|
||||||
|
if (SelectedFolder == null || string.IsNullOrEmpty(color)) return;
|
||||||
|
SelectedFolder.Color = color;
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- tasks ----------
|
||||||
|
|
||||||
|
private void AddTask() => AddTaskInternal(SelectedFolder ?? Folders.FirstOrDefault());
|
||||||
|
|
||||||
private void AddTaskToFolder(Folder? folder) => AddTaskInternal(folder);
|
private void AddTaskToFolder(Folder? folder) => AddTaskInternal(folder);
|
||||||
|
|
||||||
@@ -306,9 +526,15 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
if (task == null) return;
|
if (task == null) return;
|
||||||
var folder = _appData.Folders.FirstOrDefault(f => f.Tasks.Contains(task));
|
var folder = _appData.Folders.FirstOrDefault(f => f.Tasks.Contains(task));
|
||||||
if (folder == null) return;
|
if (folder == null) return;
|
||||||
if (!Confirm(string.Format(L("ConfirmDeleteTask"), task.Name))) return;
|
int index = folder.Tasks.IndexOf(task);
|
||||||
folder.Tasks.Remove(task);
|
folder.Tasks.Remove(task);
|
||||||
_ = SaveAsync();
|
_ = SaveAsync();
|
||||||
|
|
||||||
|
OfferUndo(string.Format(L("DeletedItem"), task.Name), () =>
|
||||||
|
{
|
||||||
|
if (!_appData.Folders.Contains(folder)) return;
|
||||||
|
folder.Tasks.Insert(Math.Min(index, folder.Tasks.Count), task);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveTaskToFolder((ReminderTask Task, Folder TargetFolder) args)
|
private void MoveTaskToFolder((ReminderTask Task, Folder TargetFolder) args)
|
||||||
@@ -331,6 +557,8 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
EditTaskRequested?.Invoke(this, task);
|
EditTaskRequested?.Invoke(this, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- reminders ----------
|
||||||
|
|
||||||
private void ToggleAutostart()
|
private void ToggleAutostart()
|
||||||
{
|
{
|
||||||
_autostartService.ToggleAutostart();
|
_autostartService.ToggleAutostart();
|
||||||
@@ -339,20 +567,56 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
_autostartService.IsAutostartEnabled ? L("AutostartEnabled") : L("AutostartDisabled"));
|
_autostartService.IsAutostartEnabled ? L("AutostartEnabled") : L("AutostartDisabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string WhenText(DateTime date, DateTime now)
|
||||||
|
{
|
||||||
|
int days = (date.Date - now.Date).Days;
|
||||||
|
return days switch
|
||||||
|
{
|
||||||
|
<= 0 => string.Format(L("TodayAt"), date.ToString("HH:mm")),
|
||||||
|
1 => string.Format(L("TomorrowAt"), date.ToString("HH:mm")),
|
||||||
|
_ => string.Format(L("InDays"), days)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private void CheckReminders()
|
private void CheckReminders()
|
||||||
{
|
{
|
||||||
var due = ReminderTask.ProcessDue(_appData.Folders, DateTime.Now);
|
var now = DateTime.Now;
|
||||||
foreach (var task in due)
|
var due = ReminderTask.ProcessDue(_appData.Folders, now);
|
||||||
|
|
||||||
|
if (due.Count == 1)
|
||||||
{
|
{
|
||||||
var body = string.IsNullOrWhiteSpace(task.Description) ? L("Reminder") : task.Description;
|
var d = due[0];
|
||||||
_notificationService.ShowNotification($"🔔 {task.Name}", body);
|
var title = d.IsLead ? $"⏰ {d.Task.Name} · {WhenText(d.Date, now)}" : $"🔔 {d.Task.Name}";
|
||||||
|
var parts = new List<string>();
|
||||||
|
if (d.Age is int age) parts.Add(string.Format(L("TurnsAge"), age));
|
||||||
|
if (!string.IsNullOrWhiteSpace(d.Task.Description)) parts.Add(d.Task.Description);
|
||||||
|
if (parts.Count == 0) parts.Add(d.IsLead ? d.Date.ToString("dd.MM.yyyy HH:mm") : L("Reminder"));
|
||||||
|
_notificationService.ShowNotification(title, string.Join(" · ", parts));
|
||||||
|
}
|
||||||
|
else if (due.Count > 1)
|
||||||
|
{
|
||||||
|
// A balloon replaces the previous one – show one summary instead of losing reminders.
|
||||||
|
var lines = due.Take(6).Select(d => (d.IsLead ? "⏰ " : "🔔 ") + d.Task.Name +
|
||||||
|
(d.IsLead ? $" ({WhenText(d.Date, now)})" : ""));
|
||||||
|
var body = string.Join("\n", lines) + (due.Count > 6 ? "\n…" : "");
|
||||||
|
_notificationService.ShowNotification(string.Format(L("RemindersCount"), due.Count), body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (due.Count > 0)
|
||||||
|
{
|
||||||
|
if (PlaySound) SoundService.PlayReminder();
|
||||||
|
_ = SaveAsync();
|
||||||
|
}
|
||||||
|
else if (_lastRefreshDay != DateTime.Today)
|
||||||
|
{
|
||||||
|
RefreshView(); // "today"/"tomorrow" groups move at midnight
|
||||||
}
|
}
|
||||||
if (due.Count > 0) _ = SaveAsync();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void TestNotification()
|
private void TestNotification()
|
||||||
{
|
{
|
||||||
_notificationService.ShowNotification(L("TestNotificationTitle"), L("TestNotificationMessage"));
|
_notificationService.ShowNotification(L("TestNotificationTitle"), L("TestNotificationMessage"));
|
||||||
|
if (PlaySound) SoundService.PlayReminder();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenDiscord()
|
private void OpenDiscord()
|
||||||
@@ -371,6 +635,8 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- import / export ----------
|
||||||
|
|
||||||
private void ImportCsv()
|
private void ImportCsv()
|
||||||
{
|
{
|
||||||
var dialog = new Microsoft.Win32.OpenFileDialog
|
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||||
@@ -384,7 +650,6 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
{
|
{
|
||||||
var (imported, skipped) = TaskCsv.Import(System.IO.File.ReadAllText(dialog.FileName), _appData);
|
var (imported, skipped) = TaskCsv.Import(System.IO.File.ReadAllText(dialog.FileName), _appData);
|
||||||
_ = SaveAsync();
|
_ = SaveAsync();
|
||||||
OnPropertyChanged(nameof(TaskCountText));
|
|
||||||
|
|
||||||
var msg = string.Format(L("ImportSuccess"), imported);
|
var msg = string.Format(L("ImportSuccess"), imported);
|
||||||
if (skipped > 0) msg += " " + string.Format(L("ImportSkipped"), skipped);
|
if (skipped > 0) msg += " " + string.Format(L("ImportSkipped"), skipped);
|
||||||
@@ -396,20 +661,21 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ExportCsv()
|
private void ExportCsv() =>
|
||||||
|
SaveTextFile("CSV (*.csv)|*.csv", "tasks.csv", L("ExportCsv"), () => TaskCsv.Export(_appData));
|
||||||
|
|
||||||
|
private void ExportIcs() =>
|
||||||
|
SaveTextFile("iCalendar (*.ics)|*.ics", "reminders.ics", L("ExportIcs"), () => IcsExport.Build(_appData, DateTime.UtcNow));
|
||||||
|
|
||||||
|
private void SaveTextFile(string filter, string fileName, string title, Func<string> content)
|
||||||
{
|
{
|
||||||
var dialog = new Microsoft.Win32.SaveFileDialog
|
var dialog = new Microsoft.Win32.SaveFileDialog { Filter = filter, Title = title, FileName = fileName };
|
||||||
{
|
|
||||||
Filter = "CSV (*.csv)|*.csv",
|
|
||||||
Title = L("ExportCsv"),
|
|
||||||
FileName = "tasks.csv"
|
|
||||||
};
|
|
||||||
if (dialog.ShowDialog() != true) return;
|
if (dialog.ShowDialog() != true) return;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// UTF-8 with BOM so Excel shows umlauts correctly.
|
// UTF-8 with BOM so Excel shows umlauts correctly (calendars accept it too).
|
||||||
System.IO.File.WriteAllText(dialog.FileName, TaskCsv.Export(_appData), new UTF8Encoding(true));
|
System.IO.File.WriteAllText(dialog.FileName, content(), new UTF8Encoding(true));
|
||||||
MessageBox.Show(L("ExportSuccess"), L("AppTitle"));
|
MessageBox.Show(L("ExportSuccess"), L("AppTitle"));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -418,8 +684,11 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---------- persistence ----------
|
||||||
|
|
||||||
public async Task SaveAsync()
|
public async Task SaveAsync()
|
||||||
{
|
{
|
||||||
|
RefreshView();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await _dataService.SaveAsync(_appData);
|
await _dataService.SaveAsync(_appData);
|
||||||
|
|||||||
@@ -70,6 +70,34 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInPast => !IsRecurring && ReminderDate <= DateTime.Now;
|
public bool IsInPast => !IsRecurring && ReminderDate <= DateTime.Now;
|
||||||
|
|
||||||
|
// lead reminder: index into LeadOptions
|
||||||
|
public static readonly int[] LeadOptions = { 0, 1, 2, 3, 7 };
|
||||||
|
private int _selectedLeadIndex;
|
||||||
|
public int SelectedLeadIndex
|
||||||
|
{
|
||||||
|
get => _selectedLeadIndex;
|
||||||
|
set => SetProperty(ref _selectedLeadIndex, Math.Clamp(value, 0, LeadOptions.Length - 1));
|
||||||
|
}
|
||||||
|
public string LeadLabel => _localizationService.GetString("LeadReminder");
|
||||||
|
public string LeadNone => _localizationService.GetString("LeadNone");
|
||||||
|
public string Lead1 => _localizationService.GetString("LeadOneDay");
|
||||||
|
public string Lead2 => string.Format(_localizationService.GetString("LeadDays"), 2);
|
||||||
|
public string Lead3 => string.Format(_localizationService.GetString("LeadDays"), 3);
|
||||||
|
public string Lead7 => _localizationService.GetString("LeadWeek");
|
||||||
|
|
||||||
|
// birthday
|
||||||
|
private string _birthYearText = "";
|
||||||
|
public string BirthYearText
|
||||||
|
{
|
||||||
|
get => _birthYearText;
|
||||||
|
set { if (SetProperty(ref _birthYearText, value ?? "")) OnPropertyChanged(nameof(BirthYearError)); }
|
||||||
|
}
|
||||||
|
public int? ParsedBirthYear =>
|
||||||
|
int.TryParse(BirthYearText.Trim(), out var y) && y >= 1900 && y <= DateTime.Now.Year ? y : null;
|
||||||
|
public bool BirthYearError => BirthYearText.Trim().Length > 0 && ParsedBirthYear == null;
|
||||||
|
public bool IsYearly => IsRecurring && SelectedRecurrenceIndex == (int)RecurrenceType.Yearly;
|
||||||
|
public string BirthYearLabel => _localizationService.GetString("BirthYear");
|
||||||
public string PastDateWarning => _localizationService.GetString("PastDateWarning");
|
public string PastDateWarning => _localizationService.GetString("PastDateWarning");
|
||||||
public string NextOccurrenceLabel => _localizationService.GetString("NextOccurrence");
|
public string NextOccurrenceLabel => _localizationService.GetString("NextOccurrence");
|
||||||
public string QuickLabel => _localizationService.GetString("Quick");
|
public string QuickLabel => _localizationService.GetString("Quick");
|
||||||
@@ -121,6 +149,7 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
{
|
{
|
||||||
// Only copied to the task in Save() – Cancel must not change anything.
|
// Only copied to the task in Save() – Cancel must not change anything.
|
||||||
SetProperty(ref _isRecurring, value);
|
SetProperty(ref _isRecurring, value);
|
||||||
|
OnPropertyChanged(nameof(IsYearly));
|
||||||
OnPropertyChanged(nameof(NextOccurrenceText));
|
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||||
OnPropertyChanged(nameof(IsInPast));
|
OnPropertyChanged(nameof(IsInPast));
|
||||||
}
|
}
|
||||||
@@ -133,6 +162,7 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
{
|
{
|
||||||
if (value < 0) return;
|
if (value < 0) return;
|
||||||
SetProperty(ref _selectedRecurrenceIndex, value);
|
SetProperty(ref _selectedRecurrenceIndex, value);
|
||||||
|
OnPropertyChanged(nameof(IsYearly));
|
||||||
OnPropertyChanged(nameof(IsDailySelected));
|
OnPropertyChanged(nameof(IsDailySelected));
|
||||||
OnPropertyChanged(nameof(IsWeeklySelected));
|
OnPropertyChanged(nameof(IsWeeklySelected));
|
||||||
OnPropertyChanged(nameof(IsMonthlySelected));
|
OnPropertyChanged(nameof(IsMonthlySelected));
|
||||||
@@ -224,6 +254,8 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
_reminderDate = existingTask.ReminderDate;
|
_reminderDate = existingTask.ReminderDate;
|
||||||
_isRecurring = existingTask.IsRecurring;
|
_isRecurring = existingTask.IsRecurring;
|
||||||
_selectedRecurrenceIndex = (int)existingTask.RecurrenceType;
|
_selectedRecurrenceIndex = (int)existingTask.RecurrenceType;
|
||||||
|
_selectedLeadIndex = Math.Max(0, Array.IndexOf(LeadOptions, existingTask.LeadDays));
|
||||||
|
_birthYearText = existingTask.BirthYear?.ToString() ?? "";
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveCommand = new RelayCommand(Save, CanSave);
|
SaveCommand = new RelayCommand(Save, CanSave);
|
||||||
@@ -239,7 +271,7 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
OnPropertyChanged(nameof(SelectedMinuteIndex));
|
OnPropertyChanged(nameof(SelectedMinuteIndex));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CanSave() => !string.IsNullOrWhiteSpace(Name);
|
private bool CanSave() => !string.IsNullOrWhiteSpace(Name) && !BirthYearError;
|
||||||
|
|
||||||
private void ValidateInput()
|
private void ValidateInput()
|
||||||
{
|
{
|
||||||
@@ -279,6 +311,12 @@ namespace ReminderOrganizer.ViewModels
|
|||||||
{
|
{
|
||||||
if (!CanSave()) return;
|
if (!CanSave()) return;
|
||||||
|
|
||||||
|
var leadDays = LeadOptions[SelectedLeadIndex];
|
||||||
|
bool timingChanged = _originalTask.ReminderDate != ReminderDate || _originalTask.LeadDays != leadDays;
|
||||||
|
_originalTask.LeadDays = leadDays;
|
||||||
|
_originalTask.BirthYear = IsYearly ? ParsedBirthYear : null;
|
||||||
|
if (timingChanged || _isNewTask) _originalTask.IsPreNotified = false;
|
||||||
|
|
||||||
_originalTask.Name = Name.Trim();
|
_originalTask.Name = Name.Trim();
|
||||||
_originalTask.Description = Description?.Trim() ?? "";
|
_originalTask.Description = Description?.Trim() ?? "";
|
||||||
_originalTask.IsRecurring = IsRecurring;
|
_originalTask.IsRecurring = IsRecurring;
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 89 KiB After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 34 KiB |
BIN
docs/screenshots/upcoming.png
Normal file
BIN
docs/screenshots/upcoming.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
@@ -1,11 +1,11 @@
|
|||||||
"""Musik und Effekte für generate_audio.py (Stable Audio). Mindestlänge 1 s.
|
"""Effekte für generate_audio.py (Stable Audio). Mindestlänge 1 s.
|
||||||
|
|
||||||
CLIPS = [(name, prompt, sekunden, negative)]
|
CLIPS = [(name, prompt, sekunden, negative)]
|
||||||
"""
|
"""
|
||||||
NEG_MUSIC = "vocals, singing, speech, harsh noise, distortion, abrupt ending, low quality"
|
NEG_SFX = "music, melody, vocals, speech, long reverb tail, background ambience, noise, low quality"
|
||||||
NEG_SFX = "music, melody, vocals, speech, reverb tail, background ambience, low quality"
|
|
||||||
|
|
||||||
CLIPS = [
|
CLIPS = [
|
||||||
("sfx_click", "short soft UI button click", 1, NEG_SFX),
|
("sfx_reminder",
|
||||||
("music_menu", "calm looping menu music, light synth pads", 30, NEG_MUSIC),
|
"short pleasant notification chime, two soft bell tones rising, clean, gentle, modern app alert",
|
||||||
|
2, NEG_SFX),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user