Fix data loss risk, reminder bugs; theme, credits, tests
- Store tasks in %APPDATA% (single-file extract dir lost data on update), atomic serialized saves, corrupt-file backup, migration of old tasks.json - Reminders without description never showed (empty balloon text threw) - Catch up missed reminders on start; monthly recurrence no longer drifts - Task dialog: date pick kept 00:00, cancel leaked recurrence changes - CSV import understands quoted fields written by export - Confirm before deleting; name folders on create; tasks sorted by date - Single instance, autostart starts hidden in tray, tray icon disposed - Theme helper for all dialogs, MDL2/Path icons instead of emojis, fixed folder selection/badge, localized counts and messages - Credits (c) Michael Media + Discord link, exe Company/Copyright - Locales embedded; xUnit tests (24); README, CLAUDE.md, sprite-generator Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -43,20 +43,50 @@ namespace ReminderOrganizer.ViewModels
|
||||
{
|
||||
SetProperty(ref _reminderDate, value);
|
||||
UpdateHourMinuteIndices();
|
||||
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||
OnDateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDateChanged()
|
||||
{
|
||||
OnPropertyChanged(nameof(ReminderDate));
|
||||
OnPropertyChanged(nameof(SelectedDay));
|
||||
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||
OnPropertyChanged(nameof(IsInPast));
|
||||
}
|
||||
|
||||
public DateTime MinDate => DateTime.Now.AddMinutes(-1);
|
||||
|
||||
/// <summary>Date part for the DatePicker – keeps the chosen hour/minute (DatePicker returns 00:00).</summary>
|
||||
public DateTime? SelectedDay
|
||||
{
|
||||
get => _reminderDate.Date;
|
||||
set
|
||||
{
|
||||
if (value == null) return;
|
||||
var d = value.Value.Date;
|
||||
ReminderDate = new DateTime(d.Year, d.Month, d.Day, _reminderDate.Hour, _reminderDate.Minute, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsInPast => !IsRecurring && ReminderDate <= DateTime.Now;
|
||||
public string PastDateWarning => _localizationService.GetString("PastDateWarning");
|
||||
public string NextOccurrenceLabel => _localizationService.GetString("NextOccurrence");
|
||||
public string QuickLabel => _localizationService.GetString("Quick");
|
||||
public string TomorrowText => _localizationService.GetString("Tomorrow");
|
||||
public string NextWeekText => _localizationService.GetString("NextWeek");
|
||||
public string NextMonthText => _localizationService.GetString("NextMonth");
|
||||
public string NamePlaceholder => _localizationService.GetString("NewTask");
|
||||
|
||||
public int SelectedHourIndex
|
||||
{
|
||||
get => _reminderDate.Hour;
|
||||
set
|
||||
{
|
||||
if (value < 0) return;
|
||||
var newDate = new DateTime(_reminderDate.Year, _reminderDate.Month, _reminderDate.Day, value, _reminderDate.Minute, 0);
|
||||
SetProperty(ref _reminderDate, newDate);
|
||||
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||
OnDateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,9 +95,10 @@ namespace ReminderOrganizer.ViewModels
|
||||
get => _reminderDate.Minute / 5;
|
||||
set
|
||||
{
|
||||
if (value < 0) return;
|
||||
var newDate = new DateTime(_reminderDate.Year, _reminderDate.Month, _reminderDate.Day, _reminderDate.Hour, value * 5, 0);
|
||||
SetProperty(ref _reminderDate, newDate);
|
||||
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||
OnDateChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,9 +119,10 @@ namespace ReminderOrganizer.ViewModels
|
||||
get => _isRecurring;
|
||||
set
|
||||
{
|
||||
// Only copied to the task in Save() – Cancel must not change anything.
|
||||
SetProperty(ref _isRecurring, value);
|
||||
_originalTask.IsRecurring = value;
|
||||
OnPropertyChanged(nameof(NextOccurrenceText));
|
||||
OnPropertyChanged(nameof(IsInPast));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,8 +131,8 @@ namespace ReminderOrganizer.ViewModels
|
||||
get => _selectedRecurrenceIndex;
|
||||
set
|
||||
{
|
||||
if (value < 0) return;
|
||||
SetProperty(ref _selectedRecurrenceIndex, value);
|
||||
_originalTask.RecurrenceType = (RecurrenceType)value;
|
||||
OnPropertyChanged(nameof(IsDailySelected));
|
||||
OnPropertyChanged(nameof(IsWeeklySelected));
|
||||
OnPropertyChanged(nameof(IsMonthlySelected));
|
||||
@@ -150,7 +182,7 @@ namespace ReminderOrganizer.ViewModels
|
||||
}
|
||||
|
||||
public string WindowTitle => _isNewTask
|
||||
? _localizationService.GetString("AddTask")
|
||||
? _localizationService.GetString("NewTask")
|
||||
: _localizationService.GetString("EditTask");
|
||||
|
||||
public string NameLabel => _localizationService.GetString("Name");
|
||||
@@ -247,12 +279,15 @@ namespace ReminderOrganizer.ViewModels
|
||||
{
|
||||
if (!CanSave()) return;
|
||||
|
||||
_originalTask.Name = Name;
|
||||
_originalTask.Description = Description;
|
||||
_originalTask.ReminderDate = ReminderDate;
|
||||
_originalTask.IsNotified = false;
|
||||
_originalTask.Name = Name.Trim();
|
||||
_originalTask.Description = Description?.Trim() ?? "";
|
||||
_originalTask.IsRecurring = IsRecurring;
|
||||
_originalTask.RecurrenceType = (RecurrenceType)SelectedRecurrenceIndex;
|
||||
_originalTask.ReminderDate = ReminderDate;
|
||||
// A recurring start date in the past would fire at once – move it to the next occurrence.
|
||||
if (IsRecurring && ReminderDate <= DateTime.Now)
|
||||
_originalTask.ReminderDate = _originalTask.GetNextOccurrence();
|
||||
_originalTask.IsNotified = false;
|
||||
RequestClose?.Invoke(this, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user