Sunday 15 May 2011

c# - Is there a way to have a countdown timer while waiting for input? -


I am trying to create a simple game that requires user input before the timer runs out.

Actually, the page will load from time to time, and wait for the user to say the correct answer. If time is over, then the game is over, but if the user gets it properly, then he goes to the next question.

(I have got the speech part, I need to understand

  Code> // Add a statement using the system. Windows threading; // Create timer dispatch timer matimer; // setup timer myTimer = new DispatcherTimer (); MyTimer.Interval = System.TimeSpan.FromSeconds (10); MyTimer.Tick + = myTimer_Tick; // When you type + +, skeleton of this method / but type in it if it is not. MyTimer_Tick (Object Sender, EventArgse E) {// Then it runs when the timer goes off (every 10 seconds in this case)} // run timer myTimer.Start () // stop timer myTimer.Stop ()   

Is it your Question resolves?

No comments:

Post a Comment