Jump to content

  • Log In with Google      Sign In   
  • Create Account

WP7 How to get keyboard input synchronously


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 SonicD007   Members   -  Reputation: 464

Like
0Likes
Like

Posted 02 October 2012 - 09:06 AM

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!? >:[

Sponsor:

#2 6677   Members   -  Reputation: 1058

Like
0Likes
Like

Posted 02 October 2012 - 09:41 AM

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.

#3 SonicD007   Members   -  Reputation: 464

Like
0Likes
Like

Posted 02 October 2012 - 09:54 AM

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 =/

#4 ShadowValence   Members   -  Reputation: 380

Like
0Likes
Like

Posted 02 October 2012 - 10:08 AM

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

Edited by ShadowValence, 02 October 2012 - 10:10 AM.


#5 SonicD007   Members   -  Reputation: 464

Like
0Likes
Like

Posted 02 October 2012 - 09:43 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS