[#43] App: Use FileSystemWatcher to renew contexts on demand

This commit is contained in:
2024-03-19 13:17:06 +01:00
parent 98688168b8
commit 1806b02039
13 changed files with 51 additions and 66 deletions

View File

@ -100,8 +100,7 @@ namespace Elwig.Windows {
SaveButton.IsEnabled = hasChanged;
}
private async Task RefreshGraphList() {
using var ctx = new AppDbContext();
private async Task RefreshGraphList(AppDbContext ctx) {
PaymentVar = await ctx.PaymentVariants.FindAsync(Year, AvNr) ?? throw new ArgumentException("PaymentVar not found");
Season = await ctx.Seasons.FindAsync(Year) ?? throw new ArgumentException("Season not found");
@ -201,8 +200,8 @@ namespace Elwig.Windows {
FillingInputs = false;
}
protected override async Task OnRenewContext() {
await RefreshGraphList();
protected override async Task OnRenewContext(AppDbContext ctx) {
await RefreshGraphList(ctx);
}
private void InitPlot() {