From 624c9a6b346a485519da4b64a3c20b2da87860a9 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Thu, 29 Feb 2024 11:19:51 +0100 Subject: [PATCH] [#15] MailWindow: Small quality fixes --- Elwig/App.xaml.cs | 2 +- Elwig/Windows/MailWindow.xaml.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Elwig/App.xaml.cs b/Elwig/App.xaml.cs index a0c51e4..9bf76a2 100644 --- a/Elwig/App.xaml.cs +++ b/Elwig/App.xaml.cs @@ -252,7 +252,7 @@ namespace Elwig { } public static MailWindow FocusMailWindow(int? year = null) { - return FocusWindow(() => new(year)); + return FocusWindow(() => new(year), w => year == null || w.Year == year); } } } diff --git a/Elwig/Windows/MailWindow.xaml.cs b/Elwig/Windows/MailWindow.xaml.cs index d5d4706..ca1f1fe 100644 --- a/Elwig/Windows/MailWindow.xaml.cs +++ b/Elwig/Windows/MailWindow.xaml.cs @@ -52,7 +52,7 @@ namespace Elwig.Windows { CreditNote.Name, ]; - protected readonly int? Year; + public readonly int? Year; public ObservableCollection SelectedDocs = []; public IEnumerable Recipients = []; @@ -102,7 +102,7 @@ namespace Elwig.Windows { public MailWindow(int? year = null) { InitializeComponent(); Year = year ?? Context.Seasons.OrderBy(s => s.Year).LastOrDefault()?.Year; - Title = $"Rundschreiben {Year} - Elwig"; + Title = $"Rundschreiben - Lese {Year} - Elwig"; AvaiableDocumentsList.ItemsSource = AvaiableDocuments; SelectedDocumentsList.ItemsSource = SelectedDocs; @@ -559,7 +559,7 @@ namespace Elwig.Windows { public void AddDeliveryConfirmation() { AvaiableDocumentsList.SelectedIndex = 1; - if (AvaiableDocumentsList.SelectedItem is not string s) + if (AvaiableDocumentsList.SelectedItem is not string s || SelectedDocs.Any(d => d.Type == DocType.DeliveryConfirmation)) return; SelectedDocs.Add(new(DocType.DeliveryConfirmation, s, ((int)Year!, DocumentNonDeliverersInput.IsChecked == true))); SelectedDocumentsList.SelectedIndex = SelectedDocs.Count - 1;