diff --git a/CategoryWindow.xaml b/CategoryWindow.xaml
index ca16a02..49543d3 100644
--- a/CategoryWindow.xaml
+++ b/CategoryWindow.xaml
@@ -2,55 +2,66 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="{Binding [Categories]}"
- Width="780" SizeToContent="Height" MaxHeight="720"
- WindowStartupLocation="CenterOwner"
- ResizeMode="NoResize"
- ShowInTaskbar="False"
- WindowStyle="None"
- AllowsTransparency="True"
- Background="Transparent"
- MouseLeftButtonDown="Window_MouseLeftButtonDown">
+ Width="760" SizeToContent="Height" MaxHeight="760"
+ WindowStartupLocation="CenterOwner" ResizeMode="NoResize" ShowInTaskbar="False"
+ WindowStyle="None" AllowsTransparency="True" Background="Transparent"
+ FontFamily="{StaticResource UiFont}" FontSize="13" Foreground="{DynamicResource TextPrimaryBrush}"
+ UseLayoutRounding="True"
+ MouseLeftButtonDown="Window_MouseLeftButtonDown" KeyDown="Window_KeyDown">
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
+
-
+
@@ -71,95 +82,136 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
+
-
-
-
-
-
+
+
+
-
-
+
+
-
-
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
-
-
+
-
-
-
+
-
-
-
+
+
+
-
-
+
+
diff --git a/CategoryWindow.xaml.cs b/CategoryWindow.xaml.cs
index d536f43..92b066e 100644
--- a/CategoryWindow.xaml.cs
+++ b/CategoryWindow.xaml.cs
@@ -112,6 +112,33 @@ namespace ReminderOrganizer
private void Cancel_Click(object sender, RoutedEventArgs e) => DialogResult = false;
+ private void Window_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Escape) DialogResult = false;
+ }
+
+ /// The picker buttons live in a popup; walk up (visual, then logical) to the category row.
+ private static Category? CategoryOf(object sender)
+ {
+ DependencyObject? d = sender as DependencyObject;
+ while (d != null)
+ {
+ if (d is FrameworkElement { DataContext: Category c }) return c;
+ d = System.Windows.Media.VisualTreeHelper.GetParent(d) ?? LogicalTreeHelper.GetParent(d);
+ }
+ return null;
+ }
+
+ private void PickGlyph_Click(object sender, RoutedEventArgs e)
+ {
+ if (sender is FrameworkElement { Tag: string glyph } && CategoryOf(sender) is { } c) c.Glyph = glyph;
+ }
+
+ private void PickColor_Click(object sender, RoutedEventArgs e)
+ {
+ if (sender is FrameworkElement { Tag: string color } && CategoryOf(sender) is { } c) c.Color = color;
+ }
+
private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed && e.OriginalSource is not TextBox) DragMove();
diff --git a/Core/SystemPrefs.cs b/Core/SystemPrefs.cs
index 98c5f48..239deaa 100644
--- a/Core/SystemPrefs.cs
+++ b/Core/SystemPrefs.cs
@@ -1,14 +1,12 @@
-#nullable enable
+#nullable enable
using System.Globalization;
using Microsoft.Win32;
namespace ReminderOrganizer.Core
{
- /// Defaults taken from Windows until the user picks something in the app.
+ /// Windows settings the app follows until the user picks something (theme).
public static class SystemPrefs
{
- public static string Language(CultureInfo? culture = null) =>
- (culture ?? CultureInfo.CurrentUICulture).TwoLetterISOLanguageName == "de" ? "de" : "en";
public static bool IsDarkMode()
{
diff --git a/Locales/de.json b/Locales/de.json
index 24d39b3..98bca43 100644
--- a/Locales/de.json
+++ b/Locales/de.json
@@ -138,11 +138,9 @@
"AnniversaryDate": "Datum",
"Category": "Kategorie",
"Categories": "Kategorien",
- "CategoriesHint": "Jahrestage wiederholen sich jährlich und haben keine Uhrzeit. Im Text steht {0} für die Anzahl der Jahre und {o} für die Ordnungszahl (10.). Hochzeitstage zeigen zusätzlich den Namen (Silberhochzeit …).",
"CatIcon": "Symbol",
- "CatText": "Text mit Jahr",
- "CatExample": "Beispiel",
- "AddCategory": "+ Kategorie",
+ "CatText": "Text mit Jahren",
+ "CatExample": "Vorschau",
"NewCategory": "Neue Kategorie",
"ConfirmDeleteCategory": "Kategorie „{0}“ löschen? Ihre {1} Einträge werden zu Geburtstagen.",
"EditCategories": "Kategorien…",
@@ -193,5 +191,10 @@
"ShortcutDelete": "Markierten Eintrag löschen",
"ShortcutEsc": "Suche / Auswahl aufheben",
"MovedToNext": "„{0}“ verschoben auf {1}",
- "TestNow": "Test senden"
+ "TestNow": "Test senden",
+ "CategoriesIntro": "Jahrestage wiederholen sich jährlich und haben keine Uhrzeit. Hochzeitstage zeigen zusätzlich den Namen (Silberhochzeit, Goldene Hochzeit …).",
+ "CatPlaceholderYears": "Anzahl der Jahre",
+ "CatPlaceholderOrdinal": "Ordnungszahl (25.)",
+ "CatChangeLook": "Symbol und Farbe ändern",
+ "AddCategoryShort": "Kategorie"
}
diff --git a/Locales/en.json b/Locales/en.json
index 08f7a45..3fd0881 100644
--- a/Locales/en.json
+++ b/Locales/en.json
@@ -138,11 +138,9 @@
"AnniversaryDate": "Date",
"Category": "Category",
"Categories": "Categories",
- "CategoriesHint": "Anniversaries repeat every year without a time. In the text, {0} is the number of years and {o} the ordinal (10th). Wedding anniversaries also show the traditional name.",
"CatIcon": "Icon",
- "CatText": "Text with year",
- "CatExample": "Example",
- "AddCategory": "+ Category",
+ "CatText": "Text with years",
+ "CatExample": "Preview",
"NewCategory": "New category",
"ConfirmDeleteCategory": "Delete category \"{0}\"? Its {1} entries become birthdays.",
"EditCategories": "Categories…",
@@ -193,5 +191,10 @@
"ShortcutDelete": "Delete selected entry",
"ShortcutEsc": "Clear search / selection",
"MovedToNext": "\"{0}\" moved to {1}",
- "TestNow": "Send test"
+ "TestNow": "Send test",
+ "CategoriesIntro": "Anniversaries repeat every year and have no time. Wedding anniversaries also show the traditional name (Silver, Gold …).",
+ "CatPlaceholderYears": "number of years",
+ "CatPlaceholderOrdinal": "ordinal (25th)",
+ "CatChangeLook": "Change icon and color",
+ "AddCategoryShort": "Category"
}
diff --git a/Services/LocalizationService.cs b/Services/LocalizationService.cs
index 63eb11f..106e9da 100644
--- a/Services/LocalizationService.cs
+++ b/Services/LocalizationService.cs
@@ -1,4 +1,4 @@
-#nullable enable
+#nullable enable
using System;
using System.Collections.Generic;
using System.IO;
@@ -57,7 +57,8 @@ namespace ReminderOrganizer.Services
public void Initialize(AppData appData)
{
_appData = appData;
- var lang = string.IsNullOrEmpty(appData.Language) ? Core.SystemPrefs.Language() : appData.Language;
+ // Default language is English; the user switches in Settings.
+ var lang = string.IsNullOrEmpty(appData.Language) ? "en" : appData.Language;
if (lang == _currentLanguage)
{
appData.Language = lang;
diff --git a/Tests/FeatureTests.cs b/Tests/FeatureTests.cs
index d2c05cc..127a825 100644
--- a/Tests/FeatureTests.cs
+++ b/Tests/FeatureTests.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using ReminderOrganizer.Core;
using ReminderOrganizer.Models;
@@ -162,12 +162,6 @@ namespace ReminderOrganizer.Tests
public class SettingsTests
{
- [Fact]
- public void Language_follows_windows_culture()
- {
- Assert.Equal("de", SystemPrefs.Language(new System.Globalization.CultureInfo("de-AT")));
- Assert.Equal("en", SystemPrefs.Language(new System.Globalization.CultureInfo("fr-FR")));
- }
[Fact]
public void Old_files_without_new_fields_still_load()
diff --git a/ViewModels/MainViewModel.cs b/ViewModels/MainViewModel.cs
index fc54940..5c66291 100644
--- a/ViewModels/MainViewModel.cs
+++ b/ViewModels/MainViewModel.cs
@@ -319,7 +319,7 @@ namespace ReminderOrganizer.ViewModels
{
var dialog = new CategoryWindow(_appData.Categories, IsDarkMode,
id => _allTasks.Count(t => t.IsAnniversary && (t.CategoryId ?? Category.BirthdayId) == id))
- { Owner = Application.Current.MainWindow };
+ { Owner = ActiveOwner };
if (dialog.ShowDialog() != true) return;
var result = dialog.Result;
@@ -511,7 +511,7 @@ namespace ReminderOrganizer.ViewModels
ShowUpcomingCommand = new RelayCommand(() => ShowCategory(null));
ShowCategoryCommand = new RelayCommand(ShowCategory);
OpenSettingsCommand = new RelayCommand(() =>
- new SettingsWindow(this) { Owner = Application.Current.MainWindow }.ShowDialog());
+ new SettingsWindow(this) { Owner = ActiveOwner }.ShowDialog());
OpenDataFolderCommand = new RelayCommand(() =>
{
try { System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo { FileName = DataFolder, UseShellExecute = true }); }
@@ -654,9 +654,13 @@ namespace ReminderOrganizer.ViewModels
// ---------- dialogs ----------
+ /// Dialogs belong to the window the user is looking at (e.g. Settings), not always the main window.
+ private static Window? ActiveOwner =>
+ Application.Current.Windows.OfType().FirstOrDefault(w => w.IsActive) ?? Application.Current.MainWindow;
+
private string? AskName(string title, string current)
{
- var dialog = new InputDialog(title, L("NewName"), current, IsDarkMode) { Owner = Application.Current.MainWindow };
+ var dialog = new InputDialog(title, L("NewName"), current, IsDarkMode) { Owner = ActiveOwner };
if (dialog.ShowDialog() != true) return null;
var name = dialog.ResponseText?.Trim();
return string.IsNullOrEmpty(name) ? null : name;
@@ -748,7 +752,7 @@ namespace ReminderOrganizer.ViewModels
category = anniversaries.GroupBy(t => t.CategoryId ?? Category.BirthdayId).OrderByDescending(g => g.Count()).First().Key;
if (category == null && CategoryFilter is { } cf && cf != TaskQuery.AppointmentsFilter)
category = cf;
- var taskWindow = new TaskWindow(null, IsDarkMode, Categories, category) { Owner = Application.Current.MainWindow };
+ var taskWindow = new TaskWindow(null, IsDarkMode, Categories, category) { Owner = ActiveOwner };
if (taskWindow.ShowDialog() == true)
{
folder.Tasks.Add(taskWindow.TaskResult);