WP7 How to get keyboard input synchronously

Started by
3 comments, last by SonicD007 11 years, 6 months ago
Hey everyone,

I'm trying to have the user input their name using

if (!Guide.IsVisible)
{
// display the guide
Guide.BeginShowKeyboardInput(PlayerIndex.One,
"Name entry", // title for the page
"Enter your name", // question for user
"Fred", // default text
asyncResult =>
{
InputtedText = Guide.EndShowKeyboardInput(asyncResult);
System.Diagnostics.Debug.WriteLine(InputtedText);
},
this); // object reference
}


but this runs Asynchronously. I need this to be modal because I do not want anything else to continue processing until I get the user input. Does anyone know how to do this? The work around I used for the messagebox on WP7 was to use Silverlights implementation of MessageBox as opposed to XNA's Guide.BeginShowMessageBox. Why would they make these things asynchronous!? >:[
Advertisement
Under winforms I believe the messagebox class had both synchrous and asynchrous versions, is this not the case in XNA?
Otherwise I'm sorry, I have no idea.
They do not and winforms can't be used on the windows phone because they don't have the libraries on the phone or something like that =/
I'm just throwing something out there but what about using Guide.IsVisible for the other game-related logic as well? Something like:

if (!Guide.IsVisible)
{
//perform game-related logic
}
else
{
//pause the game.
}


I've never tried something like that though - so, it's just a shot in the dark.

-Shadow
If anyone else is having this problem, I just used an infinite loop while(!asyncResult.IsCompleted){}. Alternatively, I think there is wait for the thread to finish property but I don't remember where exactly it is.

This topic is closed to new replies.

Advertisement