Hey. Ich am trying to open a Busy-Dialog, while i am async verifying whether my login data is correct.
Following the source code here: Blazor Dialog component, i implemented the following:
async Task OnLogin(LoginArgs args)
{
InvokeAsync(async () =>
{
var myStateProv = authenticationStateProvider as AuthStateProvider;
var isValid = await myStateProv.VerifyAndStoreUser(args.Username, args.Password);
if (!isValid) { }
// Close the dialog
dialogService.Close();
});
await BusyDialog("Logging in ...");
var returnUrl = navigationManager.QueryString("returnUrl");
navigationManager.NavigateTo(returnUrl ?? "");
}
This however won't open the dialog, until after my task has finished. The dialog pops up shortly and dissapears immediatly.
If i replace the call with a Task.Delay(2000), the dialog will open and close just fine. How can i get this to work, so that the Busy-Dialog is shown, while the data is verified?
Best Regards