From 182b3678111e0509cf83e7965bd547127f8c8fa6 Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Sun, 21 Jan 2024 01:20:50 +0100 Subject: [PATCH] ChartWindow: Fix saving bug --- Elwig/Windows/ChartWindow.xaml.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Elwig/Windows/ChartWindow.xaml.cs b/Elwig/Windows/ChartWindow.xaml.cs index eecc21c..cf51a55 100644 --- a/Elwig/Windows/ChartWindow.xaml.cs +++ b/Elwig/Windows/ChartWindow.xaml.cs @@ -24,7 +24,7 @@ namespace Elwig.Windows { public readonly int Year; public readonly int AvNr; - public readonly Season Season; + public Season Season; private PaymentVar PaymentVar; private ScatterPlot DataPlot; @@ -64,8 +64,8 @@ namespace Elwig.Windows { } private async Task RefreshGraphList() { - await Context.PaymentVariants.LoadAsync(); PaymentVar = await Context.PaymentVariants.FindAsync(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found"); + Season = await Context.Seasons.FindAsync(Year) ?? throw new ArgumentException("Season not found"); var attrVariants = (await Context.DeliveryParts .Where(d => d.Year == Year) @@ -79,8 +79,11 @@ namespace Elwig.Windows { GraphEntries = [ ..data.GetPaymentGraphEntries(Context, Season), ..data.GetQualityGraphEntries(Context, Season)]; var contracts = ContractSelection.GetContractsForYear(Context, Year); + FillingInputs = true; ControlUtils.RenewItemsSource(ContractInput, contracts, g => (g as ContractSelection)?.Listing); - ControlUtils.RenewItemsSource(GraphList, GraphEntries, g => (g as GraphEntry)?.Id, null, ControlUtils.RenewSourceDefault.First); + FillingInputs = false; + ControlUtils.RenewItemsSource(GraphList, GraphEntries, g => (g as GraphEntry)?.Id, GraphList_SelectionChanged, ControlUtils.RenewSourceDefault.First); + SelectedGraphEntry = GraphList.SelectedItem as GraphEntry; RefreshInputs(); }