admin管理员组

文章数量:1415673

I am trying to open a dialog in mudblazor, but it seems the execution does not wait for it to close. In this case, the computer will beep while the dialog is still open. Why?

razor:

@inject IDialogService Dialog

code behind:

private async Task ChangeAvatar()
{
    var result = await Dialog.ShowAsync<DlgAvatarSelection>("Select avatar",
        new DialogOptions { CloseButton = true, CloseOnEscapeKey = true });
    Console.Beep(1000, 25);
}

I am trying to open a dialog in mudblazor, but it seems the execution does not wait for it to close. In this case, the computer will beep while the dialog is still open. Why?

razor:

@inject IDialogService Dialog

code behind:

private async Task ChangeAvatar()
{
    var result = await Dialog.ShowAsync<DlgAvatarSelection>("Select avatar",
        new DialogOptions { CloseButton = true, CloseOnEscapeKey = true });
    Console.Beep(1000, 25);
}
Share Improve this question edited Feb 11 at 13:36 DarkBee 15.5k8 gold badges72 silver badges118 bronze badges asked Feb 11 at 13:03 Anders LindénAnders Lindén 7,35213 gold badges60 silver badges121 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Found it, I have to use Show and await the results Result.

var dlg = Dialog.Show<DlgAvatarSelection>("Select avatar");
var result = await dlg.Result;
var data = result.Data;

本文标签: mudblazorHow to open dialog in modal fashionStack Overflow