Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when calling ShowAsPopupAsync twice #176

Open
shaosu opened this issue Nov 28, 2023 · 1 comment
Open

Exception when calling ShowAsPopupAsync twice #176

shaosu opened this issue Nov 28, 2023 · 1 comment

Comments

@shaosu
Copy link

shaosu commented Nov 28, 2023

Exception when calling ShowAsPopupAsync twice:

private async void CustomInputPasswdValue_OnClick(object sender, RoutedEventArgs e)
{
    ButtonDefinition[] buttons = new ButtonDefinition[2];
    buttons[0] = new ButtonDefinition() { IsDefault = true, Name = "OK" };
    buttons[1] = new ButtonDefinition() { IsCancel = true, Name = "Cancel" };
    var CustomParam = new MessageBoxCustomParams
    {
        ContentTitle = "Custom Input Passwd Value",
        ContentMessage = $"Please enter a string",
        Icon = MsBox.Avalonia.Enums.Icon.Info,
        InputParams = new InputParams() { Label = "Passwd:", DefaultValue = "AAA" }, // , PasswordChar = "*"
        ButtonDefinitions = buttons,
    };

    var box = MessageBoxManager.GetMessageBoxCustom(CustomParam);
    var result = await box.ShowAsPopupAsync(this); // Fail:On box2 ShowAsPopupAsync
    // System.InvalidOperationException:“No loaded DialogHost have an Identifier property matching dialogIdentifier ('MsBoxIdentifier4931f5a5-d63a-4814-8613-8e3870df1497') argument.”
    string InputValue = box.InputValue;
    box = null;
    if (result == "OK")
    {
       var box2 = MessageBoxManager.GetMessageBoxStandard("Caption", $"Your passwd value is:{InputValue}", ButtonEnum.Ok);
       await box2.ShowAsPopupAsync(this);
    }
}

Same as #161

@M0n7y5
Copy link

M0n7y5 commented Jan 14, 2024

I have the same error. It looks like something gets unregistered after showing dialog as popup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants