ContextWindow: Use Task.Run to load data outside main thread
All checks were successful
Test / Run tests (push) Successful in 2m29s
All checks were successful
Test / Run tests (push) Successful in 2m29s
This commit is contained in:
@@ -40,8 +40,11 @@ namespace Elwig.Windows {
|
||||
}
|
||||
|
||||
protected async void OnLoaded(object? sender, RoutedEventArgs? evt) {
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
using var ctx = new AppDbContext();
|
||||
await OnRenewContext(ctx);
|
||||
await OnInit(ctx);
|
||||
Mouse.OverrideCursor = null;
|
||||
}
|
||||
|
||||
protected async Task EnsureContextRenewed() {
|
||||
@@ -51,6 +54,8 @@ namespace Elwig.Windows {
|
||||
_renewPending = false;
|
||||
}
|
||||
|
||||
virtual protected async Task OnInit(AppDbContext ctx) { }
|
||||
|
||||
abstract protected Task OnRenewContext(AppDbContext ctx);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user