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>
@@ -1,7 +1,8 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"PowerShell(node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")"
|
||||
"PowerShell(node D:\\\\Oculusquest\\\\Projekt\\\\_Tools\\\\Library\\\\tools\\\\project-check.mjs \"d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer\")",
|
||||
"PowerShell(cd d:\\\\Oculusquest\\\\Projekt\\\\ReminderOrganizer; git rm -q --cached tasks.json docs/screenshots/1.png; Remove-Item tasks.json, docs\\\\screenshots\\\\1.png; Add-Content .gitignore \"tasks.json\"; Get-ChildItem bin -Recurse -Filter tasks.json | Remove-Item; dotnet build ReminderOrganizer.csproj -nologo -v q 2>&1 | Select-String \"Fehler|error\" ; Test-Path \"$env:APPDATA\\\\ReminderOrganizer\")"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
3
.gitignore
vendored
@@ -7,3 +7,6 @@ publish/
|
||||
error.log
|
||||
nul
|
||||
Tests/TestResults/
|
||||
tasks.json
|
||||
sprite-generator/output/
|
||||
__pycache__/
|
||||
|
||||
2
App.xaml
@@ -2,7 +2,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:ReminderOrganizer.Converters"
|
||||
StartupUri="MainWindow.xaml">
|
||||
ShutdownMode="OnExplicitShutdown">
|
||||
<Application.Resources>
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVisibility"/>
|
||||
<converters:NullToVisibilityConverter x:Key="NullToVisibility"/>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
27
CLAUDE.md
Normal file
@@ -0,0 +1,27 @@
|
||||
# ReminderOrganizer – notes for Claude
|
||||
|
||||
WPF (.NET 8, `net8.0-windows10.0.19041.0`), MVVM without a framework (`Core/ViewModelBase`, `RelayCommand`),
|
||||
services through `ServiceLocator` (Microsoft.Extensions.DependencyInjection).
|
||||
|
||||
## Layout
|
||||
- `Models/ReminderModels.cs`: `ReminderTask`, `Folder`, `AppData`. The recurrence logic (`GetNextOccurrence(now)`,
|
||||
`ProcessDue`) is pure and tested.
|
||||
- `Services/`: `DataService` (JSON in %APPDATA%, atomic + serialized), `LocalizationService` (Locales are
|
||||
**EmbeddedResource** `Locales.<lang>.json`), `TaskCsv` + `Core/Csv` (import/export), `AutostartService`
|
||||
(HKCU Run, `"exe" --minimized`), `NotificationService` (tray balloon).
|
||||
- `Core/Theme.cs`: the only light/dark palette, used by MainWindow and the dialogs (`Theme.Apply(Resources, dark)`).
|
||||
- `MainWindow.xaml`: custom chrome (WindowStyle=None). Icons are Segoe MDL2 glyphs or Path geometry, **no emojis**
|
||||
(they don't follow the theme).
|
||||
- `Tests/`: xUnit project, excluded from the app csproj via `Compile Remove`.
|
||||
|
||||
## Rules
|
||||
- Every new UI text goes in **both** `Locales/en.json` and `de.json`. The test `All_keys_used_in_code_exist` checks this.
|
||||
- Never write data next to the exe (single-file/Program Files) – always use `DataService.DefaultDataDirectory`.
|
||||
For screenshots/tests: set the environment variable `REMINDER_ORGANIZER_DATA` to a temp folder.
|
||||
- Credits: "© year Michael Media" + Discord link (sidebar footer, File menu, csproj Company/Copyright).
|
||||
- Run `dotnet test Tests\ReminderOrganizer.Tests.csproj` before each release. `release.bat` does this automatically.
|
||||
|
||||
## Graphics
|
||||
`sprite-generator\` = ComfyGen template (`_Tools\ComfyGen`). App icon: `gen generate icon` → `gen adopt --size 512 icon`
|
||||
→ convert `Assets\Sprites\icon.png` to `Assets\app.ico` (Pillow, sizes 16–256). The csproj and MainWindow pick up
|
||||
`Assets\app.ico` automatically (window, tray, exe). Without the file, the default icon is used.
|
||||
49
Core/Csv.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace ReminderOrganizer.Core
|
||||
{
|
||||
/// <summary>Minimal CSV for ';'-separated files with "quoted" fields (quotes doubled, newlines allowed).</summary>
|
||||
public static class Csv
|
||||
{
|
||||
public const char Separator = ';';
|
||||
|
||||
public static string Escape(string? value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return "";
|
||||
if (value.IndexOfAny(new[] { Separator, '"', '\n', '\r' }) >= 0)
|
||||
return "\"" + value.Replace("\"", "\"\"") + "\"";
|
||||
return value;
|
||||
}
|
||||
|
||||
public static List<List<string>> Parse(string text)
|
||||
{
|
||||
var rows = new List<List<string>>();
|
||||
var row = new List<string>();
|
||||
var field = new StringBuilder();
|
||||
bool inQuotes = false;
|
||||
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
char c = text[i];
|
||||
if (inQuotes)
|
||||
{
|
||||
if (c == '"')
|
||||
{
|
||||
if (i + 1 < text.Length && text[i + 1] == '"') { field.Append('"'); i++; }
|
||||
else inQuotes = false;
|
||||
}
|
||||
else field.Append(c);
|
||||
}
|
||||
else if (c == '"') inQuotes = true;
|
||||
else if (c == Separator) { row.Add(field.ToString()); field.Clear(); }
|
||||
else if (c == '\r') { }
|
||||
else if (c == '\n') { row.Add(field.ToString()); field.Clear(); rows.Add(row); row = new List<string>(); }
|
||||
else field.Append(c);
|
||||
}
|
||||
if (field.Length > 0 || row.Count > 0) { row.Add(field.ToString()); rows.Add(row); }
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Core/Theme.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
#nullable enable
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace ReminderOrganizer.Core
|
||||
{
|
||||
/// <summary>One place for the light/dark palette – used by the main window and all dialogs.</summary>
|
||||
public static class Theme
|
||||
{
|
||||
private static SolidColorBrush B(uint rgb)
|
||||
{
|
||||
var b = new SolidColorBrush(Color.FromRgb((byte)(rgb >> 16), (byte)(rgb >> 8), (byte)rgb));
|
||||
b.Freeze();
|
||||
return b;
|
||||
}
|
||||
|
||||
public static void Apply(ResourceDictionary res, bool dark)
|
||||
{
|
||||
if (dark)
|
||||
{
|
||||
res["SidebarBrush"] = B(0x1A1A24);
|
||||
res["CardBrush"] = B(0x22222E);
|
||||
res["TextPrimaryBrush"] = B(0xF5F5F5);
|
||||
res["TextSecondaryBrush"] = B(0xA8A8BC);
|
||||
res["BorderBrush"] = B(0x3A3A4A);
|
||||
res["BackgroundBrush"] = B(0x121218);
|
||||
res["HoverBrush"] = B(0x2A2A3A);
|
||||
res["SidebarTextBrush"] = B(0xF5F5F5);
|
||||
res["SidebarSecondaryBrush"] = B(0x9999AA);
|
||||
res["MenuBackgroundBrush"] = B(0x22222E);
|
||||
res["PrimaryLightBrush"] = B(0x37345F);
|
||||
res["HeaderBrush"] = B(0x22222E);
|
||||
res["InputBackgroundBrush"] = B(0x2A2A38);
|
||||
res["BadgeBrush"] = B(0x37345F);
|
||||
res["BadgeTextBrush"] = B(0xC7C8FF);
|
||||
}
|
||||
else
|
||||
{
|
||||
res["SidebarBrush"] = B(0xF8FAFC);
|
||||
res["CardBrush"] = B(0xFFFFFF);
|
||||
res["TextPrimaryBrush"] = B(0x1E293B);
|
||||
res["TextSecondaryBrush"] = B(0x64748B);
|
||||
res["BorderBrush"] = B(0xE2E8F0);
|
||||
res["BackgroundBrush"] = B(0xF1F5F9);
|
||||
res["HoverBrush"] = B(0xE2E8F0);
|
||||
res["SidebarTextBrush"] = B(0x1E293B);
|
||||
res["SidebarSecondaryBrush"] = B(0x64748B);
|
||||
res["MenuBackgroundBrush"] = B(0xFFFFFF);
|
||||
res["PrimaryLightBrush"] = B(0xEEF2FF);
|
||||
res["HeaderBrush"] = B(0xFFFFFF);
|
||||
res["InputBackgroundBrush"] = B(0xF1F5F9);
|
||||
res["BadgeBrush"] = B(0xE0E7FF);
|
||||
res["BadgeTextBrush"] = B(0x4338CA);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
<Window x:Class="ReminderOrganizer.InputDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Input"
|
||||
Height="200" Width="400"
|
||||
Title="Input"
|
||||
Width="400" SizeToContent="Height"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
@@ -12,7 +12,6 @@
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown">
|
||||
<Window.Resources>
|
||||
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
|
||||
<SolidColorBrush x:Key="PrimaryHoverBrush" Color="#4F46E5"/>
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
|
||||
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
|
||||
@@ -27,32 +26,34 @@
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,12">
|
||||
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,10">
|
||||
<Grid>
|
||||
<TextBlock Text="📁" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="TxtPrompt" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="28,0,0,0"/>
|
||||
<Button Content="✕" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
|
||||
<TextBlock x:Name="TxtTitle" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="28,0,36,0"/>
|
||||
<Button Content="" FontFamily="Segoe MDL2 Assets" FontSize="10" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
|
||||
Width="28" Height="28" Cursor="Hand" Click="BtnCancel_Click"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Content -->
|
||||
<StackPanel Grid.Row="1" Margin="16">
|
||||
<TextBox x:Name="TxtInput" Background="{DynamicResource InputBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||
<TextBlock x:Name="TxtPrompt" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,4"/>
|
||||
<TextBox x:Name="TxtInput" Background="{DynamicResource InputBackgroundBrush}"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}" CaretBrush="{DynamicResource TextPrimaryBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||
Padding="12,10" FontSize="14"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
|
||||
<Button x:Name="BtnCancel" Click="BtnCancel_Click" Background="Transparent"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||
<Button x:Name="BtnCancel" Click="BtnCancel_Click" Background="Transparent" Content="Cancel"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}" IsCancel="True"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1"
|
||||
Padding="16,8" Cursor="Hand"/>
|
||||
<Button x:Name="BtnOk" Click="BtnOk_Click" Background="#6366F1"
|
||||
Foreground="White" BorderThickness="0"
|
||||
<Button x:Name="BtnOk" Click="BtnOk_Click" Background="#6366F1" Content="OK"
|
||||
Foreground="White" BorderThickness="0"
|
||||
Padding="16,8" Margin="8,0,0,0" Cursor="Hand" IsDefault="True"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using ReminderOrganizer.Core;
|
||||
using ReminderOrganizer.Models;
|
||||
using ReminderOrganizer.Services;
|
||||
|
||||
namespace ReminderOrganizer
|
||||
@@ -11,22 +10,26 @@ namespace ReminderOrganizer
|
||||
{
|
||||
public string ResponseText { get; private set; } = "";
|
||||
|
||||
public InputDialog(string title, string prompt, string defaultValue = "", ILocalizationService? localizationService = null)
|
||||
public InputDialog(string title, string prompt, string defaultValue = "", bool? darkMode = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = title;
|
||||
TxtTitle.Text = title;
|
||||
TxtPrompt.Text = prompt;
|
||||
TxtInput.Text = defaultValue;
|
||||
|
||||
// Localize buttons if localization service is provided
|
||||
if (localizationService != null)
|
||||
|
||||
if (ServiceLocator.Services.GetService(typeof(ILocalizationService)) is ILocalizationService loc)
|
||||
{
|
||||
BtnCancel.Content = localizationService.GetString("Cancel");
|
||||
BtnOk.Content = localizationService.GetString("OK");
|
||||
BtnCancel.Content = loc.GetString("Cancel");
|
||||
BtnOk.Content = loc.GetString("OK");
|
||||
}
|
||||
|
||||
TxtInput.SelectAll();
|
||||
TxtInput.Focus();
|
||||
if (darkMode.HasValue) Theme.Apply(Resources, darkMode.Value);
|
||||
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
TxtInput.Focus();
|
||||
TxtInput.SelectAll();
|
||||
};
|
||||
}
|
||||
|
||||
private void BtnOk_Click(object sender, RoutedEventArgs e)
|
||||
@@ -42,7 +45,7 @@ namespace ReminderOrganizer
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed)
|
||||
if (e.LeftButton == MouseButtonState.Pressed && e.OriginalSource is not System.Windows.Controls.TextBox)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"EditTaskTooltip": "Task bearbeiten",
|
||||
"DeleteTaskTooltip": "Task löschen",
|
||||
"Info": "Info",
|
||||
"Discord": "Discord Einladung",
|
||||
"Discord": "Discord-Community",
|
||||
"Import": "Import",
|
||||
"Export": "Export",
|
||||
"ImportCsv": "CSV Importieren",
|
||||
@@ -82,6 +82,11 @@
|
||||
"NoFolderSelectFirst": "Bitte zuerst einen Ordner auswählen oder erstellen.",
|
||||
"ImportInvalidDate": "Ungültiges Datum in Zeile {0}",
|
||||
"ImportSkippedRow": "Zeile {0} übersprungen: nicht genug Spalten",
|
||||
"AppTitle": "Reminder Organizer",
|
||||
"RecurringTaskTooltip": "Wiederkehrende Aufgabe"
|
||||
"RecurringTaskTooltip": "Wiederkehrende Aufgabe",
|
||||
"DoneTooltip": "Erledigt (keine Erinnerung mehr)",
|
||||
"ConfirmDeleteFolder": "Ordner \"{0}\" mit {1} Aufgabe(n) löschen?",
|
||||
"ConfirmDeleteTask": "Aufgabe \"{0}\" löschen?",
|
||||
"ImportSkipped": "({0} Zeilen übersprungen)",
|
||||
"PastDateWarning": "Das Datum liegt in der Vergangenheit – die Erinnerung kommt sofort.",
|
||||
"MinimizedToTray": "Läuft weiter im Infobereich. Doppelklick aufs Symbol öffnet das Fenster."
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"EditTaskTooltip": "Edit task",
|
||||
"DeleteTaskTooltip": "Delete task",
|
||||
"Info": "Info",
|
||||
"Discord": "Discord Invite",
|
||||
"Discord": "Discord community",
|
||||
"Import": "Import",
|
||||
"Export": "Export",
|
||||
"ImportCsv": "Import CSV",
|
||||
@@ -82,6 +82,11 @@
|
||||
"NoFolderSelectFirst": "Please select or create a folder first.",
|
||||
"ImportInvalidDate": "Invalid date in row {0}",
|
||||
"ImportSkippedRow": "Row {0} skipped: not enough columns",
|
||||
"AppTitle": "Reminder Organizer",
|
||||
"RecurringTaskTooltip": "Recurring task"
|
||||
"RecurringTaskTooltip": "Recurring task",
|
||||
"DoneTooltip": "Done (no more reminder)",
|
||||
"ConfirmDeleteFolder": "Delete folder \"{0}\" with {1} task(s)?",
|
||||
"ConfirmDeleteTask": "Delete task \"{0}\"?",
|
||||
"ImportSkipped": "({0} rows skipped)",
|
||||
"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."
|
||||
}
|
||||
|
||||
345
MainWindow.xaml
@@ -36,6 +36,37 @@
|
||||
<SolidColorBrush x:Key="SidebarTextBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="SidebarSecondaryBrush" Color="#808090"/>
|
||||
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="#252535"/>
|
||||
<SolidColorBrush x:Key="BadgeBrush" Color="#37345F"/>
|
||||
<SolidColorBrush x:Key="BadgeTextBrush" Color="#C7C8FF"/>
|
||||
|
||||
<!-- 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>
|
||||
|
||||
<!-- Round "done" check that follows the theme -->
|
||||
<Style x:Key="DoneCheck" TargetType="CheckBox">
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="CheckBox">
|
||||
<Border x:Name="box" Width="20" Height="20" CornerRadius="10" BorderThickness="1.5"
|
||||
BorderBrush="{DynamicResource TextSecondaryBrush}" Background="Transparent">
|
||||
<TextBlock x:Name="mark" Text="" FontFamily="Segoe MDL2 Assets" FontSize="11"
|
||||
Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="box" Property="BorderBrush" Value="{DynamicResource SecondaryBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="box" Property="Background" Value="{DynamicResource SecondaryBrush}"/>
|
||||
<Setter TargetName="box" Property="BorderBrush" Value="{DynamicResource SecondaryBrush}"/>
|
||||
<Setter TargetName="mark" Property="Visibility" Value="Visible"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Glow Effect -->
|
||||
<DropShadowEffect x:Key="GlowEffect" BlurRadius="15" ShadowDepth="0" Opacity="0.5" Color="#6366F1"/>
|
||||
@@ -348,9 +379,9 @@
|
||||
<DockPanel Margin="8,4">
|
||||
<!-- Window Controls on Right -->
|
||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<Button Content="─" Style="{StaticResource IconButton}" Click="MinimizeButton_Click" FontSize="16" FontWeight="Bold" ToolTip="{Binding MinimizeTooltip}"/>
|
||||
<Button x:Name="MaximizeButton" Content="□" Style="{StaticResource IconButton}" Click="MaximizeButton_Click" FontSize="12" ToolTip="{Binding MaximizeTooltip}"/>
|
||||
<Button Content="✕" Style="{StaticResource IconButton}" Click="CloseButton_Click" FontSize="14" Foreground="{DynamicResource DangerBrush}" ToolTip="{Binding CloseTooltip}"/>
|
||||
<Button Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="MinimizeButton_Click" FontSize="10" ToolTip="{Binding MinimizeTooltip}"/>
|
||||
<Button x:Name="MaximizeButton" Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="MaximizeButton_Click" FontSize="10" ToolTip="{Binding MaximizeTooltip}"/>
|
||||
<Button Content="" FontFamily="Segoe MDL2 Assets" Style="{StaticResource IconButton}" Click="CloseButton_Click" FontSize="10" Foreground="{DynamicResource DangerBrush}" ToolTip="{Binding CloseTooltip}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Menu Bar on Left -->
|
||||
@@ -361,7 +392,7 @@
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="10" ShadowDepth="0" Opacity="0.5" Color="#6366F1"/>
|
||||
</Border.Effect>
|
||||
<TextBlock Text="📋" FontSize="14" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="14" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding AppTitleText}" FontSize="14" FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center"/>
|
||||
@@ -386,25 +417,28 @@
|
||||
</MenuItem>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="{Binding AutostartText}" Command="{Binding ToggleAutostartCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||
<MenuItem Header="{Binding AutostartText}" Command="{Binding ToggleAutostartCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="✓" Foreground="{DynamicResource PrimaryBrush}" FontWeight="Bold"
|
||||
Visibility="{Binding IsAutostartEnabled, Converter={StaticResource BoolToVisibility}}"/>
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{Binding TestNotificationText}" Command="{Binding TestNotificationCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{Binding ImportText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem Header="{Binding ImportCsvText}" Command="{Binding ImportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="📥" FontSize="12"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Header="{Binding ImportCsvText}" Command="{Binding ImportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{Binding ExportText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem Header="{Binding ExportCsvText}" Command="{Binding ExportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="📤" FontSize="12"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Header="{Binding ExportCsvText}" Command="{Binding ExportCsvCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="{Binding InfoText}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem Header="{Binding DiscordText}" Command="{Binding OpenDiscordCommand}" Style="{StaticResource DarkMenuItemStyle}">
|
||||
<MenuItem.Icon>
|
||||
<TextBlock Text="💬" FontSize="12"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
</MenuItem.Icon>
|
||||
<MenuItem Header="{Binding DiscordText}" Click="Info_Click" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||
</MenuItem>
|
||||
<Separator/>
|
||||
<MenuItem Header="{Binding ExitText}" Command="{Binding ExitCommand}" Style="{StaticResource DarkMenuItemStyle}"/>
|
||||
@@ -430,95 +464,103 @@
|
||||
<Border Grid.Column="0" Background="{DynamicResource SidebarBrush}" CornerRadius="0,0,0,12">
|
||||
<DockPanel>
|
||||
<!-- Action Buttons -->
|
||||
<StackPanel DockPanel.Dock="Bottom" Margin="16,12">
|
||||
<Button Content="{Binding AddFolderText}" Command="{Binding AddFolderCommand}"
|
||||
Style="{StaticResource ModernButton}" Height="44" Margin="0,0,0,8"/>
|
||||
<Button Content="{Binding AddTaskText}" Command="{Binding AddTaskCommand}"
|
||||
Style="{StaticResource SecondaryButton}" Height="44" Margin="0,0,0,8"
|
||||
MouseEnter="SecondaryButton_MouseEnter" MouseLeave="SecondaryButton_MouseLeave"/>
|
||||
<Button Content="{Binding TestNotificationText}" Command="{Binding TestNotificationCommand}"
|
||||
Style="{StaticResource SecondaryButton}" Height="44"
|
||||
MouseEnter="SecondaryButton_MouseEnter" MouseLeave="SecondaryButton_MouseLeave"/>
|
||||
<!-- Credits -->
|
||||
<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=" · " FontSize="11" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
||||
<TextBlock FontSize="11" VerticalAlignment="Center" ToolTip="{Binding DiscordText}">
|
||||
<Hyperlink Command="{Binding OpenDiscordCommand}" Foreground="{DynamicResource PrimaryBrush}" TextDecorations="None">Discord</Hyperlink>
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding VersionText}" FontSize="11" Margin="8,0,0,0" Foreground="{DynamicResource SidebarSecondaryBrush}" VerticalAlignment="Center"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Folders Section -->
|
||||
<StackPanel Margin="16,20,16,10">
|
||||
<TextBlock Text="{Binding FoldersText}"
|
||||
Foreground="{DynamicResource SidebarSecondaryBrush}"
|
||||
FontSize="11" FontWeight="SemiBold"
|
||||
Margin="12,0,0,12"/>
|
||||
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto" MaxHeight="400">
|
||||
<TreeView x:Name="FolderTree"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource SidebarTextBrush}"
|
||||
ItemsSource="{Binding Folders}"
|
||||
SelectedItemChanged="FolderTree_SelectedItemChanged"
|
||||
AllowDrop="True"
|
||||
Drop="TreeView_Drop"
|
||||
DragOver="TreeView_DragOver"
|
||||
Padding="10,0">
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SidebarTextBrush}"/>
|
||||
<Setter Property="Padding" Value="4"/>
|
||||
<Setter Property="Margin" Value="0,2"/>
|
||||
<Setter Property="IsExpanded" Value="True"/>
|
||||
<Setter Property="AllowDrop" Value="True"/>
|
||||
<EventSetter Event="Drop" Handler="TreeViewItem_Drop"/>
|
||||
<EventSetter Event="DragOver" Handler="TreeViewItem_DragOver"/>
|
||||
<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_RightClick"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TreeViewItem">
|
||||
<Border x:Name="Bd" Background="Transparent" CornerRadius="10" Padding="12,10" Margin="0,2,0,2">
|
||||
<Border x:Name="SelectionBorder" CornerRadius="10" Background="Transparent" Padding="0">
|
||||
<Grid>
|
||||
<Border x:Name="LeftIndicator" Width="0" CornerRadius="2" Background="{DynamicResource PrimaryBrush}"
|
||||
HorizontalAlignment="Left" Margin="0,4,8,4"/>
|
||||
<ContentPresenter x:Name="PART_Header" ContentSource="Header"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="SelectionBorder" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter TargetName="LeftIndicator" Property="Width" Value="0"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="SelectionBorder" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.ItemTemplate>
|
||||
<HierarchicalDataTemplate DataType="{x:Type models:Folder}" ItemsSource="{Binding Tasks}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="📁" FontSize="14" Margin="0,0,10,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding Name}" FontSize="13" FontWeight="Medium" VerticalAlignment="Center"/>
|
||||
<Border Background="{DynamicResource PrimaryBrush}" CornerRadius="10"
|
||||
Padding="6,2" Margin="8,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Tasks.Count}" FontSize="11"
|
||||
Foreground="White" FontWeight="SemiBold"/>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</HierarchicalDataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{Binding AddTaskToFolderText}" Click="AddTaskToFolder_Click"/>
|
||||
<MenuItem Header="{Binding RenameText}" Click="RenameFolder_Click"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="{Binding DeleteText}" Click="DeleteFolder_Click" Foreground="{DynamicResource DangerBrush}"/>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</ScrollViewer>
|
||||
<!-- Action Buttons -->
|
||||
<StackPanel DockPanel.Dock="Bottom" Margin="16,12,16,10">
|
||||
<Button Content="{Binding AddFolderText}" Command="{Binding AddFolderCommand}"
|
||||
Style="{StaticResource ModernButton}" Height="44" Margin="0"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Folders Section (fills the remaining height) -->
|
||||
<TextBlock DockPanel.Dock="Top" Text="{Binding FoldersText}"
|
||||
Foreground="{DynamicResource SidebarSecondaryBrush}"
|
||||
FontSize="11" FontWeight="SemiBold"
|
||||
Margin="28,20,16,8"/>
|
||||
|
||||
<TreeView x:Name="FolderTree" Margin="12,0,12,0"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{DynamicResource SidebarTextBrush}"
|
||||
ItemsSource="{Binding Folders}"
|
||||
SelectedItemChanged="FolderTree_SelectedItemChanged"
|
||||
AllowDrop="True"
|
||||
Drop="TreeView_Drop"
|
||||
DragOver="TreeView_DragOver"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||
<TreeView.ItemContainerStyle>
|
||||
<Style TargetType="TreeViewItem">
|
||||
<Setter Property="Foreground" Value="{DynamicResource SidebarTextBrush}"/>
|
||||
<Setter Property="AllowDrop" Value="True"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
|
||||
<EventSetter Event="Drop" Handler="TreeViewItem_Drop"/>
|
||||
<EventSetter Event="DragOver" Handler="TreeViewItem_DragOver"/>
|
||||
<EventSetter Event="DragEnter" Handler="TreeViewItem_DragEnter"/>
|
||||
<EventSetter Event="DragLeave" Handler="TreeViewItem_DragLeave"/>
|
||||
<EventSetter Event="PreviewMouseRightButtonDown" Handler="TreeViewItem_RightClick"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="TreeViewItem">
|
||||
<Border x:Name="Bd" Background="Transparent" CornerRadius="10" Padding="12,9" Margin="0,2"
|
||||
BorderThickness="1" BorderBrush="Transparent" Cursor="Hand">
|
||||
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="Stretch"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<!-- order matters: later triggers win, so selection beats hover -->
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="Tag" Value="DropTarget">
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||
<Setter Property="Foreground" Value="White"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</TreeView.ItemContainerStyle>
|
||||
<TreeView.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type models:Folder}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Path Data="{StaticResource FolderGeometry}" Width="16" Height="16" Margin="0,0,10,0" VerticalAlignment="Center"
|
||||
StrokeThickness="1.3" StrokeLineJoin="Round"
|
||||
Stroke="{Binding Foreground, RelativeSource={RelativeSource AncestorType=TreeViewItem}}"/>
|
||||
<TextBlock Grid.Column="1" Text="{Binding Name}" FontSize="13" FontWeight="Medium" VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding Name}"/>
|
||||
<Border Grid.Column="2" Background="{DynamicResource BadgeBrush}" CornerRadius="9" MinWidth="22"
|
||||
Padding="6,1" Margin="8,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Tasks.Count}" FontSize="11" HorizontalAlignment="Center"
|
||||
Foreground="{DynamicResource BadgeTextBrush}" FontWeight="SemiBold"/>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</TreeView.ItemTemplate>
|
||||
<TreeView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{Binding AddTaskToFolderText}" Click="AddTaskToFolder_Click"/>
|
||||
<MenuItem Header="{Binding RenameText}" Command="{Binding RenameFolderCommand}"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="{Binding DeleteText}" Command="{Binding DeleteFolderCommand}" Foreground="{DynamicResource DangerBrush}"/>
|
||||
</ContextMenu>
|
||||
</TreeView.ContextMenu>
|
||||
</TreeView>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
@@ -531,21 +573,22 @@
|
||||
|
||||
<!-- Header Section -->
|
||||
<DockPanel Grid.Row="0" Margin="0,8,0,20">
|
||||
<StackPanel DockPanel.Dock="Left" Orientation="Horizontal">
|
||||
<Border Width="44" Height="44" CornerRadius="12" Background="{DynamicResource PrimaryBrush}"
|
||||
<Button DockPanel.Dock="Right" Content="{Binding AddTaskText}" Command="{Binding AddTaskCommand}"
|
||||
Style="{StaticResource ModernButton}" Padding="20,10" Margin="0" VerticalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border Width="44" Height="44" CornerRadius="12" Background="{DynamicResource PrimaryBrush}"
|
||||
VerticalAlignment="Center" Margin="0,0,16,0">
|
||||
<TextBlock Text="📋" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Path Data="{StaticResource FolderGeometry}" Width="16" Height="16" Stretch="None" StrokeThickness="1.3" StrokeLineJoin="Round"
|
||||
Stroke="White" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Path.LayoutTransform>
|
||||
<ScaleTransform ScaleX="1.4" ScaleY="1.4"/>
|
||||
</Path.LayoutTransform>
|
||||
</Path>
|
||||
</Border>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding SelectedFolderName}" FontSize="22" FontWeight="Bold"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<TextBlock FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,2,0,0">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding StringFormat="{}{0} Tasks">
|
||||
<Binding Path="SelectedFolderTasks.Count" FallbackValue="0"/>
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding SelectedFolderName}" FontSize="22" FontWeight="Bold"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}" TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Text="{Binding TaskCountText}" FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
@@ -566,8 +609,8 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="160"/>
|
||||
<ColumnDefinition Width="70"/>
|
||||
<ColumnDefinition Width="170"/>
|
||||
<ColumnDefinition Width="96"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<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"/>
|
||||
@@ -578,7 +621,7 @@
|
||||
|
||||
<!-- Tasks -->
|
||||
<ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl ItemsSource="{Binding SelectedFolderTasks}" Margin="8,0,8,8">
|
||||
<ItemsControl ItemsSource="{Binding SelectedFolderTasksView}" Margin="8,0,8,8">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border x:Name="taskBorder" CornerRadius="12" Margin="0,4" Padding="16"
|
||||
@@ -600,8 +643,8 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="160"/>
|
||||
<ColumnDefinition Width="70"/>
|
||||
<ColumnDefinition Width="170"/>
|
||||
<ColumnDefinition Width="96"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- Status Indicator -->
|
||||
@@ -610,49 +653,65 @@
|
||||
<Style TargetType="Ellipse">
|
||||
<Setter Property="Fill" Value="{DynamicResource SecondaryBrush}"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsNotified}" Value="True">
|
||||
<Setter Property="Fill" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||
</DataTrigger>
|
||||
<!-- later trigger wins: done (grey) beats overdue (red) -->
|
||||
<DataTrigger Binding="{Binding ReminderDate, Converter={StaticResource DatePassed}}" Value="True">
|
||||
<Setter Property="Fill" Value="{DynamicResource DangerBrush}"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsNotified}" Value="True">
|
||||
<Setter Property="Fill" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Ellipse.Style>
|
||||
</Ellipse>
|
||||
|
||||
<!-- Task Info -->
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center" Margin="0,0,12,0">
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="StackPanel">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsNotified}" Value="True">
|
||||
<Setter Property="Opacity" Value="0.5"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="SemiBold"
|
||||
<TextBlock Text="{Binding Name}" FontSize="14" FontWeight="SemiBold" TextTrimming="CharacterEllipsis"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<TextBlock Text="🔄" FontSize="12" Margin="6,0,0,0" VerticalAlignment="Center"
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="11" Margin="8,0,0,0" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource PrimaryBrush}"
|
||||
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}"
|
||||
ToolTip="{Binding RecurringTaskTooltipText, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||
ToolTip="{Binding DataContext.RecurringTaskTooltipText, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding Description}" FontSize="12"
|
||||
<TextBlock Text="{Binding Description}" FontSize="12"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
TextTrimming="CharacterEllipsis" MaxWidth="400" Margin="0,4,0,0"
|
||||
TextTrimming="CharacterEllipsis" Margin="0,4,0,0"
|
||||
Visibility="{Binding Description, Converter={StaticResource StringToVisibility}}"/>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- Date -->
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="🕐" FontSize="12" Margin="0,0,6,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding ReminderDate, StringFormat='dd.MM.yyyy HH:mm'}"
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" Margin="0,0,8,0" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
<TextBlock Text="{Binding ReminderDate, StringFormat='dd.MM.yyyy HH:mm'}"
|
||||
FontSize="12" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Checkbox, Edit & Delete -->
|
||||
|
||||
<!-- Done, Edit & Delete -->
|
||||
<StackPanel Grid.Column="3" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right">
|
||||
<CheckBox IsChecked="{Binding IsNotified, Mode=TwoWay}" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<Button Content="✏"
|
||||
Command="{Binding DataContext.EditTaskCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
<CheckBox IsChecked="{Binding IsNotified, Mode=TwoWay}" VerticalAlignment="Center" Margin="0,0,10,0"
|
||||
Style="{StaticResource DoneCheck}"
|
||||
Command="{Binding DataContext.ToggleDoneCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip="{Binding DataContext.DoneTooltip, RelativeSource={RelativeSource AncestorType=Window}}"/>
|
||||
<Button Content="" FontFamily="Segoe MDL2 Assets"
|
||||
Command="{Binding DataContext.EditTaskCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||
CommandParameter="{Binding}"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
Cursor="Hand" FontSize="12" Padding="4,0"
|
||||
ToolTip="{Binding EditTaskTooltip}">
|
||||
Cursor="Hand" FontSize="13" Padding="6,4"
|
||||
ToolTip="{Binding DataContext.EditTaskTooltip, RelativeSource={RelativeSource AncestorType=Window}}">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Opacity" Value="0.5"/>
|
||||
@@ -665,13 +724,13 @@
|
||||
</Style>
|
||||
</Button.Style>
|
||||
</Button>
|
||||
<Button Content="🗑"
|
||||
Command="{Binding DataContext.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=ItemsControl}}"
|
||||
<Button Content="" FontFamily="Segoe MDL2 Assets"
|
||||
Command="{Binding DataContext.DeleteTaskCommand, RelativeSource={RelativeSource AncestorType=Window}}"
|
||||
CommandParameter="{Binding}"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Background="Transparent" BorderThickness="0"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
Cursor="Hand" FontSize="14" Padding="4,0,0,0"
|
||||
ToolTip="{Binding DeleteTaskTooltip}">
|
||||
Cursor="Hand" FontSize="13" Padding="6,4"
|
||||
ToolTip="{Binding DataContext.DeleteTaskTooltip, RelativeSource={RelativeSource AncestorType=Window}}">
|
||||
<Button.Style>
|
||||
<Style TargetType="Button">
|
||||
<Setter Property="Opacity" Value="0.5"/>
|
||||
@@ -706,7 +765,7 @@
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="25" ShadowDepth="0" Opacity="0.3" Color="#6366F1"/>
|
||||
</Border.Effect>
|
||||
<TextBlock Text="✨" FontSize="42" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="40" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</Border>
|
||||
<TextBlock Text="{Binding NoTasks}"
|
||||
FontSize="18" FontWeight="SemiBold"
|
||||
|
||||
@@ -1,113 +1,134 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using ReminderOrganizer.Core;
|
||||
using ReminderOrganizer.Models;
|
||||
using ReminderOrganizer.Services;
|
||||
using ReminderOrganizer.ViewModels;
|
||||
|
||||
namespace ReminderOrganizer
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private const string IconUri = "pack://application:,,,/Assets/app.ico";
|
||||
|
||||
private readonly MainViewModel _viewModel;
|
||||
private System.Windows.Forms.NotifyIcon? _notifyIcon;
|
||||
private bool _initialized;
|
||||
private bool _trayHintShown;
|
||||
private Point _dragStart;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_viewModel = ServiceLocator.Services.GetService(typeof(MainViewModel)) as MainViewModel
|
||||
?? throw new System.InvalidOperationException("MainViewModel not found");
|
||||
|
||||
_viewModel = ServiceLocator.Services.GetService(typeof(MainViewModel)) as MainViewModel
|
||||
?? throw new InvalidOperationException("MainViewModel not found");
|
||||
DataContext = _viewModel;
|
||||
|
||||
_viewModel.ThemeChanged += OnThemeChanged;
|
||||
_viewModel.ThemeChanged += (_, dark) => ApplyTheme(dark, animate: true);
|
||||
_viewModel.EditTaskRequested += OnEditTaskRequested;
|
||||
_viewModel.PropertyChanged += OnViewModelPropertyChanged;
|
||||
|
||||
Loaded += MainWindow_Loaded;
|
||||
TrySetWindowIcon();
|
||||
Loaded += async (_, _) => await InitializeOnceAsync();
|
||||
StateChanged += MainWindow_StateChanged;
|
||||
}
|
||||
|
||||
/// <summary>Autostart: create the window (tray + timer) without showing it.</summary>
|
||||
public async void StartHidden()
|
||||
{
|
||||
new WindowInteropHelper(this).EnsureHandle();
|
||||
await InitializeOnceAsync();
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task InitializeOnceAsync()
|
||||
{
|
||||
if (_initialized) return;
|
||||
_initialized = true;
|
||||
SetupTrayIcon();
|
||||
await _viewModel.InitializeAsync();
|
||||
ApplyTheme(_viewModel.IsDarkMode, animate: false);
|
||||
SyncTreeSelection();
|
||||
}
|
||||
|
||||
private void TrySetWindowIcon()
|
||||
{
|
||||
try
|
||||
{
|
||||
Icon = System.Windows.Media.Imaging.BitmapFrame.Create(new Uri(IconUri));
|
||||
}
|
||||
catch
|
||||
{
|
||||
// no Assets\app.ico yet – Windows default icon
|
||||
}
|
||||
}
|
||||
|
||||
private void OnViewModelPropertyChanged(object? sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == nameof(MainViewModel.SelectedFolder))
|
||||
SyncTreeSelection();
|
||||
}
|
||||
|
||||
/// <summary>TreeView.SelectedItem is read-only – mirror the view model selection onto the container.</summary>
|
||||
private void SyncTreeSelection()
|
||||
{
|
||||
var folder = _viewModel.SelectedFolder;
|
||||
if (folder == null) return;
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (FolderTree.ItemContainerGenerator.ContainerFromItem(folder) is TreeViewItem item && !item.IsSelected)
|
||||
{
|
||||
item.IsSelected = true;
|
||||
item.BringIntoView();
|
||||
}
|
||||
}, System.Windows.Threading.DispatcherPriority.Loaded);
|
||||
}
|
||||
|
||||
private void OnEditTaskRequested(object? sender, ReminderTask? task)
|
||||
{
|
||||
if (task == null) return;
|
||||
|
||||
var taskWindow = new TaskWindow(task)
|
||||
{
|
||||
Owner = this
|
||||
};
|
||||
|
||||
var taskWindow = new TaskWindow(task, _viewModel.IsDarkMode) { Owner = this };
|
||||
if (taskWindow.ShowDialog() == true)
|
||||
{
|
||||
_ = _viewModel.SaveAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnThemeChanged(object? sender, bool isDarkMode)
|
||||
private void ApplyTheme(bool isDarkMode, bool animate)
|
||||
{
|
||||
ApplyTheme(isDarkMode);
|
||||
}
|
||||
Theme.Apply(Resources, isDarkMode);
|
||||
if (!animate || ThemeTransitionOverlay == null) return;
|
||||
|
||||
private void ApplyTheme(bool isDarkMode)
|
||||
{
|
||||
if (ThemeTransitionOverlay == null) return;
|
||||
|
||||
var overlay = ThemeTransitionOverlay;
|
||||
var overlayColor = isDarkMode ? Color.FromRgb(0x12, 0x12, 0x18) : Color.FromRgb(0xF1, 0xF5, 0xF9);
|
||||
|
||||
if (isDarkMode)
|
||||
{
|
||||
Resources["SidebarBrush"] = new SolidColorBrush(Color.FromRgb(0x1A, 0x1A, 0x24));
|
||||
Resources["CardBrush"] = new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x2E));
|
||||
Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0xF5, 0xF5, 0xF5));
|
||||
Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0xCC, 0xCC, 0xCC));
|
||||
Resources["BorderBrush"] = new SolidColorBrush(Color.FromRgb(0x3A, 0x3A, 0x4A));
|
||||
Resources["BackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0x12, 0x12, 0x18));
|
||||
Resources["HoverBrush"] = new SolidColorBrush(Color.FromRgb(0x2A, 0x2A, 0x3A));
|
||||
Resources["SidebarTextBrush"] = new SolidColorBrush(Color.FromRgb(0xF5, 0xF5, 0xF5));
|
||||
Resources["SidebarSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x99, 0x99, 0xAA));
|
||||
Resources["MenuBackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x2E));
|
||||
Resources["PrimaryLightBrush"] = new SolidColorBrush(Color.FromRgb(0x37, 0x34, 0x5F));
|
||||
Resources["HeaderBrush"] = new SolidColorBrush(Color.FromRgb(0x22, 0x22, 0x2E));
|
||||
}
|
||||
else
|
||||
{
|
||||
Resources["SidebarBrush"] = new SolidColorBrush(Color.FromRgb(0xF8, 0xFA, 0xFC));
|
||||
Resources["CardBrush"] = new SolidColorBrush(Colors.White);
|
||||
Resources["TextPrimaryBrush"] = new SolidColorBrush(Color.FromRgb(0x1E, 0x29, 0x3B));
|
||||
Resources["TextSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x64, 0x74, 0x8B));
|
||||
Resources["BorderBrush"] = new SolidColorBrush(Color.FromRgb(0xE2, 0xE8, 0xF0));
|
||||
Resources["BackgroundBrush"] = new SolidColorBrush(Color.FromRgb(0xF1, 0xF5, 0xF9));
|
||||
Resources["HoverBrush"] = new SolidColorBrush(Color.FromRgb(0xE2, 0xE8, 0xF0));
|
||||
Resources["SidebarTextBrush"] = new SolidColorBrush(Color.FromRgb(0x1E, 0x29, 0x3B));
|
||||
Resources["SidebarSecondaryBrush"] = new SolidColorBrush(Color.FromRgb(0x64, 0x74, 0x8B));
|
||||
Resources["MenuBackgroundBrush"] = new SolidColorBrush(Colors.White);
|
||||
Resources["PrimaryLightBrush"] = new SolidColorBrush(Color.FromRgb(0xEE, 0xF2, 0xFF));
|
||||
Resources["HeaderBrush"] = new SolidColorBrush(Colors.White);
|
||||
}
|
||||
|
||||
overlay.Background = new SolidColorBrush(overlayColor);
|
||||
overlay.Background = new SolidColorBrush(isDarkMode ? Color.FromRgb(0x12, 0x12, 0x18) : Color.FromRgb(0xF1, 0xF5, 0xF9));
|
||||
var fadeIn = new DoubleAnimation(0, 0.3, TimeSpan.FromMilliseconds(100));
|
||||
var fadeOut = new DoubleAnimation(0.3, 0, TimeSpan.FromMilliseconds(200));
|
||||
fadeIn.Completed += (s, args) => overlay.BeginAnimation(OpacityProperty, fadeOut);
|
||||
overlay.BeginAnimation(OpacityProperty, fadeIn);
|
||||
}
|
||||
|
||||
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetupTrayIcon();
|
||||
await _viewModel.InitializeAsync();
|
||||
ApplyTheme(_viewModel.IsDarkMode);
|
||||
}
|
||||
|
||||
private void MainWindow_StateChanged(object? sender, System.EventArgs e)
|
||||
private void MainWindow_StateChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (WindowState == WindowState.Minimized)
|
||||
{
|
||||
Hide();
|
||||
HideToTray();
|
||||
}
|
||||
}
|
||||
|
||||
private void HideToTray()
|
||||
{
|
||||
Hide();
|
||||
if (!_trayHintShown && _notifyIcon != null)
|
||||
{
|
||||
_trayHintShown = true;
|
||||
_notifyIcon.ShowBalloonTip(3000, _viewModel.L("AppTitle"), _viewModel.L("MinimizedToTray"), System.Windows.Forms.ToolTipIcon.Info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +138,7 @@ namespace ReminderOrganizer
|
||||
{
|
||||
MaximizeRestore();
|
||||
}
|
||||
else
|
||||
else if (e.LeftButton == MouseButtonState.Pressed)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
@@ -138,60 +159,65 @@ namespace ReminderOrganizer
|
||||
if (WindowState == WindowState.Maximized)
|
||||
{
|
||||
WindowState = WindowState.Normal;
|
||||
MaximizeButton.Content = "□";
|
||||
MaximizeButton.Content = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
// WindowStyle=None would cover the taskbar – limit to the work area.
|
||||
MaxHeight = SystemParameters.WorkArea.Height + 8;
|
||||
MaxWidth = SystemParameters.WorkArea.Width + 8;
|
||||
WindowState = WindowState.Maximized;
|
||||
MaximizeButton.Content = "❐";
|
||||
MaximizeButton.Content = "";
|
||||
}
|
||||
}
|
||||
|
||||
private void CloseButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Hide();
|
||||
HideToTray();
|
||||
}
|
||||
|
||||
private void SetupTrayIcon()
|
||||
{
|
||||
System.Drawing.Icon icon = System.Drawing.SystemIcons.Information;
|
||||
try
|
||||
{
|
||||
var res = Application.GetResourceStream(new Uri(IconUri));
|
||||
if (res != null) icon = new System.Drawing.Icon(res.Stream);
|
||||
}
|
||||
catch { }
|
||||
|
||||
_notifyIcon = new System.Windows.Forms.NotifyIcon
|
||||
{
|
||||
Icon = System.Drawing.SystemIcons.Information,
|
||||
Icon = icon,
|
||||
Visible = true,
|
||||
Text = "Reminder Organizer"
|
||||
};
|
||||
|
||||
ReminderOrganizer.Services.NotificationService.SharedTrayIcon = _notifyIcon;
|
||||
Services.NotificationService.SharedTrayIcon = _notifyIcon;
|
||||
|
||||
var menu = new System.Windows.Forms.ContextMenuStrip();
|
||||
menu.Items.Add(_viewModel.L("Open"), null, (s, e) => ShowMainWindow());
|
||||
menu.Items.Add(_viewModel.L("Exit"), null, (s, e) => {
|
||||
_notifyIcon?.Dispose();
|
||||
menu.Items.Add(_viewModel.L("Exit"), null, (s, e) =>
|
||||
{
|
||||
_viewModel.Cleanup();
|
||||
Application.Current.Shutdown();
|
||||
});
|
||||
_notifyIcon.ContextMenuStrip = menu;
|
||||
_notifyIcon.DoubleClick += (s, e) => ShowMainWindow();
|
||||
_notifyIcon.BalloonTipClicked += (s, e) => ShowMainWindow();
|
||||
}
|
||||
|
||||
private void ShowMainWindow()
|
||||
{
|
||||
Show();
|
||||
WindowState = WindowState.Normal;
|
||||
if (WindowState == WindowState.Minimized) WindowState = WindowState.Normal;
|
||||
Activate();
|
||||
}
|
||||
|
||||
private void FolderTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
_viewModel.SelectedFolder = e.NewValue as Folder;
|
||||
}
|
||||
|
||||
private void DeleteFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_viewModel.SelectedFolder != null)
|
||||
{
|
||||
_viewModel.DeleteFolderCommand.Execute(null);
|
||||
}
|
||||
if (e.NewValue is Folder folder)
|
||||
_viewModel.SelectedFolder = folder;
|
||||
}
|
||||
|
||||
private void TreeViewItem_RightClick(object sender, MouseButtonEventArgs e)
|
||||
@@ -203,18 +229,6 @@ namespace ReminderOrganizer
|
||||
}
|
||||
}
|
||||
|
||||
private void RenameFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_viewModel.SelectedFolder == null) return;
|
||||
|
||||
var inputDialog = new InputDialog(_viewModel.L("RenameFolder"), _viewModel.L("NewName"), _viewModel.SelectedFolder.Name);
|
||||
if (inputDialog.ShowDialog() == true)
|
||||
{
|
||||
_viewModel.SelectedFolder.Name = inputDialog.ResponseText;
|
||||
_viewModel.SaveFolderCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddTaskToFolder_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (_viewModel.SelectedFolder != null)
|
||||
@@ -228,7 +242,8 @@ namespace ReminderOrganizer
|
||||
if (sender is FrameworkElement element && element.DataContext is ReminderTask task)
|
||||
{
|
||||
_viewModel.SelectedTask = task;
|
||||
|
||||
_dragStart = e.GetPosition(this);
|
||||
|
||||
if (e.ClickCount == 2)
|
||||
{
|
||||
_viewModel.EditTaskCommand.Execute(task);
|
||||
@@ -240,28 +255,17 @@ namespace ReminderOrganizer
|
||||
{
|
||||
if (sender is Border border)
|
||||
{
|
||||
var scaleTransform = border.RenderTransform as System.Windows.Media.ScaleTransform;
|
||||
if (scaleTransform != null)
|
||||
if (border.RenderTransform is ScaleTransform scaleTransform)
|
||||
{
|
||||
var scaleXAnim = new System.Windows.Media.Animation.DoubleAnimation(1, 1.02, TimeSpan.FromMilliseconds(150));
|
||||
var scaleYAnim = new System.Windows.Media.Animation.DoubleAnimation(1, 1.02, TimeSpan.FromMilliseconds(150));
|
||||
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(1, 1.01, TimeSpan.FromMilliseconds(150)));
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(1, 1.01, TimeSpan.FromMilliseconds(150)));
|
||||
}
|
||||
|
||||
var effect = border.Effect as System.Windows.Media.Effects.DropShadowEffect;
|
||||
if (effect != null)
|
||||
if (border.Effect is System.Windows.Media.Effects.DropShadowEffect effect)
|
||||
{
|
||||
var blurAnim = new System.Windows.Media.Animation.DoubleAnimation(15, TimeSpan.FromMilliseconds(200));
|
||||
var opacityAnim = new System.Windows.Media.Animation.DoubleAnimation(0.35, TimeSpan.FromMilliseconds(200));
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.BlurRadiusProperty, blurAnim);
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.OpacityProperty, opacityAnim);
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.BlurRadiusProperty, new DoubleAnimation(15, TimeSpan.FromMilliseconds(200)));
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.OpacityProperty, new DoubleAnimation(0.35, TimeSpan.FromMilliseconds(200)));
|
||||
}
|
||||
|
||||
var hoverColor = _viewModel?.IsDarkMode == true
|
||||
? Color.FromRgb(0x2A, 0x2A, 0x3A)
|
||||
: Color.FromRgb(0xE2, 0xE8, 0xF0);
|
||||
border.Background = new SolidColorBrush(hoverColor);
|
||||
border.SetResourceReference(Border.BackgroundProperty, "HoverBrush");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,139 +273,82 @@ namespace ReminderOrganizer
|
||||
{
|
||||
if (sender is Border border)
|
||||
{
|
||||
var scaleTransform = border.RenderTransform as System.Windows.Media.ScaleTransform;
|
||||
if (scaleTransform != null)
|
||||
if (border.RenderTransform is ScaleTransform scaleTransform)
|
||||
{
|
||||
var scaleXAnim = new System.Windows.Media.Animation.DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||
var scaleYAnim = new System.Windows.Media.Animation.DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||
scaleTransform.BeginAnimation(System.Windows.Media.ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(150)));
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, new DoubleAnimation(1, TimeSpan.FromMilliseconds(150)));
|
||||
}
|
||||
|
||||
var effect = border.Effect as System.Windows.Media.Effects.DropShadowEffect;
|
||||
if (effect != null)
|
||||
if (border.Effect is System.Windows.Media.Effects.DropShadowEffect effect)
|
||||
{
|
||||
var blurAnim = new System.Windows.Media.Animation.DoubleAnimation(0, TimeSpan.FromMilliseconds(150));
|
||||
var opacityAnim = new System.Windows.Media.Animation.DoubleAnimation(0, TimeSpan.FromMilliseconds(150));
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.BlurRadiusProperty, blurAnim);
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.OpacityProperty, opacityAnim);
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.BlurRadiusProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(150)));
|
||||
effect.BeginAnimation(System.Windows.Media.Effects.DropShadowEffect.OpacityProperty, new DoubleAnimation(0, TimeSpan.FromMilliseconds(150)));
|
||||
}
|
||||
|
||||
border.Background = new SolidColorBrush(Colors.Transparent);
|
||||
border.Background = Brushes.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
private void TaskItem_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == MouseButtonState.Pressed && sender is FrameworkElement element && element.DataContext is ReminderTask task)
|
||||
{
|
||||
DragDrop.DoDragDrop(element, task, DragDropEffects.Move);
|
||||
}
|
||||
}
|
||||
|
||||
private void Info_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = "https://discord.gg/bTx6c9GU",
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[Info_Click] Error: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private Color GetHoverColor()
|
||||
{
|
||||
return _viewModel?.IsDarkMode == true
|
||||
? Color.FromRgb(0x3A, 0x3A, 0x4A)
|
||||
: Color.FromRgb(0xE2, 0xE8, 0xF0);
|
||||
if (e.LeftButton != MouseButtonState.Pressed || sender is not FrameworkElement element || element.DataContext is not ReminderTask task)
|
||||
return;
|
||||
// Only start dragging after a real move – otherwise clicks/double-clicks get swallowed.
|
||||
if (e.OriginalSource is System.Windows.Controls.Primitives.ButtonBase || e.OriginalSource is CheckBox) return;
|
||||
var delta = e.GetPosition(this) - _dragStart;
|
||||
if (Math.Abs(delta.X) < SystemParameters.MinimumHorizontalDragDistance &&
|
||||
Math.Abs(delta.Y) < SystemParameters.MinimumVerticalDragDistance)
|
||||
return;
|
||||
DragDrop.DoDragDrop(element, task, DragDropEffects.Move);
|
||||
}
|
||||
|
||||
// kept for styles that still reference them
|
||||
private void SecondaryButton_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (sender is Border border)
|
||||
{
|
||||
var scaleTransform = border.RenderTransform as ScaleTransform;
|
||||
if (scaleTransform != null)
|
||||
{
|
||||
var scaleXAnim = new DoubleAnimation(1, 1.03, TimeSpan.FromMilliseconds(150));
|
||||
var scaleYAnim = new DoubleAnimation(1, 1.03, TimeSpan.FromMilliseconds(150));
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||
}
|
||||
border.Background = new SolidColorBrush(GetHoverColor());
|
||||
}
|
||||
if (sender is Border border) border.SetResourceReference(Border.BackgroundProperty, "HoverBrush");
|
||||
}
|
||||
|
||||
private void SecondaryButton_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (sender is Border border)
|
||||
{
|
||||
var scaleTransform = border.RenderTransform as ScaleTransform;
|
||||
if (scaleTransform != null)
|
||||
{
|
||||
var scaleXAnim = new DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||
var scaleYAnim = new DoubleAnimation(1, TimeSpan.FromMilliseconds(150));
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, scaleXAnim);
|
||||
scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, scaleYAnim);
|
||||
}
|
||||
border.Background = new SolidColorBrush(Colors.Transparent);
|
||||
}
|
||||
if (sender is Border border) border.Background = Brushes.Transparent;
|
||||
}
|
||||
|
||||
private void TreeView_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||
{
|
||||
e.Effects = DragDropEffects.Move;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effects = DragDropEffects.None;
|
||||
}
|
||||
e.Effects = e.Data.GetDataPresent(typeof(ReminderTask)) ? DragDropEffects.Move : DragDropEffects.None;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void TreeView_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||
{
|
||||
var task = e.Data.GetData(typeof(ReminderTask)) as ReminderTask;
|
||||
if (task != null && FolderTree.SelectedItem is Folder targetFolder)
|
||||
{
|
||||
_viewModel.MoveTaskToFolderCommand.Execute((task, targetFolder));
|
||||
}
|
||||
}
|
||||
// Drops on a folder are handled by TreeViewItem_Drop; empty space does nothing.
|
||||
}
|
||||
|
||||
private void TreeViewItem_DragOver(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||
{
|
||||
e.Effects = DragDropEffects.Move;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effects = DragDropEffects.None;
|
||||
}
|
||||
e.Effects = e.Data.GetDataPresent(typeof(ReminderTask)) ? DragDropEffects.Move : DragDropEffects.None;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void TreeViewItem_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (sender is TreeViewItem item && e.Data.GetDataPresent(typeof(ReminderTask))) item.Tag = "DropTarget";
|
||||
}
|
||||
|
||||
private void TreeViewItem_DragLeave(object sender, DragEventArgs e)
|
||||
{
|
||||
if (sender is TreeViewItem item) item.Tag = null;
|
||||
}
|
||||
|
||||
private void TreeViewItem_Drop(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(typeof(ReminderTask)))
|
||||
if (sender is TreeViewItem treeViewItem)
|
||||
{
|
||||
var task = e.Data.GetData(typeof(ReminderTask)) as ReminderTask;
|
||||
if (task != null && sender is TreeViewItem treeViewItem && treeViewItem.DataContext is Folder targetFolder)
|
||||
treeViewItem.Tag = null;
|
||||
if (e.Data.GetData(typeof(ReminderTask)) is ReminderTask task && treeViewItem.DataContext is Folder targetFolder)
|
||||
{
|
||||
_viewModel.MoveTaskToFolderCommand.Execute((task, targetFolder));
|
||||
}
|
||||
}
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,23 +57,63 @@ namespace ReminderOrganizer.Models
|
||||
set => SetProperty(ref _recurrenceType, value);
|
||||
}
|
||||
|
||||
public DateTime GetNextOccurrence()
|
||||
public DateTime GetNextOccurrence() => GetNextOccurrence(DateTime.Now);
|
||||
|
||||
/// <summary>
|
||||
/// First occurrence after <paramref name="now"/>. Steps are counted from the original
|
||||
/// date, so "31 Jan monthly" gives 29 Feb, 31 Mar, 30 Apr … instead of drifting to the 28th.
|
||||
/// </summary>
|
||||
public DateTime GetNextOccurrence(DateTime now)
|
||||
{
|
||||
var next = ReminderDate;
|
||||
while (next <= DateTime.Now)
|
||||
var start = ReminderDate;
|
||||
if (start > now) return start;
|
||||
|
||||
// Jump close to "now" first so long gaps (app off for years) don't loop thousands of times.
|
||||
int k = RecurrenceType switch
|
||||
{
|
||||
RecurrenceType.Daily => Math.Max(0, (int)((now - start).TotalDays) - 1),
|
||||
RecurrenceType.Weekly => Math.Max(0, (int)((now - start).TotalDays / 7) - 1),
|
||||
RecurrenceType.Monthly => Math.Max(0, (now.Year - start.Year) * 12 + now.Month - start.Month - 1),
|
||||
_ => Math.Max(0, now.Year - start.Year - 1)
|
||||
};
|
||||
|
||||
DateTime next;
|
||||
do
|
||||
{
|
||||
k++;
|
||||
next = RecurrenceType switch
|
||||
{
|
||||
RecurrenceType.Daily => next.AddDays(1),
|
||||
RecurrenceType.Weekly => next.AddDays(7),
|
||||
RecurrenceType.Monthly => next.AddMonths(1),
|
||||
RecurrenceType.Yearly => next.AddYears(1),
|
||||
_ => next.AddYears(1)
|
||||
RecurrenceType.Daily => start.AddDays(k),
|
||||
RecurrenceType.Weekly => start.AddDays(7 * k),
|
||||
RecurrenceType.Monthly => start.AddMonths(k),
|
||||
_ => start.AddYears(k)
|
||||
};
|
||||
}
|
||||
} while (next <= now);
|
||||
return next;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public static System.Collections.Generic.List<ReminderTask> ProcessDue(System.Collections.Generic.IEnumerable<Folder> folders, DateTime now)
|
||||
{
|
||||
var due = new System.Collections.Generic.List<ReminderTask>();
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
foreach (var task in folder.Tasks)
|
||||
{
|
||||
if (task.IsNotified || task.ReminderDate > now) continue;
|
||||
due.Add(task);
|
||||
if (task.IsRecurring)
|
||||
task.ReminderDate = task.GetNextOccurrence(now);
|
||||
else
|
||||
task.IsNotified = true;
|
||||
}
|
||||
}
|
||||
return due;
|
||||
}
|
||||
|
||||
public ReminderTask() { }
|
||||
|
||||
public ReminderTask(string name, string description, DateTime reminderDate)
|
||||
|
||||
37
README.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Reminder Organizer
|
||||
|
||||
Desktop app for Windows that organizes reminders in folders and shows them as Windows notifications.
|
||||
It runs in the system tray (notification area).
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
- Folders with tasks (date, time, description), sorted by date: open tasks first
|
||||
- One-off or recurring reminders (daily, weekly, monthly, yearly)
|
||||
- Reminders missed while the app was closed are shown at the next start
|
||||
- Drag a task onto a folder to move it
|
||||
- CSV import/export (`Folder;Name;Description;Date;IsRecurring;RecurrenceType`, date `yyyy-MM-dd HH:mm`)
|
||||
- Dark/light theme, German/English
|
||||
- Autostart with Windows, starting hidden in the tray (`--minimized`)
|
||||
|
||||
## Data
|
||||
|
||||
Tasks are stored in `%APPDATA%\ReminderOrganizer\tasks.json`. The app keeps `tasks.json.bak` as a backup
|
||||
of the previous save, and saves a broken file as `tasks.json.corrupt-<time>` instead of overwriting it.
|
||||
`error.log` is in the same folder.
|
||||
On first start, an older `tasks.json` next to the exe is copied over automatically.
|
||||
|
||||
## Build
|
||||
|
||||
```bat
|
||||
dotnet build :: Debug
|
||||
dotnet test Tests\ReminderOrganizer.Tests.csproj
|
||||
release.bat :: tests + single-file exe -> ReminderOrganizer.zip
|
||||
```
|
||||
|
||||
Requires the .NET 8 SDK. The release is self-contained, so the target PC needs no .NET installed.
|
||||
|
||||
## Credits
|
||||
|
||||
© 2026 Michael Media · Discord: https://discord.gg/Ej4JPmCZva
|
||||
@@ -8,19 +8,39 @@
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AssemblyName>ReminderOrganizer</AssemblyName>
|
||||
<RootNamespace>ReminderOrganizer</RootNamespace>
|
||||
|
||||
<!-- exe properties -->
|
||||
<Product>Reminder Organizer</Product>
|
||||
<AssemblyTitle>Reminder Organizer</AssemblyTitle>
|
||||
<Company>Michael Media</Company>
|
||||
<Authors>Michael Media</Authors>
|
||||
<Copyright>© 2026 Michael Media</Copyright>
|
||||
<Version>1.1.0</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="Exists('Assets\app.ico')">
|
||||
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<!-- tests live in their own project -->
|
||||
<Compile Remove="Tests\**" />
|
||||
<None Remove="Tests\**" />
|
||||
<Page Remove="Tests\**" />
|
||||
<Compile Remove="sprite-generator\**" />
|
||||
<None Remove="sprite-generator\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Locales\*.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="tasks.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Locales\*.json" LogicalName="Locales.%(Filename).json" />
|
||||
<Resource Include="Assets\app.ico" Condition="Exists('Assets\app.ico')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<InternalsVisibleTo Include="ReminderOrganizer.Tests" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -1,23 +1,55 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReminderOrganizer", "ReminderOrganizer.csproj", "{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0AB3BF05-4346-4AA6-1389-037BE0695223}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReminderOrganizer.Tests", "Tests\ReminderOrganizer.Tests.csproj", "{B66C094A-22BB-4AD4-8837-3CDD7F280644}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|x64.Build.0 = Release|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{8D37173C-9C50-37C0-47FA-3F8D0AD719C9}.Release|x86.Build.0 = Release|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Release|x64.Build.0 = Release|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{B66C094A-22BB-4AD4-8837-3CDD7F280644} = {0AB3BF05-4346-4AA6-1389-037BE0695223}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {195DE7BA-8C52-4E36-B943-B093B9614618}
|
||||
EndGlobalSection
|
||||
|
||||
@@ -17,7 +17,14 @@ namespace ReminderOrganizer
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
|
||||
services.AddSingleton<IDataService, DataService>();
|
||||
services.AddSingleton<IDataService>(_ =>
|
||||
{
|
||||
var ds = new DataService();
|
||||
// Older versions stored tasks.json next to the exe (or in the single-file extract dir).
|
||||
ds.MigrateFrom(System.IO.Path.GetDirectoryName(Environment.ProcessPath));
|
||||
ds.MigrateFrom(AppContext.BaseDirectory);
|
||||
return ds;
|
||||
});
|
||||
services.AddSingleton<INotificationService, NotificationService>();
|
||||
services.AddSingleton<IAutostartService, AutostartService>();
|
||||
services.AddSingleton<ILocalizationService>(sp =>
|
||||
|
||||
@@ -9,6 +9,26 @@ namespace ReminderOrganizer.Services
|
||||
private const string RegistryKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
|
||||
private const string AppName = "ReminderOrganizer";
|
||||
|
||||
/// <summary>Registry value: quoted exe path + --minimized (start in tray).</summary>
|
||||
public static string BuildCommand(string exePath) => $"\"{exePath}\" --minimized";
|
||||
|
||||
/// <summary>True if the stored command points at this exe (old entries without quotes count too).</summary>
|
||||
public static bool PointsTo(string? stored, string? exePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(stored) || string.IsNullOrEmpty(exePath)) return false;
|
||||
var s = stored.Trim();
|
||||
if (s.StartsWith("\""))
|
||||
{
|
||||
var end = s.IndexOf('"', 1);
|
||||
s = end > 0 ? s.Substring(1, end - 1) : s.Trim('"');
|
||||
}
|
||||
else if (s.EndsWith(" --minimized"))
|
||||
{
|
||||
s = s[..^" --minimized".Length];
|
||||
}
|
||||
return string.Equals(s, exePath, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool IsAutostartEnabled
|
||||
{
|
||||
get
|
||||
@@ -16,8 +36,7 @@ namespace ReminderOrganizer.Services
|
||||
try
|
||||
{
|
||||
using var key = Registry.CurrentUser.OpenSubKey(RegistryKey, false);
|
||||
var path = key?.GetValue(AppName) as string;
|
||||
return path == Environment.ProcessPath;
|
||||
return PointsTo(key?.GetValue(AppName) as string, Environment.ProcessPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -42,7 +61,7 @@ namespace ReminderOrganizer.Services
|
||||
var path = Environment.ProcessPath;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
key.SetValue(AppName, path);
|
||||
key.SetValue(AppName, BuildCommand(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,17 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using ReminderOrganizer.Models;
|
||||
|
||||
namespace ReminderOrganizer.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Stores tasks in %APPDATA%\ReminderOrganizer\tasks.json.
|
||||
/// Writes are serialized and atomic (temp file + replace), a corrupt file is
|
||||
/// backed up instead of being overwritten.
|
||||
/// </summary>
|
||||
public class DataService : IDataService
|
||||
{
|
||||
private static readonly JsonSerializerOptions _jsonOptions = new()
|
||||
@@ -15,11 +21,38 @@ namespace ReminderOrganizer.Services
|
||||
PropertyNameCaseInsensitive = true
|
||||
};
|
||||
|
||||
private readonly SemaphoreSlim _writeLock = new(1, 1);
|
||||
|
||||
public string DataFilePath { get; }
|
||||
|
||||
public DataService()
|
||||
/// <summary>%APPDATA%\ReminderOrganizer – or REMINDER_ORGANIZER_DATA (for tests/screenshots).</summary>
|
||||
public static string DefaultDataDirectory =>
|
||||
Environment.GetEnvironmentVariable("REMINDER_ORGANIZER_DATA") is { Length: > 0 } custom
|
||||
? custom
|
||||
: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "ReminderOrganizer");
|
||||
|
||||
public DataService() : this(DefaultDataDirectory) { }
|
||||
|
||||
public DataService(string dataDirectory)
|
||||
{
|
||||
DataFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "tasks.json");
|
||||
Directory.CreateDirectory(dataDirectory);
|
||||
DataFilePath = Path.Combine(dataDirectory, "tasks.json");
|
||||
}
|
||||
|
||||
/// <summary>Copies tasks.json from an old location (next to the exe) if no data exists yet.</summary>
|
||||
public void MigrateFrom(string? legacyDirectory)
|
||||
{
|
||||
if (string.IsNullOrEmpty(legacyDirectory) || File.Exists(DataFilePath)) return;
|
||||
var legacy = Path.Combine(legacyDirectory, "tasks.json");
|
||||
try
|
||||
{
|
||||
if (File.Exists(legacy) && !string.Equals(Path.GetFullPath(legacy), Path.GetFullPath(DataFilePath), StringComparison.OrdinalIgnoreCase))
|
||||
File.Copy(legacy, DataFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[DataService] Migration failed: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<AppData> LoadAsync()
|
||||
@@ -36,22 +69,43 @@ namespace ReminderOrganizer.Services
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[DataService] Load failed: {ex.Message}");
|
||||
BackupCorruptFile();
|
||||
return new AppData();
|
||||
}
|
||||
}
|
||||
|
||||
public async Task SaveAsync(AppData data)
|
||||
private void BackupCorruptFile()
|
||||
{
|
||||
try
|
||||
{
|
||||
var backup = DataFilePath + $".corrupt-{DateTime.Now:yyyyMMdd-HHmmss}";
|
||||
File.Copy(DataFilePath, backup, overwrite: true);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public async Task SaveAsync(AppData data)
|
||||
{
|
||||
await _writeLock.WaitAsync();
|
||||
try
|
||||
{
|
||||
var json = JsonSerializer.Serialize(data, _jsonOptions);
|
||||
await File.WriteAllTextAsync(DataFilePath, json);
|
||||
var tmp = DataFilePath + ".tmp";
|
||||
await File.WriteAllTextAsync(tmp, json);
|
||||
if (File.Exists(DataFilePath))
|
||||
File.Replace(tmp, DataFilePath, DataFilePath + ".bak");
|
||||
else
|
||||
File.Move(tmp, DataFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[DataService] Save failed: {ex.Message}");
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_writeLock.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using ReminderOrganizer.Models;
|
||||
using ReminderOrganizer.Services;
|
||||
|
||||
namespace ReminderOrganizer.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads UI strings from Locales/<lang>.json, embedded into the exe
|
||||
/// (resource name "Locales.<lang>.json"). Missing keys fall back to English, then to the key.
|
||||
/// </summary>
|
||||
public class LocalizationService : ILocalizationService
|
||||
{
|
||||
public static readonly string[] SupportedLanguages = { "en", "de" };
|
||||
|
||||
private Dictionary<string, string> _strings = new();
|
||||
private Dictionary<string, string> _fallback = new();
|
||||
private string _currentLanguage = "en";
|
||||
private AppData? _appData;
|
||||
private readonly IDataService _dataService;
|
||||
@@ -22,23 +29,31 @@ namespace ReminderOrganizer.Services
|
||||
public LocalizationService(IDataService dataService)
|
||||
{
|
||||
_dataService = dataService;
|
||||
LoadLanguage(_currentLanguage);
|
||||
_fallback = LoadStrings("en");
|
||||
_strings = _fallback;
|
||||
}
|
||||
|
||||
public void SetLanguage(string languageCode)
|
||||
{
|
||||
if (Array.IndexOf(SupportedLanguages, languageCode) < 0) languageCode = "en";
|
||||
if (_currentLanguage == languageCode) return;
|
||||
_currentLanguage = languageCode;
|
||||
LoadLanguage(languageCode);
|
||||
_strings = LoadStrings(languageCode);
|
||||
if (_appData != null)
|
||||
{
|
||||
_appData.Language = languageCode;
|
||||
_ = _dataService.SaveAsync(_appData);
|
||||
_ = SaveQuietly(_appData);
|
||||
}
|
||||
LanguageChanged?.Invoke(this, EventArgs.Empty);
|
||||
StringsChanged?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private async System.Threading.Tasks.Task SaveQuietly(AppData data)
|
||||
{
|
||||
try { await _dataService.SaveAsync(data); }
|
||||
catch (Exception ex) { System.Diagnostics.Debug.WriteLine($"[Localization] Save failed: {ex.Message}"); }
|
||||
}
|
||||
|
||||
public void Initialize(AppData appData)
|
||||
{
|
||||
_appData = appData;
|
||||
@@ -50,87 +65,27 @@ namespace ReminderOrganizer.Services
|
||||
|
||||
public string GetString(string key)
|
||||
{
|
||||
return _strings.TryGetValue(key, out var value) ? value : key;
|
||||
if (_strings.TryGetValue(key, out var value)) return value;
|
||||
return _fallback.TryGetValue(key, out var fb) ? fb : key;
|
||||
}
|
||||
|
||||
private void LoadLanguage(string languageCode)
|
||||
public static Dictionary<string, string> LoadStrings(string languageCode)
|
||||
{
|
||||
var basePath = AppDomain.CurrentDomain.BaseDirectory;
|
||||
var filePath = Path.Combine(basePath, "Locales", $"{languageCode}.json");
|
||||
|
||||
if (File.Exists(filePath))
|
||||
try
|
||||
{
|
||||
try
|
||||
var asm = Assembly.GetExecutingAssembly();
|
||||
using var stream = asm.GetManifestResourceStream($"Locales.{languageCode}.json");
|
||||
if (stream != null)
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
_strings = JsonSerializer.Deserialize<Dictionary<string, string>>(json) ?? new();
|
||||
return;
|
||||
using var reader = new StreamReader(stream);
|
||||
return JsonSerializer.Deserialize<Dictionary<string, string>>(reader.ReadToEnd()) ?? new();
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
_strings = GetDefaultStrings(languageCode);
|
||||
}
|
||||
|
||||
private static Dictionary<string, string> GetDefaultStrings(string lang)
|
||||
{
|
||||
return lang switch
|
||||
catch (Exception ex)
|
||||
{
|
||||
"en" => new Dictionary<string, string>
|
||||
{
|
||||
["AppTitle"] = "Reminder Organizer",
|
||||
["File"] = "File",
|
||||
["Exit"] = "Exit",
|
||||
["Settings"] = "Settings",
|
||||
["Language"] = "Language",
|
||||
["German"] = "German",
|
||||
["English"] = "English",
|
||||
["AddFolder"] = "+ Folder",
|
||||
["AddTask"] = "+ Task",
|
||||
["Welcome"] = "Welcome",
|
||||
["NoFolderSelected"] = "No folder selected",
|
||||
["Name"] = "Name",
|
||||
["Description"] = "Description",
|
||||
["Date"] = "Date",
|
||||
["Save"] = "Save",
|
||||
["Cancel"] = "Cancel",
|
||||
["OK"] = "OK",
|
||||
["SelectFolder"] = "Please select a folder first",
|
||||
["AutostartEnabled"] = "Autostart enabled",
|
||||
["AutostartDisabled"] = "Autostart disabled",
|
||||
["SaveError"] = "Error saving data",
|
||||
["Open"] = "Open",
|
||||
["Delete"] = "Delete",
|
||||
["Rename"] = "Rename"
|
||||
},
|
||||
_ => new Dictionary<string, string>
|
||||
{
|
||||
["AppTitle"] = "Reminder Organizer",
|
||||
["File"] = "Datei",
|
||||
["Exit"] = "Beenden",
|
||||
["Settings"] = "Einstellungen",
|
||||
["Language"] = "Sprache",
|
||||
["German"] = "Deutsch",
|
||||
["English"] = "Englisch",
|
||||
["AddFolder"] = "+ Ordner",
|
||||
["AddTask"] = "+ Task",
|
||||
["Welcome"] = "Willkommen",
|
||||
["NoFolderSelected"] = "Kein Ordner ausgewählt",
|
||||
["Name"] = "Name",
|
||||
["Description"] = "Beschreibung",
|
||||
["Date"] = "Datum",
|
||||
["Save"] = "Speichern",
|
||||
["Cancel"] = "Abbrechen",
|
||||
["OK"] = "OK",
|
||||
["SelectFolder"] = "Bitte erst einen Ordner auswählen",
|
||||
["AutostartEnabled"] = "Autostart aktiviert",
|
||||
["AutostartDisabled"] = "Autostart deaktiviert",
|
||||
["SaveError"] = "Fehler beim Speichern",
|
||||
["Open"] = "Öffnen",
|
||||
["Delete"] = "Löschen",
|
||||
["Rename"] = "Umbenennen"
|
||||
}
|
||||
};
|
||||
System.Diagnostics.Debug.WriteLine($"[Localization] Load {languageCode} failed: {ex.Message}");
|
||||
}
|
||||
return new();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,9 @@ namespace ReminderOrganizer.Services
|
||||
{
|
||||
if (SharedTrayIcon != null)
|
||||
{
|
||||
SharedTrayIcon.BalloonTipTitle = title;
|
||||
SharedTrayIcon.BalloonTipText = message;
|
||||
// ShowBalloonTip throws on empty text – tasks without description would never notify.
|
||||
SharedTrayIcon.BalloonTipTitle = string.IsNullOrWhiteSpace(title) ? "Reminder Organizer" : title;
|
||||
SharedTrayIcon.BalloonTipText = string.IsNullOrWhiteSpace(message) ? " " : message;
|
||||
SharedTrayIcon.BalloonTipIcon = ToolTipIcon.Info;
|
||||
SharedTrayIcon.ShowBalloonTip(5000);
|
||||
System.Diagnostics.Debug.WriteLine("[NotificationService] BalloonTip shown!");
|
||||
|
||||
80
Services/TaskCsv.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ReminderOrganizer.Core;
|
||||
using ReminderOrganizer.Models;
|
||||
|
||||
namespace ReminderOrganizer.Services
|
||||
{
|
||||
/// <summary>CSV format: Folder;Name;Description;Date(yyyy-MM-dd HH:mm);IsRecurring;RecurrenceType</summary>
|
||||
public static class TaskCsv
|
||||
{
|
||||
public const string Header = "Folder;Name;Description;Date;IsRecurring;RecurrenceType";
|
||||
public const string DateFormat = "yyyy-MM-dd HH:mm";
|
||||
|
||||
public static string Export(AppData data)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append(Header).Append("\r\n");
|
||||
foreach (var folder in data.Folders)
|
||||
{
|
||||
foreach (var task in folder.Tasks)
|
||||
{
|
||||
sb.Append(string.Join(Csv.Separator,
|
||||
Csv.Escape(folder.Name),
|
||||
Csv.Escape(task.Name),
|
||||
Csv.Escape(task.Description),
|
||||
task.ReminderDate.ToString(DateFormat, CultureInfo.InvariantCulture),
|
||||
task.IsRecurring.ToString(),
|
||||
task.RecurrenceType.ToString())).Append("\r\n");
|
||||
}
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Adds the rows to <paramref name="data"/> (new folders are created). Returns (imported, skipped).</summary>
|
||||
public static (int Imported, int Skipped) Import(string text, AppData data)
|
||||
{
|
||||
int imported = 0, skipped = 0;
|
||||
var folderMap = new Dictionary<string, Folder>();
|
||||
foreach (var f in data.Folders) folderMap.TryAdd(f.Name, f);
|
||||
|
||||
var rows = Csv.Parse(text.TrimStart(''));
|
||||
foreach (var parts in rows.Skip(1))
|
||||
{
|
||||
if (parts.All(string.IsNullOrWhiteSpace)) continue;
|
||||
if (parts.Count < 4) { skipped++; continue; }
|
||||
|
||||
var folderName = parts[0].Trim();
|
||||
var name = parts[1].Trim();
|
||||
var description = parts[2].Trim();
|
||||
if (string.IsNullOrWhiteSpace(folderName) || string.IsNullOrWhiteSpace(name) ||
|
||||
!DateTime.TryParseExact(parts[3].Trim(), DateFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out var date))
|
||||
{
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!folderMap.TryGetValue(folderName, out var target))
|
||||
{
|
||||
target = new Folder(folderName);
|
||||
data.Folders.Add(target);
|
||||
folderMap[folderName] = target;
|
||||
}
|
||||
|
||||
var task = new ReminderTask(name, description, date);
|
||||
if (parts.Count >= 5 && bool.TryParse(parts[4].Trim(), out var rec)) task.IsRecurring = rec;
|
||||
if (parts.Count >= 6 && Enum.TryParse<RecurrenceType>(parts[5].Trim(), out var type)) task.RecurrenceType = type;
|
||||
// Past one-off dates would fire immediately on import – treat them as already done.
|
||||
if (!task.IsRecurring && date <= DateTime.Now) task.IsNotified = true;
|
||||
|
||||
target.Tasks.Add(task);
|
||||
imported++;
|
||||
}
|
||||
return (imported, skipped);
|
||||
}
|
||||
}
|
||||
}
|
||||
171
TaskWindow.xaml
@@ -1,9 +1,8 @@
|
||||
<Window x:Class="ReminderOrganizer.TaskWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:models="clr-namespace:ReminderOrganizer.Models"
|
||||
Title="{Binding WindowTitle}"
|
||||
Height="420" Width="420"
|
||||
Title="{Binding WindowTitle}"
|
||||
Width="440" SizeToContent="Height"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
ResizeMode="NoResize"
|
||||
ShowInTaskbar="False"
|
||||
@@ -13,58 +12,121 @@
|
||||
MouseLeftButtonDown="Window_MouseLeftButtonDown">
|
||||
<Window.Resources>
|
||||
<SolidColorBrush x:Key="PrimaryBrush" Color="#6366F1"/>
|
||||
<SolidColorBrush x:Key="PrimaryHoverBrush" Color="#4F46E5"/>
|
||||
<SolidColorBrush x:Key="WarningBrush" Color="#F59E0B"/>
|
||||
<SolidColorBrush x:Key="TextPrimaryBrush" Color="#1E293B"/>
|
||||
<SolidColorBrush x:Key="TextSecondaryBrush" Color="#64748B"/>
|
||||
<SolidColorBrush x:Key="BorderBrush" Color="#CBD5E1"/>
|
||||
<SolidColorBrush x:Key="CardBrush" Color="#FFFFFF"/>
|
||||
<SolidColorBrush x:Key="InputBackgroundBrush" Color="#F1F5F9"/>
|
||||
<SolidColorBrush x:Key="HoverBrush" Color="#E2E8F0"/>
|
||||
|
||||
<Style x:Key="Label" TargetType="TextBlock">
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextSecondaryBrush}"/>
|
||||
<Setter Property="Margin" Value="0,0,0,4"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Input" TargetType="TextBox">
|
||||
<Setter Property="Background" Value="{DynamicResource InputBackgroundBrush}"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||
<Setter Property="CaretBrush" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,8"/>
|
||||
<Setter Property="FontSize" Value="13"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Chip" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
<Setter Property="Margin" Value="0,0,6,0"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="1" CornerRadius="12" Padding="10,4">
|
||||
<ContentPresenter HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bd" Property="Background" Value="{DynamicResource HoverBrush}"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="DialogButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}"/>
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="18,8"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border x:Name="bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter TargetName="bd" Property="Opacity" Value="0.4"/>
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bd" Property="Opacity" Value="0.85"/>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
|
||||
<Border CornerRadius="12" Background="{DynamicResource CardBrush}" Margin="8">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.2" Direction="270" Color="Black"/>
|
||||
<DropShadowEffect BlurRadius="20" ShadowDepth="5" Opacity="0.25" Direction="270" Color="Black"/>
|
||||
</Border.Effect>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,12">
|
||||
<Border Grid.Row="0" Background="{DynamicResource PrimaryBrush}" CornerRadius="12,12,0,0" Padding="16,10">
|
||||
<Grid>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="📋" FontSize="16" Foreground="White" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding WindowTitle}" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="8,0,0,0"/>
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="15" Foreground="White" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding WindowTitle}" FontSize="14" FontWeight="SemiBold" Foreground="White" VerticalAlignment="Center" Margin="10,0,0,0"/>
|
||||
</StackPanel>
|
||||
<Button Content="✕" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
|
||||
Width="28" Height="28" Cursor="Hand" Command="{Binding CancelCommand}"/>
|
||||
<Button Content="" FontFamily="Segoe MDL2 Assets" FontSize="10" HorizontalAlignment="Right" Foreground="White" Background="Transparent" BorderThickness="0"
|
||||
Width="28" Height="28" Cursor="Hand" Command="{Binding CancelCommand}" IsCancel="True"/>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- Content -->
|
||||
<StackPanel Grid.Row="1" Margin="16">
|
||||
<TextBlock Text="{Binding NameLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,4"/>
|
||||
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource InputBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="10,8" FontSize="13"/>
|
||||
<StackPanel Grid.Row="1" Margin="18,16,18,18">
|
||||
<TextBlock Text="{Binding NameLabel}" Style="{StaticResource Label}"/>
|
||||
<TextBox x:Name="NameBox" Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"/>
|
||||
<TextBlock Text="{Binding ErrorMessage}" Foreground="#EF4444" FontSize="11" Margin="0,4,0,0"
|
||||
Visibility="{Binding HasError, Converter={StaticResource BoolToVisibility}}"/>
|
||||
|
||||
<Grid Margin="0,12,0,0">
|
||||
<TextBlock Text="{Binding DateLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding DateLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,0,0,4"/>
|
||||
|
||||
<DatePicker Grid.Row="1" Grid.Column="0" SelectedDate="{Binding ReminderDate, Mode=TwoWay}" Height="32"/>
|
||||
|
||||
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Horizontal" Margin="8,0,0,0">
|
||||
<ComboBox Width="50" Height="32" SelectedIndex="{Binding SelectedHourIndex}">
|
||||
<DatePicker Grid.Column="0" SelectedDate="{Binding SelectedDay, Mode=TwoWay}" Height="32" VerticalContentAlignment="Center"/>
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal" Margin="8,0,0,0">
|
||||
<ComboBox Width="56" Height="32" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedHourIndex}">
|
||||
<ComboBoxItem Content="00"/><ComboBoxItem Content="01"/><ComboBoxItem Content="02"/>
|
||||
<ComboBoxItem Content="03"/><ComboBoxItem Content="04"/><ComboBoxItem Content="05"/>
|
||||
<ComboBoxItem Content="06"/><ComboBoxItem Content="07"/><ComboBoxItem Content="08"/>
|
||||
@@ -74,8 +136,8 @@
|
||||
<ComboBoxItem Content="18"/><ComboBoxItem Content="19"/><ComboBoxItem Content="20"/>
|
||||
<ComboBoxItem Content="21"/><ComboBoxItem Content="22"/><ComboBoxItem Content="23"/>
|
||||
</ComboBox>
|
||||
<TextBlock Text=":" VerticalAlignment="Center" Margin="2,0" FontSize="14"/>
|
||||
<ComboBox Width="50" Height="32" SelectedIndex="{Binding SelectedMinuteIndex}">
|
||||
<TextBlock Text=":" VerticalAlignment="Center" Margin="4,0" FontSize="14" Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<ComboBox Width="56" Height="32" VerticalContentAlignment="Center" SelectedIndex="{Binding SelectedMinuteIndex}">
|
||||
<ComboBoxItem Content="00"/><ComboBoxItem Content="05"/>
|
||||
<ComboBoxItem Content="10"/><ComboBoxItem Content="15"/>
|
||||
<ComboBoxItem Content="20"/><ComboBoxItem Content="25"/>
|
||||
@@ -86,31 +148,48 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Margin="0,12,0,0">
|
||||
<CheckBox IsChecked="{Binding IsRecurring, Mode=TwoWay}" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="🔄" FontSize="12" Margin="4,0,0,0" VerticalAlignment="Center"/>
|
||||
<TextBlock Text="{Binding RecurringLabel}" FontSize="12" Foreground="{DynamicResource TextPrimaryBrush}" VerticalAlignment="Center" Margin="4,0,0,0"/>
|
||||
<ComboBox Margin="8,0,0,0" Width="90" Height="28" SelectedIndex="{Binding SelectedRecurrenceIndex}" IsEnabled="{Binding IsRecurring}">
|
||||
<!-- Quick picks -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
|
||||
<TextBlock Text="{Binding QuickLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<Button Content="{Binding TomorrowText}" Command="{Binding SetTomorrowCommand}" Style="{StaticResource Chip}"/>
|
||||
<Button Content="{Binding NextWeekText}" Command="{Binding SetNextWeekCommand}" Style="{StaticResource Chip}"/>
|
||||
<Button Content="{Binding NextMonthText}" Command="{Binding SetNextMonthCommand}" Style="{StaticResource Chip}"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="{Binding PastDateWarning}" Foreground="{DynamicResource WarningBrush}" FontSize="11" Margin="0,6,0,0"
|
||||
Visibility="{Binding IsInPast, Converter={StaticResource BoolToVisibility}}"/>
|
||||
|
||||
<!-- Recurrence -->
|
||||
<StackPanel Orientation="Horizontal" Margin="0,14,0,0">
|
||||
<CheckBox IsChecked="{Binding IsRecurring, Mode=TwoWay}" VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="" FontFamily="Segoe MDL2 Assets" FontSize="12" VerticalAlignment="Center" Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
<TextBlock Text="{Binding RecurringLabel}" FontSize="12" Margin="6,0,0,0" VerticalAlignment="Center" Foreground="{DynamicResource TextPrimaryBrush}"/>
|
||||
</StackPanel>
|
||||
</CheckBox>
|
||||
<ComboBox Margin="10,0,0,0" Width="100" Height="28" VerticalContentAlignment="Center"
|
||||
SelectedIndex="{Binding SelectedRecurrenceIndex}" IsEnabled="{Binding IsRecurring}">
|
||||
<ComboBoxItem Content="{Binding DailyText}"/>
|
||||
<ComboBoxItem Content="{Binding WeeklyText}"/>
|
||||
<ComboBoxItem Content="{Binding MonthlyText}"/>
|
||||
<ComboBoxItem Content="{Binding YearlyText}"/>
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Margin="0,6,0,0"
|
||||
Visibility="{Binding IsRecurring, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding NextOccurrenceLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}"/>
|
||||
<TextBlock Text="{Binding NextOccurrenceText}" FontSize="11" FontWeight="SemiBold" Foreground="{DynamicResource TextPrimaryBrush}" Margin="4,0,0,0"/>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="{Binding DescriptionLabel}" FontSize="11" Foreground="{DynamicResource TextSecondaryBrush}" Margin="0,12,0,4"/>
|
||||
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource InputBackgroundBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="10,6" FontSize="12" Height="40"
|
||||
TextWrapping="Wrap" AcceptsReturn="True"/>
|
||||
<TextBlock Text="{Binding DescriptionLabel}" Style="{StaticResource Label}" Margin="0,14,0,4"/>
|
||||
<TextBox Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" Style="{StaticResource Input}"
|
||||
Height="72" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" FontSize="12"/>
|
||||
|
||||
<TextBlock Text="{Binding ErrorMessage}" Foreground="#EF4444" FontSize="11" Margin="0,8,0,0"
|
||||
Visibility="{Binding HasError, Converter={StaticResource BoolToVisibility}}"/>
|
||||
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,16,0,0">
|
||||
<Button Content="{Binding CancelText}" Background="Transparent" Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
BorderBrush="{DynamicResource BorderBrush}" BorderThickness="1" Padding="16,8" Cursor="Hand" Command="{Binding CancelCommand}"/>
|
||||
<Button Content="{Binding SaveText}" Background="#6366F1" Foreground="White"
|
||||
BorderThickness="0" Padding="16,8" Margin="8,0,0,0" Cursor="Hand" Command="{Binding SaveCommand}"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,18,0,0">
|
||||
<Button Content="{Binding CancelText}" Command="{Binding CancelCommand}" Style="{StaticResource DialogButton}"/>
|
||||
<Button Content="{Binding SaveText}" Command="{Binding SaveCommand}" Style="{StaticResource DialogButton}" IsDefault="True"
|
||||
Background="{DynamicResource PrimaryBrush}" Foreground="White" BorderThickness="0" Margin="8,0,0,0"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using ReminderOrganizer.Core;
|
||||
using ReminderOrganizer.Models;
|
||||
using ReminderOrganizer.Services;
|
||||
using ReminderOrganizer.ViewModels;
|
||||
@@ -13,27 +14,21 @@ namespace ReminderOrganizer
|
||||
|
||||
public ReminderTask TaskResult => _viewModel.TaskResult;
|
||||
|
||||
public TaskWindow() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public TaskWindow(ReminderTask? existingTask)
|
||||
public TaskWindow(ReminderTask? existingTask, bool darkMode)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
var localizationService = ServiceLocator.Services.GetService(typeof(ILocalizationService)) as ILocalizationService;
|
||||
|
||||
if (localizationService == null)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("[TaskWindow] LocalizationService is null!");
|
||||
localizationService = new LocalizationService(ServiceLocator.Services.GetService(typeof(IDataService)) as IDataService
|
||||
?? throw new InvalidOperationException("DataService not found"));
|
||||
}
|
||||
|
||||
Theme.Apply(Resources, darkMode);
|
||||
|
||||
var localizationService = (ILocalizationService)ServiceLocator.Services.GetService(typeof(ILocalizationService))!;
|
||||
_viewModel = new TaskViewModel(localizationService, existingTask);
|
||||
_viewModel.RequestClose += OnRequestClose;
|
||||
|
||||
DataContext = _viewModel;
|
||||
|
||||
Loaded += (_, _) =>
|
||||
{
|
||||
NameBox.Focus();
|
||||
NameBox.SelectAll();
|
||||
};
|
||||
}
|
||||
|
||||
private void OnRequestClose(object? sender, bool result)
|
||||
@@ -42,9 +37,9 @@ namespace ReminderOrganizer
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
if (e.LeftButton == System.Windows.Input.MouseButtonState.Pressed)
|
||||
if (e.LeftButton == MouseButtonState.Pressed && e.OriginalSource is not System.Windows.Controls.TextBox)
|
||||
{
|
||||
DragMove();
|
||||
}
|
||||
|
||||
236
Tests/CoreTests.cs
Normal file
@@ -0,0 +1,236 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ReminderOrganizer.Core;
|
||||
using ReminderOrganizer.Models;
|
||||
using ReminderOrganizer.Services;
|
||||
using Xunit;
|
||||
|
||||
namespace ReminderOrganizer.Tests
|
||||
{
|
||||
public class RecurrenceTests
|
||||
{
|
||||
[Fact]
|
||||
public void Monthly_from_31st_does_not_drift()
|
||||
{
|
||||
var t = new ReminderTask("x", "", new DateTime(2026, 1, 31, 9, 0, 0)) { IsRecurring = true, RecurrenceType = RecurrenceType.Monthly };
|
||||
Assert.Equal(new DateTime(2026, 2, 28, 9, 0, 0), t.GetNextOccurrence(new DateTime(2026, 2, 1)));
|
||||
Assert.Equal(new DateTime(2026, 3, 31, 9, 0, 0), t.GetNextOccurrence(new DateTime(2026, 3, 1)));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(RecurrenceType.Daily, 2026, 5, 11)]
|
||||
[InlineData(RecurrenceType.Weekly, 2026, 5, 15)]
|
||||
[InlineData(RecurrenceType.Monthly, 2026, 6, 1)]
|
||||
[InlineData(RecurrenceType.Yearly, 2027, 5, 1)]
|
||||
public void Next_occurrence_is_first_after_now(RecurrenceType type, int y, int m, int d)
|
||||
{
|
||||
var t = new ReminderTask("x", "", new DateTime(2026, 5, 1, 8, 0, 0)) { IsRecurring = true, RecurrenceType = type };
|
||||
Assert.Equal(new DateTime(y, m, d, 8, 0, 0), t.GetNextOccurrence(new DateTime(2026, 5, 10, 12, 0, 0)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Long_gap_is_fast_and_correct()
|
||||
{
|
||||
var t = new ReminderTask("x", "", new DateTime(2000, 1, 1, 0, 0, 0)) { IsRecurring = true, RecurrenceType = RecurrenceType.Daily };
|
||||
Assert.Equal(new DateTime(2026, 6, 2), t.GetNextOccurrence(new DateTime(2026, 6, 1, 0, 0, 1)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Future_date_is_returned_unchanged()
|
||||
{
|
||||
var d = new DateTime(2030, 1, 1);
|
||||
var t = new ReminderTask("x", "", d) { IsRecurring = true };
|
||||
Assert.Equal(d, t.GetNextOccurrence(new DateTime(2026, 1, 1)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ProcessDue_marks_once_and_advances_recurring()
|
||||
{
|
||||
var now = new DateTime(2026, 5, 10, 12, 0, 0);
|
||||
var once = new ReminderTask("once", "", now.AddMinutes(-1));
|
||||
var rec = new ReminderTask("rec", "", now.AddMinutes(-1)) { IsRecurring = true, RecurrenceType = RecurrenceType.Daily };
|
||||
var later = new ReminderTask("later", "", now.AddHours(1));
|
||||
var done = new ReminderTask("done", "", now.AddDays(-3)) { IsNotified = true };
|
||||
var f = new Folder("f");
|
||||
foreach (var t in new[] { once, rec, later, done }) f.Tasks.Add(t);
|
||||
|
||||
var due = ReminderTask.ProcessDue(new[] { f }, now);
|
||||
|
||||
Assert.Equal(new[] { "once", "rec" }, due.Select(t => t.Name));
|
||||
Assert.True(once.IsNotified);
|
||||
Assert.False(rec.IsNotified);
|
||||
Assert.True(rec.ReminderDate > now);
|
||||
Assert.Empty(ReminderTask.ProcessDue(new[] { f }, now));
|
||||
}
|
||||
}
|
||||
|
||||
public class CsvTests
|
||||
{
|
||||
[Fact]
|
||||
public void Quoted_fields_round_trip()
|
||||
{
|
||||
var data = new AppData();
|
||||
var f = new Folder("Ar;beit");
|
||||
f.Tasks.Add(new ReminderTask("Say \"hi\"", "line1\nline2; more", new DateTime(2030, 3, 4, 5, 6, 0)) { IsRecurring = true, RecurrenceType = RecurrenceType.Weekly });
|
||||
data.Folders.Add(f);
|
||||
|
||||
var target = new AppData();
|
||||
var (imported, skipped) = TaskCsv.Import(TaskCsv.Export(data), target);
|
||||
|
||||
Assert.Equal(1, imported);
|
||||
Assert.Equal(0, skipped);
|
||||
var t = target.Folders.Single().Tasks.Single();
|
||||
Assert.Equal("Ar;beit", target.Folders[0].Name);
|
||||
Assert.Equal("Say \"hi\"", t.Name);
|
||||
Assert.Equal("line1\nline2; more", t.Description);
|
||||
Assert.Equal(new DateTime(2030, 3, 4, 5, 6, 0), t.ReminderDate);
|
||||
Assert.True(t.IsRecurring);
|
||||
Assert.Equal(RecurrenceType.Weekly, t.RecurrenceType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Bad_rows_are_skipped_and_existing_folder_reused()
|
||||
{
|
||||
var target = new AppData();
|
||||
target.Folders.Add(new Folder("Home"));
|
||||
var csv = "\uFEFF" + TaskCsv.Header + "\r\nHome;A;;2030-01-01 10:00\r\nHome;B;;not a date\r\n;C;;2030-01-01 10:00\r\nshort\r\n\r\n";
|
||||
var (imported, skipped) = TaskCsv.Import(csv, target);
|
||||
Assert.Equal(1, imported);
|
||||
Assert.Equal(3, skipped);
|
||||
Assert.Single(target.Folders);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Past_one_off_import_is_marked_done()
|
||||
{
|
||||
var target = new AppData();
|
||||
TaskCsv.Import(TaskCsv.Header + "\nF;Old;;2001-01-01 10:00", target);
|
||||
Assert.True(target.Folders[0].Tasks[0].IsNotified);
|
||||
}
|
||||
}
|
||||
|
||||
public class DataServiceTests : IDisposable
|
||||
{
|
||||
private readonly string _dir = Path.Combine(Path.GetTempPath(), "ro-tests-" + Guid.NewGuid().ToString("N"));
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
try { Directory.Delete(_dir, true); } catch { }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Save_and_load_round_trip()
|
||||
{
|
||||
var ds = new DataService(_dir);
|
||||
var data = new AppData { Language = "de", IsDarkMode = false };
|
||||
data.Folders.Add(new Folder("F"));
|
||||
data.Folders[0].Tasks.Add(new ReminderTask("T", "D", new DateTime(2030, 1, 1)));
|
||||
await ds.SaveAsync(data);
|
||||
await ds.SaveAsync(data); // second save goes through File.Replace
|
||||
|
||||
var loaded = await new DataService(_dir).LoadAsync();
|
||||
Assert.Equal("de", loaded.Language);
|
||||
Assert.False(loaded.IsDarkMode);
|
||||
Assert.Equal("T", loaded.Folders[0].Tasks[0].Name);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Parallel_saves_do_not_throw()
|
||||
{
|
||||
var ds = new DataService(_dir);
|
||||
var data = new AppData();
|
||||
await Task.WhenAll(Enumerable.Range(0, 20).Select(_ => ds.SaveAsync(data)));
|
||||
Assert.True(File.Exists(ds.DataFilePath));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Corrupt_file_is_backed_up()
|
||||
{
|
||||
Directory.CreateDirectory(_dir);
|
||||
File.WriteAllText(Path.Combine(_dir, "tasks.json"), "{ not json");
|
||||
var loaded = await new DataService(_dir).LoadAsync();
|
||||
Assert.Empty(loaded.Folders);
|
||||
Assert.Single(Directory.GetFiles(_dir, "tasks.json.corrupt-*"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Migrates_legacy_file_once()
|
||||
{
|
||||
var legacy = Path.Combine(_dir, "legacy");
|
||||
Directory.CreateDirectory(legacy);
|
||||
File.WriteAllText(Path.Combine(legacy, "tasks.json"), "{\"Folders\":[]}");
|
||||
var ds = new DataService(Path.Combine(_dir, "new"));
|
||||
ds.MigrateFrom(legacy);
|
||||
Assert.True(File.Exists(ds.DataFilePath));
|
||||
|
||||
File.WriteAllText(Path.Combine(legacy, "tasks.json"), "changed");
|
||||
ds.MigrateFrom(legacy); // must not overwrite existing data
|
||||
Assert.Equal("{\"Folders\":[]}", File.ReadAllText(ds.DataFilePath));
|
||||
}
|
||||
}
|
||||
|
||||
public class AutostartTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData("\"C:\\App\\R.exe\" --minimized", true)]
|
||||
[InlineData("C:\\App\\R.exe", true)]
|
||||
[InlineData("C:\\App\\R.exe --minimized", true)]
|
||||
[InlineData("\"C:\\Other\\R.exe\"", false)]
|
||||
[InlineData(null, false)]
|
||||
public void PointsTo_recognises_old_and_new_entries(string? stored, bool expected)
|
||||
{
|
||||
Assert.Equal(expected, AutostartService.PointsTo(stored, "C:\\App\\R.exe"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildCommand_quotes_path()
|
||||
{
|
||||
Assert.Equal("\"C:\\A B\\R.exe\" --minimized", AutostartService.BuildCommand("C:\\A B\\R.exe"));
|
||||
}
|
||||
}
|
||||
|
||||
public class LocaleTests
|
||||
{
|
||||
[Fact]
|
||||
public void Embedded_locales_have_same_keys()
|
||||
{
|
||||
var en = LocalizationService.LoadStrings("en");
|
||||
var de = LocalizationService.LoadStrings("de");
|
||||
Assert.NotEmpty(en);
|
||||
Assert.Empty(en.Keys.Except(de.Keys));
|
||||
Assert.Empty(de.Keys.Except(en.Keys));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void All_keys_used_in_code_exist()
|
||||
{
|
||||
var root = FindRepoRoot();
|
||||
var en = LocalizationService.LoadStrings("en");
|
||||
var used = Directory.GetFiles(root, "*.cs", SearchOption.AllDirectories)
|
||||
.Where(p => !p.Contains($"{Path.DirectorySeparatorChar}Tests{Path.DirectorySeparatorChar}") && !p.Contains($"{Path.DirectorySeparatorChar}obj{Path.DirectorySeparatorChar}"))
|
||||
.SelectMany(p => System.Text.RegularExpressions.Regex.Matches(File.ReadAllText(p), "(?:\\bL|GetString)\\(\"(\\w+)\"\\)").Select(m => m.Groups[1].Value))
|
||||
.Distinct();
|
||||
Assert.Empty(used.Where(k => !en.ContainsKey(k)));
|
||||
}
|
||||
|
||||
private static string FindRepoRoot()
|
||||
{
|
||||
var dir = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (dir != null && !File.Exists(Path.Combine(dir.FullName, "ReminderOrganizer.csproj"))) dir = dir.Parent;
|
||||
return dir?.FullName ?? throw new InvalidOperationException("repo root not found");
|
||||
}
|
||||
}
|
||||
|
||||
public class CsvParserTests
|
||||
{
|
||||
[Fact]
|
||||
public void Escaped_quote_and_separator()
|
||||
{
|
||||
var rows = Csv.Parse("a;\"b;\"\"c\"\"\";d\r\ne");
|
||||
Assert.Equal(new[] { "a", "b;\"c\"", "d" }, rows[0]);
|
||||
Assert.Equal(new[] { "e" }, rows[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Tests/ReminderOrganizer.Tests.csproj
Normal file
@@ -0,0 +1,20 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
|
||||
<PackageReference Include="xunit" Version="2.9.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ReminderOrganizer.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Locales\*.json" Link="Locales\%(Filename).json" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,10 +1,13 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using ReminderOrganizer.Core;
|
||||
@@ -15,6 +18,8 @@ namespace ReminderOrganizer.ViewModels
|
||||
{
|
||||
public class MainViewModel : ViewModelBase
|
||||
{
|
||||
public const string DiscordUrl = "https://discord.gg/Ej4JPmCZva";
|
||||
|
||||
private readonly IDataService _dataService;
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly ILocalizationService _localizationService;
|
||||
@@ -25,6 +30,7 @@ namespace ReminderOrganizer.ViewModels
|
||||
private Folder? _selectedFolder;
|
||||
private ReminderTask? _selectedTask;
|
||||
private bool _isLoading;
|
||||
private ICollectionView? _selectedFolderTasksView;
|
||||
|
||||
public bool IsLoading
|
||||
{
|
||||
@@ -39,14 +45,38 @@ namespace ReminderOrganizer.ViewModels
|
||||
get => _selectedFolder;
|
||||
set
|
||||
{
|
||||
var old = _selectedFolder;
|
||||
if (SetProperty(ref _selectedFolder, value))
|
||||
{
|
||||
if (old != null) old.Tasks.CollectionChanged -= OnSelectedTasksChanged;
|
||||
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)
|
||||
{
|
||||
OnPropertyChanged(nameof(TaskCountText));
|
||||
}
|
||||
|
||||
private static ICollectionView? CreateSortedView(Folder? folder)
|
||||
{
|
||||
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;
|
||||
@@ -55,8 +85,15 @@ namespace ReminderOrganizer.ViewModels
|
||||
|
||||
public ObservableCollection<ReminderTask>? SelectedFolderTasks => SelectedFolder?.Tasks;
|
||||
|
||||
/// <summary>Tasks of the selected folder: open first, then by date.</summary>
|
||||
public ICollectionView? SelectedFolderTasksView => _selectedFolderTasksView;
|
||||
|
||||
public bool HasSelectedFolder => SelectedFolder != null;
|
||||
|
||||
public string SelectedFolderName => SelectedFolder?.Name ?? L("Welcome");
|
||||
|
||||
public string TaskCountText => $"{SelectedFolder?.Tasks.Count ?? 0} {L("Tasks")}";
|
||||
|
||||
public string AddFolderText => L("AddFolder");
|
||||
public string AddTaskText => L("AddTask");
|
||||
public string AutostartText => L("Autostart");
|
||||
@@ -82,6 +119,7 @@ namespace ReminderOrganizer.ViewModels
|
||||
public string DateColumnText => L("Date");
|
||||
public string EditTaskTooltip => L("EditTaskTooltip");
|
||||
public string DeleteTaskTooltip => L("DeleteTaskTooltip");
|
||||
public string DoneTooltip => L("DoneTooltip");
|
||||
public string InfoText => L("Info");
|
||||
public string DiscordText => L("Discord");
|
||||
public string ImportText => L("Import");
|
||||
@@ -91,9 +129,12 @@ namespace ReminderOrganizer.ViewModels
|
||||
public string TestNotificationText => L("TestNotification");
|
||||
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 IsGerman => _localizationService.CurrentLanguage == "de";
|
||||
public bool IsEnglish => _localizationService.CurrentLanguage == "en";
|
||||
public bool IsAutostartEnabled => _autostartService.IsAutostartEnabled;
|
||||
|
||||
private bool _isDarkMode = true;
|
||||
public bool IsDarkMode
|
||||
@@ -104,25 +145,25 @@ namespace ReminderOrganizer.ViewModels
|
||||
if (SetProperty(ref _isDarkMode, value))
|
||||
{
|
||||
ThemeChanged?.Invoke(this, value);
|
||||
if (_appData != null)
|
||||
{
|
||||
_appData.IsDarkMode = value;
|
||||
_ = SaveAsync();
|
||||
}
|
||||
_appData.IsDarkMode = value;
|
||||
_ = SaveAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<bool>? ThemeChanged;
|
||||
public event EventHandler<ReminderTask?>? EditTaskRequested;
|
||||
|
||||
public ICommand AddFolderCommand { get; }
|
||||
public ICommand AddTaskCommand { get; }
|
||||
public ICommand AddTaskToFolderCommand { get; }
|
||||
public ICommand DeleteTaskCommand { get; }
|
||||
public ICommand EditTaskCommand { get; }
|
||||
public ICommand ToggleDoneCommand { get; }
|
||||
public ICommand ToggleAutostartCommand { get; }
|
||||
public ICommand ExitCommand { get; }
|
||||
public ICommand DeleteFolderCommand { get; }
|
||||
public ICommand RenameFolderCommand { get; }
|
||||
public ICommand SaveFolderCommand { get; }
|
||||
public ICommand SetLanguageDeCommand { get; }
|
||||
public ICommand SetLanguageEnCommand { get; }
|
||||
@@ -131,8 +172,7 @@ namespace ReminderOrganizer.ViewModels
|
||||
public ICommand TestNotificationCommand { get; }
|
||||
public ICommand ImportCsvCommand { get; }
|
||||
public ICommand ExportCsvCommand { get; }
|
||||
|
||||
public event EventHandler<ReminderTask?>? EditTaskRequested;
|
||||
public ICommand OpenDiscordCommand { get; }
|
||||
|
||||
public MainViewModel(
|
||||
IDataService dataService,
|
||||
@@ -145,141 +185,114 @@ namespace ReminderOrganizer.ViewModels
|
||||
_localizationService = localizationService;
|
||||
_autostartService = autostartService;
|
||||
|
||||
_localizationService.StringsChanged += (s, e) => RefreshStrings();
|
||||
// Empty name = refresh every binding (all texts depend on the language).
|
||||
_localizationService.StringsChanged += (s, e) => OnPropertyChanged(string.Empty);
|
||||
|
||||
AddFolderCommand = new RelayCommand(AddFolder);
|
||||
AddTaskCommand = new RelayCommand(AddTask, () => SelectedFolder != null);
|
||||
AddTaskToFolderCommand = new RelayCommand<Folder>(AddTaskToFolder);
|
||||
DeleteTaskCommand = new RelayCommand<ReminderTask>(DeleteTask);
|
||||
EditTaskCommand = new RelayCommand<ReminderTask>(EditTask);
|
||||
ToggleDoneCommand = new RelayCommand<ReminderTask>(t => { _ = SaveAsync(); });
|
||||
DeleteFolderCommand = new RelayCommand(DeleteFolder, () => SelectedFolder != null);
|
||||
RenameFolderCommand = new RelayCommand(RenameFolder, () => SelectedFolder != null);
|
||||
SaveFolderCommand = new RelayCommand(async () => await SaveAsync());
|
||||
ToggleAutostartCommand = new RelayCommand(ToggleAutostart);
|
||||
SetLanguageDeCommand = new RelayCommand(() => SetLanguage("de"));
|
||||
SetLanguageEnCommand = new RelayCommand(() => SetLanguage("en"));
|
||||
SetLanguageDeCommand = new RelayCommand(() => _localizationService.SetLanguage("de"));
|
||||
SetLanguageEnCommand = new RelayCommand(() => _localizationService.SetLanguage("en"));
|
||||
ToggleDarkModeCommand = new RelayCommand(() => IsDarkMode = !IsDarkMode);
|
||||
ExitCommand = new RelayCommand(() => Application.Current.Shutdown());
|
||||
MoveTaskToFolderCommand = new RelayCommand<(ReminderTask, Folder)>(MoveTaskToFolder);
|
||||
TestNotificationCommand = new RelayCommand(TestNotification);
|
||||
ImportCsvCommand = new RelayCommand(ImportCsv);
|
||||
ExportCsvCommand = new RelayCommand(ExportCsv);
|
||||
OpenDiscordCommand = new RelayCommand(OpenDiscord);
|
||||
|
||||
_reminderTimer = new DispatcherTimer
|
||||
{
|
||||
Interval = TimeSpan.FromSeconds(30)
|
||||
};
|
||||
_reminderTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(30) };
|
||||
_reminderTimer.Tick += (s, e) => CheckReminders();
|
||||
}
|
||||
|
||||
private void SetLanguage(string lang)
|
||||
{
|
||||
_localizationService.SetLanguage(lang);
|
||||
}
|
||||
|
||||
private void RefreshStrings()
|
||||
{
|
||||
OnPropertyChanged(nameof(AddFolderText));
|
||||
OnPropertyChanged(nameof(AddTaskText));
|
||||
OnPropertyChanged(nameof(AutostartText));
|
||||
OnPropertyChanged(nameof(ExitText));
|
||||
OnPropertyChanged(nameof(FileText));
|
||||
OnPropertyChanged(nameof(SettingsText));
|
||||
OnPropertyChanged(nameof(LanguageText));
|
||||
OnPropertyChanged(nameof(GermanText));
|
||||
OnPropertyChanged(nameof(EnglishText));
|
||||
OnPropertyChanged(nameof(DeleteText));
|
||||
OnPropertyChanged(nameof(RenameText));
|
||||
OnPropertyChanged(nameof(ViewText));
|
||||
OnPropertyChanged(nameof(DarkModeText));
|
||||
OnPropertyChanged(nameof(LightModeText));
|
||||
OnPropertyChanged(nameof(AddTaskToFolderText));
|
||||
OnPropertyChanged(nameof(SelectedFolderName));
|
||||
OnPropertyChanged(nameof(IsGerman));
|
||||
OnPropertyChanged(nameof(IsEnglish));
|
||||
OnPropertyChanged(nameof(MinimizeTooltip));
|
||||
OnPropertyChanged(nameof(MaximizeTooltip));
|
||||
OnPropertyChanged(nameof(CloseTooltip));
|
||||
OnPropertyChanged(nameof(CreateTaskHint));
|
||||
OnPropertyChanged(nameof(NoTasks));
|
||||
OnPropertyChanged(nameof(FoldersText));
|
||||
OnPropertyChanged(nameof(NameColumnText));
|
||||
OnPropertyChanged(nameof(DateColumnText));
|
||||
OnPropertyChanged(nameof(EditTaskTooltip));
|
||||
OnPropertyChanged(nameof(DeleteTaskTooltip));
|
||||
OnPropertyChanged(nameof(InfoText));
|
||||
OnPropertyChanged(nameof(DiscordText));
|
||||
OnPropertyChanged(nameof(ImportText));
|
||||
OnPropertyChanged(nameof(ExportText));
|
||||
OnPropertyChanged(nameof(ImportCsvText));
|
||||
OnPropertyChanged(nameof(ExportCsvText));
|
||||
OnPropertyChanged(nameof(TestNotificationText));
|
||||
OnPropertyChanged(nameof(AppTitleText));
|
||||
OnPropertyChanged(nameof(RecurringTaskTooltipText));
|
||||
}
|
||||
|
||||
public async Task InitializeAsync()
|
||||
{
|
||||
IsLoading = true;
|
||||
_appData = await _dataService.LoadAsync();
|
||||
_localizationService.Initialize(_appData);
|
||||
|
||||
|
||||
if (_appData.Folders.Count == 0)
|
||||
{
|
||||
_appData.Folders.Add(new Folder(L("MyTasks")));
|
||||
await SaveAsync();
|
||||
}
|
||||
|
||||
|
||||
_isDarkMode = _appData.IsDarkMode;
|
||||
OnPropertyChanged(nameof(IsDarkMode));
|
||||
OnPropertyChanged(nameof(Folders));
|
||||
SelectedFolder = _appData.Folders.FirstOrDefault();
|
||||
|
||||
CheckReminders(); // catch up on reminders missed while the app was closed
|
||||
_reminderTimer.Start();
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
public string L(string key) => _localizationService.GetString(key);
|
||||
|
||||
private bool Confirm(string message) =>
|
||||
MessageBox.Show(Application.Current.MainWindow, message, L("AppTitle"),
|
||||
MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes;
|
||||
|
||||
private string? AskName(string title, string current)
|
||||
{
|
||||
var dialog = new InputDialog(title, L("NewName"), current, IsDarkMode) { Owner = Application.Current.MainWindow };
|
||||
if (dialog.ShowDialog() != true) return null;
|
||||
var name = dialog.ResponseText?.Trim();
|
||||
return string.IsNullOrEmpty(name) ? null : name;
|
||||
}
|
||||
|
||||
private void AddFolder()
|
||||
{
|
||||
var folder = new Folder(L("AddFolder").Replace("+ ", ""));
|
||||
var name = AskName(L("NewFolder"), L("NewFolder"));
|
||||
if (name == null) return;
|
||||
var folder = new Folder(name);
|
||||
_appData.Folders.Add(folder);
|
||||
SelectedFolder = folder;
|
||||
_ = SaveAsync();
|
||||
}
|
||||
|
||||
private void RenameFolder()
|
||||
{
|
||||
if (SelectedFolder == null) return;
|
||||
var name = AskName(L("RenameFolder"), SelectedFolder.Name);
|
||||
if (name == null) return;
|
||||
SelectedFolder.Name = name;
|
||||
OnPropertyChanged(nameof(SelectedFolderName));
|
||||
_ = SaveAsync();
|
||||
}
|
||||
|
||||
private void DeleteFolder()
|
||||
{
|
||||
if (SelectedFolder == null) return;
|
||||
|
||||
if (SelectedFolder.Tasks.Count > 0 &&
|
||||
!Confirm(string.Format(L("ConfirmDeleteFolder"), SelectedFolder.Name, SelectedFolder.Tasks.Count)))
|
||||
return;
|
||||
|
||||
_appData.Folders.Remove(SelectedFolder);
|
||||
SelectedFolder = _appData.Folders.FirstOrDefault();
|
||||
_ = SaveAsync();
|
||||
}
|
||||
|
||||
private void AddTask()
|
||||
{
|
||||
AddTaskInternal(SelectedFolder);
|
||||
}
|
||||
private void AddTask() => AddTaskInternal(SelectedFolder);
|
||||
|
||||
private void AddTaskToFolder(Folder? folder)
|
||||
{
|
||||
AddTaskInternal(folder);
|
||||
}
|
||||
private void AddTaskToFolder(Folder? folder) => AddTaskInternal(folder);
|
||||
|
||||
private void AddTaskInternal(Folder? folder)
|
||||
{
|
||||
if (folder == null)
|
||||
{
|
||||
MessageBox.Show("Kein Ordner ausgewählt! Bitte wähle erst einen Ordner aus.", "Info", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
MessageBox.Show(L("NoFolderSelectFirst"), L("AppTitle"), MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
var mainWindow = Application.Current.MainWindow;
|
||||
var taskWindow = new TaskWindow();
|
||||
|
||||
if (mainWindow != null)
|
||||
{
|
||||
taskWindow.Owner = mainWindow;
|
||||
}
|
||||
|
||||
var taskWindow = new TaskWindow(null, IsDarkMode) { Owner = Application.Current.MainWindow };
|
||||
if (taskWindow.ShowDialog() == true)
|
||||
{
|
||||
folder.Tasks.Add(taskWindow.TaskResult);
|
||||
@@ -289,8 +302,11 @@ namespace ReminderOrganizer.ViewModels
|
||||
|
||||
private void DeleteTask(ReminderTask? task)
|
||||
{
|
||||
if (task == null || SelectedFolder == null) return;
|
||||
SelectedFolder.Tasks.Remove(task);
|
||||
if (task == null) return;
|
||||
var folder = _appData.Folders.FirstOrDefault(f => f.Tasks.Contains(task));
|
||||
if (folder == null) return;
|
||||
if (!Confirm(string.Format(L("ConfirmDeleteTask"), task.Name))) return;
|
||||
folder.Tasks.Remove(task);
|
||||
_ = SaveAsync();
|
||||
}
|
||||
|
||||
@@ -305,11 +321,6 @@ namespace ReminderOrganizer.ViewModels
|
||||
sourceFolder.Tasks.Remove(task);
|
||||
targetFolder.Tasks.Add(task);
|
||||
_ = SaveAsync();
|
||||
|
||||
if (SelectedFolder == sourceFolder)
|
||||
{
|
||||
OnPropertyChanged(nameof(SelectedFolderTasks));
|
||||
}
|
||||
}
|
||||
|
||||
private void EditTask(ReminderTask? task)
|
||||
@@ -322,143 +333,65 @@ namespace ReminderOrganizer.ViewModels
|
||||
private void ToggleAutostart()
|
||||
{
|
||||
_autostartService.ToggleAutostart();
|
||||
var message = _autostartService.IsAutostartEnabled
|
||||
? L("AutostartEnabled")
|
||||
: L("AutostartDisabled");
|
||||
MessageBox.Show(message);
|
||||
OnPropertyChanged(nameof(IsAutostartEnabled));
|
||||
_notificationService.ShowNotification(L("AppTitle"),
|
||||
_autostartService.IsAutostartEnabled ? L("AutostartEnabled") : L("AutostartDisabled"));
|
||||
}
|
||||
|
||||
private void CheckReminders()
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[CheckReminders] Timer fired at {DateTime.Now}");
|
||||
bool hasChanges = false;
|
||||
foreach (var folder in _appData.Folders)
|
||||
var due = ReminderTask.ProcessDue(_appData.Folders, DateTime.Now);
|
||||
foreach (var task in due)
|
||||
{
|
||||
foreach (var task in folder.Tasks)
|
||||
{
|
||||
if (!task.IsNotified && task.ReminderDate <= DateTime.Now)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[CheckReminders] Task fällig: {task.Name}");
|
||||
_notificationService.ShowNotification($"🔔 {task.Name}", task.Description);
|
||||
|
||||
if (task.IsRecurring)
|
||||
{
|
||||
task.ReminderDate = task.GetNextOccurrence();
|
||||
System.Diagnostics.Debug.WriteLine($"[CheckReminders] Next occurrence: {task.ReminderDate}");
|
||||
}
|
||||
else
|
||||
{
|
||||
task.IsNotified = true;
|
||||
}
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
var body = string.IsNullOrWhiteSpace(task.Description) ? L("Reminder") : task.Description;
|
||||
_notificationService.ShowNotification($"🔔 {task.Name}", body);
|
||||
}
|
||||
if (hasChanges) _ = SaveAsync();
|
||||
if (due.Count > 0) _ = SaveAsync();
|
||||
}
|
||||
|
||||
private void TestNotification()
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("[TestNotification] Button clicked!");
|
||||
_notificationService.ShowNotification(L("TestNotificationTitle"), L("TestNotificationMessage"));
|
||||
}
|
||||
|
||||
private void OpenDiscord()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo
|
||||
{
|
||||
FileName = DiscordUrl,
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine($"[OpenDiscord] {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private void ImportCsv()
|
||||
{
|
||||
var dialog = new Microsoft.Win32.OpenFileDialog
|
||||
{
|
||||
Filter = "CSV Files (*.csv)|*.csv|All Files (*.*)|*.*",
|
||||
Title = "Import CSV"
|
||||
Filter = "CSV (*.csv)|*.csv|All Files (*.*)|*.*",
|
||||
Title = L("ImportCsv")
|
||||
};
|
||||
if (dialog.ShowDialog() != true) return;
|
||||
|
||||
if (dialog.ShowDialog() == true)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
var lines = System.IO.File.ReadAllLines(dialog.FileName);
|
||||
int imported = 0;
|
||||
int skipped = 0;
|
||||
var folderMap = new Dictionary<string, Folder>();
|
||||
|
||||
foreach (var folder in _appData.Folders)
|
||||
{
|
||||
folderMap[folder.Name] = folder;
|
||||
}
|
||||
|
||||
var dateFormat = "yyyy-MM-dd HH:mm";
|
||||
|
||||
for (int i = 1; i < lines.Length; i++)
|
||||
{
|
||||
var line = lines[i];
|
||||
if (string.IsNullOrWhiteSpace(line)) continue;
|
||||
|
||||
var parts = line.Split(';');
|
||||
|
||||
if (parts.Length < 4)
|
||||
{
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
var folderName = parts[0].Trim();
|
||||
var name = parts[1].Trim();
|
||||
var description = parts.Length > 2 ? parts[2].Trim() : "";
|
||||
|
||||
var dateStr = parts.Length > 3 ? parts[3].Trim() : "";
|
||||
if (!DateTime.TryParseExact(dateStr, dateFormat,
|
||||
System.Globalization.CultureInfo.InvariantCulture,
|
||||
System.Globalization.DateTimeStyles.None, out var date))
|
||||
{
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(folderName))
|
||||
{
|
||||
skipped++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!folderMap.TryGetValue(folderName, out var targetFolder))
|
||||
{
|
||||
targetFolder = new Folder(folderName);
|
||||
_appData.Folders.Add(targetFolder);
|
||||
folderMap[folderName] = targetFolder;
|
||||
}
|
||||
|
||||
var task = new ReminderTask(name, description, date);
|
||||
|
||||
if (parts.Length >= 6)
|
||||
{
|
||||
var recurringStr = parts[4].Trim();
|
||||
if (bool.TryParse(recurringStr, out var isRecurring))
|
||||
{
|
||||
task.IsRecurring = isRecurring;
|
||||
}
|
||||
var recTypeStr = parts[5].Trim();
|
||||
if (Enum.TryParse<RecurrenceType>(recTypeStr, out var recType))
|
||||
{
|
||||
task.RecurrenceType = recType;
|
||||
}
|
||||
}
|
||||
|
||||
targetFolder.Tasks.Add(task);
|
||||
imported++;
|
||||
}
|
||||
|
||||
_ = SaveAsync();
|
||||
OnPropertyChanged(nameof(Folders));
|
||||
OnPropertyChanged(nameof(SelectedFolderTasks));
|
||||
|
||||
var msg = skipped > 0
|
||||
? $"{L("ImportSuccess").Replace("{0}", imported.ToString())} ({skipped} skipped)"
|
||||
: L("ImportSuccess").Replace("{0}", imported.ToString());
|
||||
MessageBox.Show(msg);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(L("ImportError").Replace("{0}", ex.Message));
|
||||
}
|
||||
var (imported, skipped) = TaskCsv.Import(System.IO.File.ReadAllText(dialog.FileName), _appData);
|
||||
_ = SaveAsync();
|
||||
OnPropertyChanged(nameof(TaskCountText));
|
||||
|
||||
var msg = string.Format(L("ImportSuccess"), imported);
|
||||
if (skipped > 0) msg += " " + string.Format(L("ImportSkipped"), skipped);
|
||||
MessageBox.Show(msg, L("AppTitle"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(string.Format(L("ImportError"), ex.Message), L("AppTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,50 +399,22 @@ namespace ReminderOrganizer.ViewModels
|
||||
{
|
||||
var dialog = new Microsoft.Win32.SaveFileDialog
|
||||
{
|
||||
Filter = "CSV Files (*.csv)|*.csv",
|
||||
Title = "Export CSV",
|
||||
Filter = "CSV (*.csv)|*.csv",
|
||||
Title = L("ExportCsv"),
|
||||
FileName = "tasks.csv"
|
||||
};
|
||||
if (dialog.ShowDialog() != true) return;
|
||||
|
||||
if (dialog.ShowDialog() == true)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
using var writer = new System.IO.StreamWriter(dialog.FileName);
|
||||
writer.WriteLine("Folder;Name;Description;Date;IsRecurring;RecurrenceType");
|
||||
|
||||
foreach (var folder in _appData.Folders)
|
||||
{
|
||||
foreach (var task in folder.Tasks)
|
||||
{
|
||||
var line = string.Join(";",
|
||||
CsvEscape(folder.Name),
|
||||
CsvEscape(task.Name),
|
||||
CsvEscape(task.Description),
|
||||
task.ReminderDate.ToString("yyyy-MM-dd HH:mm"),
|
||||
task.IsRecurring.ToString(),
|
||||
task.RecurrenceType.ToString());
|
||||
writer.WriteLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
MessageBox.Show(L("ExportSuccess"));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(L("ExportError").Replace("{0}", ex.Message));
|
||||
}
|
||||
// UTF-8 with BOM so Excel shows umlauts correctly.
|
||||
System.IO.File.WriteAllText(dialog.FileName, TaskCsv.Export(_appData), new UTF8Encoding(true));
|
||||
MessageBox.Show(L("ExportSuccess"), L("AppTitle"));
|
||||
}
|
||||
}
|
||||
|
||||
private string CsvEscape(string value)
|
||||
{
|
||||
if (string.IsNullOrEmpty(value)) return "";
|
||||
if (value.Contains(";") || value.Contains("\"") || value.Contains("\n"))
|
||||
catch (Exception ex)
|
||||
{
|
||||
return "\"" + value.Replace("\"", "\"\"") + "\"";
|
||||
MessageBox.Show(string.Format(L("ExportError"), ex.Message), L("AppTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public async Task SaveAsync()
|
||||
@@ -520,7 +425,7 @@ namespace ReminderOrganizer.ViewModels
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show($"{L("SaveError")}: {ex.Message}");
|
||||
MessageBox.Show($"{L("SaveError")}: {ex.Message}", L("AppTitle"), MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 10 KiB |
BIN
docs/screenshots/main-window-dark.png
Normal file
|
After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 95 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
BIN
docs/screenshots/task-dialog.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
34
release.bat
@@ -6,12 +6,24 @@ echo ReminderOrganizer - Release Builder
|
||||
echo ============================================
|
||||
echo.
|
||||
|
||||
echo [1/4] Loesche alte Dateien...
|
||||
echo [1/4] Tests...
|
||||
dotnet test Tests\ReminderOrganizer.Tests.csproj -nologo -v q
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
echo *** Tests fehlgeschlagen - kein Release! ***
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [2/4] Loesche alte Dateien...
|
||||
if exist "publish" rmdir /s /q "publish"
|
||||
if exist "ReminderOrganizer.zip" del "ReminderOrganizer.zip"
|
||||
|
||||
echo [2/4] Baue Single-File EXE...
|
||||
dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -o publish
|
||||
echo [3/4] Baue Single-File EXE...
|
||||
rem Locales are embedded; data lives in %%APPDATA%%\ReminderOrganizer (not next to the exe).
|
||||
dotnet publish ReminderOrganizer.csproj -c Release -r win-x64 --self-contained true ^
|
||||
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true ^
|
||||
-p:EnableCompressionInSingleFile=true -p:DebugType=none -o publish
|
||||
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
@@ -20,11 +32,8 @@ if errorlevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo [3/4] Kopiere Locales Ordner...
|
||||
xcopy /E /I /Y "Locales" "publish\Locales" >nul
|
||||
|
||||
echo [4/4] Erstelle ZIP Datei...
|
||||
powershell -Command "Compress-Archive -Path 'publish\ReminderOrganizer.exe', 'publish\Locales\*' -DestinationPath 'ReminderOrganizer.zip' -Force"
|
||||
powershell -NoProfile -Command "Compress-Archive -Path 'publish\ReminderOrganizer.exe' -DestinationPath 'ReminderOrganizer.zip' -Force"
|
||||
|
||||
if errorlevel 1 (
|
||||
echo.
|
||||
@@ -35,13 +44,8 @@ if errorlevel 1 (
|
||||
|
||||
echo.
|
||||
echo ============================================
|
||||
echo FERTIG!
|
||||
echo ReminderOrganizer.zip wurde erstellt.
|
||||
echo ============================================
|
||||
echo Inhalt:
|
||||
echo - ReminderOrganizer.exe
|
||||
echo - Locales\de.json (Deutsch)
|
||||
echo - Locales\en.json (English)
|
||||
echo FERTIG! ReminderOrganizer.zip
|
||||
echo Inhalt: ReminderOrganizer.exe (Deutsch/Englisch eingebaut)
|
||||
echo ============================================
|
||||
echo.
|
||||
pause
|
||||
if "%1"=="" pause
|
||||
|
||||
11
sprite-generator/audio.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""Musik und Effekte für generate_audio.py (Stable Audio). Mindestlänge 1 s.
|
||||
|
||||
CLIPS = [(name, prompt, sekunden, negative)]
|
||||
"""
|
||||
NEG_MUSIC = "vocals, singing, speech, harsh noise, distortion, abrupt ending, low quality"
|
||||
NEG_SFX = "music, melody, vocals, speech, reverb tail, background ambience, low quality"
|
||||
|
||||
CLIPS = [
|
||||
("sfx_click", "short soft UI button click", 1, NEG_SFX),
|
||||
("music_menu", "calm looping menu music, light synth pads", 30, NEG_MUSIC),
|
||||
]
|
||||
39
sprite-generator/config.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""Projekt-Konfiguration für die ComfyGen-Werkzeuge. Diesen Ordner (template/) in das neue
|
||||
Projekt kopieren, z. B. als <Projekt>\\sprite-generator\\, und die Pfade unten anpassen."""
|
||||
import os
|
||||
|
||||
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
# ComfyUI-Server (lokal).
|
||||
HOST = "http://127.0.0.1:8188"
|
||||
|
||||
# Workflow aus ComfyGen\workflows\ – Flux.2 Klein ist der empfohlene Standard.
|
||||
WORKFLOW_FILE = "Text to Image - Flux Klein.json"
|
||||
UNET_NAME = "flux-2-klein-4b-fp8.safetensors"
|
||||
CLIP_NAME = "qwen_3_4b.safetensors"
|
||||
CLIP_TYPE = "flux2"
|
||||
VAE_NAME = "flux2-vae.safetensors"
|
||||
CHECKPOINT = "" # nur für workflows/default.json (SDXL o. ä.)
|
||||
|
||||
# Roh-Ergebnisse (nicht in git).
|
||||
OUTPUT_DIR = os.path.join(HERE, "output")
|
||||
|
||||
# Wird genutzt, wenn ein Prompt keinen eigenen Negativ-Prompt hat.
|
||||
NEGATIVE_PROMPT = "text, watermark, signature, blurry, low quality, extra limbs"
|
||||
|
||||
# Ziel für adopt*.py (schreibt nach ASSETS_DIR\Sprites, \Audio, \Video).
|
||||
PROJECT_ROOT = os.path.join(HERE, "..")
|
||||
ASSETS_DIR = os.path.join(PROJECT_ROOT, "Assets") # adopt -> Assets\Sprites\icon.png, dann -> Assets\app.ico
|
||||
|
||||
# Listen-Module in diesem Ordner.
|
||||
PROMPTS_MODULE = "prompts"
|
||||
AUDIO_MODULE = "audio"
|
||||
# Optional, nur wenn gebraucht:
|
||||
# AUDIO_SUBDIR = "audio"
|
||||
# VIDEO_MODULE = "video"
|
||||
# PORTRAITS_MODULE = "portraits"
|
||||
# VINTAGE_MODULE = "vintage"
|
||||
# VOICE_MODULE = "voice"
|
||||
# LANG_DIR = os.path.join(PROJECT_ROOT, "Languages")
|
||||
# CARDS_FILE = os.path.join(PROJECT_ROOT, "cards.json")
|
||||
|
||||
31
sprite-generator/gen.cmd
Normal file
@@ -0,0 +1,31 @@
|
||||
@echo off
|
||||
rem Starts a tool from D:\Oculusquest\Projekt\_Tools\ComfyGen for this project.
|
||||
rem gen list the tools
|
||||
rem gen generate <name> image from prompts.py
|
||||
rem gen adopt <name> cut out + copy into ASSETS_DIR\Sprites
|
||||
rem gen generate_audio <name> music / sfx from the audio list
|
||||
set TOOLS=D:\Oculusquest\Projekt\_Tools\ComfyGen
|
||||
rem shift below also moves %0, so remember this folder first
|
||||
set HERE=%~dp0
|
||||
set SCRIPT=%~1
|
||||
if "%SCRIPT%"=="" (
|
||||
echo Tools:& dir /b "%TOOLS%\*.py" | findstr /v /b "_"
|
||||
exit /b 0
|
||||
)
|
||||
shift
|
||||
set PY=py -3.12
|
||||
if /i "%SCRIPT%"=="generate_voice" set PY="%TOOLS%\.venv-tts\Scripts\python.exe"
|
||||
if /i "%SCRIPT%"=="make_voice_refs" set PY="%TOOLS%\.venv-tts\Scripts\python.exe"
|
||||
set PYTHONIOENCODING=utf-8
|
||||
pushd "%HERE%"
|
||||
set ARGS=
|
||||
:collect
|
||||
if "%~1"=="" goto run
|
||||
set ARGS=%ARGS% %1
|
||||
shift
|
||||
goto collect
|
||||
:run
|
||||
%PY% "%TOOLS%\%SCRIPT%.py"%ARGS%
|
||||
set RC=%ERRORLEVEL%
|
||||
popd
|
||||
exit /b %RC%
|
||||
18
sprite-generator/prompts.py
Normal file
@@ -0,0 +1,18 @@
|
||||
"""Was generate.py erzeugt.
|
||||
|
||||
PROMPTS = [(name, positive)] oder [(name, positive, negative)]
|
||||
SIZES = {name: (breite, höhe)} optional, sonst Größe des Workflows (1024x1024)
|
||||
|
||||
Immer "plain solid black background" verlangen, nie "transparent": cutout.py/adopt.py
|
||||
stellen den schwarzen Hintergrund deterministisch frei.
|
||||
"""
|
||||
_STYLE = (
|
||||
"game sprite, clean outline, bold colours, soft shading, "
|
||||
"centred single subject, plain solid black background"
|
||||
)
|
||||
|
||||
PROMPTS = [
|
||||
("example_coin", f"a shiny gold coin, {_STYLE}"),
|
||||
]
|
||||
|
||||
SIZES = {}
|
||||
@@ -1 +0,0 @@
|
||||
{"Folders":[{"Name":"Neuer Ordner","Tasks":[]},{"Name":"Neuer Ordner","Tasks":[]},{"Name":"Neuer Ordner","Tasks":[{"Name":"Tesr","Description":"test","Note":"","ReminderDate":"2026-03-19T09:36:00","IsNotified":true}]},{"Name":"Neuer Ordner","Tasks":[]}],"Language":"en"}
|
||||