ChartWindow: Fix saving bug

This commit is contained in:
2024-01-21 01:20:50 +01:00
parent a2bb09cfbd
commit 182b367811

View File

@ -24,7 +24,7 @@ namespace Elwig.Windows {
public readonly int Year; public readonly int Year;
public readonly int AvNr; public readonly int AvNr;
public readonly Season Season; public Season Season;
private PaymentVar PaymentVar; private PaymentVar PaymentVar;
private ScatterPlot DataPlot; private ScatterPlot DataPlot;
@ -64,8 +64,8 @@ namespace Elwig.Windows {
} }
private async Task RefreshGraphList() { private async Task RefreshGraphList() {
await Context.PaymentVariants.LoadAsync();
PaymentVar = await Context.PaymentVariants.FindAsync(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found"); 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 var attrVariants = (await Context.DeliveryParts
.Where(d => d.Year == Year) .Where(d => d.Year == Year)
@ -79,8 +79,11 @@ namespace Elwig.Windows {
GraphEntries = [ ..data.GetPaymentGraphEntries(Context, Season), ..data.GetQualityGraphEntries(Context, Season)]; GraphEntries = [ ..data.GetPaymentGraphEntries(Context, Season), ..data.GetQualityGraphEntries(Context, Season)];
var contracts = ContractSelection.GetContractsForYear(Context, Year); var contracts = ContractSelection.GetContractsForYear(Context, Year);
FillingInputs = true;
ControlUtils.RenewItemsSource(ContractInput, contracts, g => (g as ContractSelection)?.Listing); 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(); RefreshInputs();
} }