예제 #1
0
 private void Input_TextChanged(object sender, TextChangedEventArgs e)
 {
     try
     {
         answer = Convert.ToInt32(Input.Text.ToString());
     }
     catch (Exception)
     {
         TimerText.AppendText(Environment.NewLine);
         TimerText.AppendText("Wrong Input!");
     }
 }
예제 #2
0
 public void button_Click_end(object sender, RoutedEventArgs e)
 {
     //Token to stop
     if (cts != null && number == answer)
     {
         cts.Cancel();
         cts.Dispose();
         cts = null;
         TimerText.AppendText(Environment.NewLine);
         TimerText.AppendText("YOU WIN!");
         timer.Interval = TimeSpan.FromMilliseconds(200);
         timer.Tick    += new EventHandler(OnTick);
         timer.Start();
     }
     else
     {
         TimerText.AppendText(Environment.NewLine);
         TimerText.AppendText("Try Again!");
     }
 }