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:
28
App.xaml.cs
28
App.xaml.cs
@@ -16,8 +16,33 @@ namespace ReminderOrganizer
|
||||
{
|
||||
base.OnStartup(e);
|
||||
|
||||
// Only one instance: a second start would show duplicate reminders and race on tasks.json.
|
||||
_singleInstance = new System.Threading.Mutex(true, "MichaelMedia.ReminderOrganizer", out var isFirst);
|
||||
if (!isFirst)
|
||||
{
|
||||
Shutdown();
|
||||
return;
|
||||
}
|
||||
|
||||
SetupExceptionHandling();
|
||||
ServiceLocator.Initialize();
|
||||
|
||||
var main = new MainWindow();
|
||||
MainWindow = main;
|
||||
// Autostart passes --minimized: start straight into the tray.
|
||||
if (Array.IndexOf(e.Args, "--minimized") >= 0)
|
||||
main.StartHidden();
|
||||
else
|
||||
main.Show();
|
||||
}
|
||||
|
||||
private System.Threading.Mutex? _singleInstance;
|
||||
|
||||
protected override void OnExit(ExitEventArgs e)
|
||||
{
|
||||
Services.NotificationService.SharedTrayIcon?.Dispose();
|
||||
_singleInstance?.Dispose();
|
||||
base.OnExit(e);
|
||||
}
|
||||
|
||||
private void SetupExceptionHandling()
|
||||
@@ -48,7 +73,8 @@ namespace ReminderOrganizer
|
||||
{
|
||||
try
|
||||
{
|
||||
var logPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "error.log");
|
||||
Directory.CreateDirectory(DataService.DefaultDataDirectory);
|
||||
var logPath = Path.Combine(DataService.DefaultDataDirectory, "error.log");
|
||||
var logEntry = $"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] [{source}]\n{ex}\n\n";
|
||||
File.AppendAllText(logPath, logEntry);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user