简体   繁体   中英

Windows Phone XNA message box error

I have two methods in my windows phone app and both of them display a message box.
I can call method1 as many times as I like and the messagebox always displays correctly. However, if I then call method2 having previously called method1, I get the error:

the Guide UI is already active. Wait until Guide.IsVisible is false before issuing this call

Both of my methods look like this;

try
{
    ...
}
catch (Exception ex)
{
    Guide.BeginShowMessageBox("Error",
    "There was a problem.",
    new List<string> { "OK" }, 0, MessageBoxIcon.Alert, asyncResult => Guide.EndShowMessageBox(asyncResult), null);
}

Is there anything wrong with this?
I thought my call to EndShowMessageBox should be enough but I am still getting the error.

I found the issue. My code was actually causing the messagebox to open twice very quickly. I simply added a check to IsVisible and now the second box does not display.

if (!Guide.IsVisible)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM