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<MailWindow>(() => new(year)); + return FocusWindow<MailWindow>(() => 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<SelectedDoc> SelectedDocs = []; public IEnumerable<Member> 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;