Skip to content

Commit

Permalink
Added dispatcher.
Browse files Browse the repository at this point in the history
  • Loading branch information
Simnico99 committed Jan 11, 2023
1 parent f105c0d commit 3141cd8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public static Task RunWpfApplicationAsync<T>(this IHostBuilder builder, Cancella
var window = host.Services.GetRequiredService<T>();

await host.StartAsync(cancellationToken);
await window.ShowDialogAsync();
await Application.Current.Dispatcher.Invoke(async () => await window.ShowDialogAsync());
await host.StopAsync();
host?.Dispose();
});
Expand All @@ -80,7 +80,7 @@ public static Task RunWpfApplicationAsync<T>(this IHostBuilder builder, Action<W
var window = host.Services.GetRequiredService<T>();

await host.StartAsync(cancellationToken);
await window.ShowDialogAsync();
await Application.Current.Dispatcher.Invoke(async () => await window.ShowDialogAsync());
await host.StopAsync();
host?.Dispose();
});
Expand Down

0 comments on commit 3141cd8

Please sign in to comment.