.net - Silverlight Timer-Like Functionality -


Then I have a text box that sends the data back to the server.

I have to do this once the person has stopped typing

There is a timer in the process of my thinking and the timer (if stopped) Was set and need to say 3 seconds to reset the countdown time if it is already running and the timer is there.

Does anyone do such a thing?

You can use a DispatcherTimer to do this. Just start the timer when the text box gets focused and whenever the keydown event marks a variable, which notes that the user is typing something like this:

  Dispatcher timer timer; Bool typing = false; Int seconds = 0; Public Zero TextBox_OnFocus (...) {Timer = New DispatcherTimer (); Timer Interval = Timespan Foamseconds (1); Timer Tick ​​+ = new tie-up handler (timercut); Timer.start (); } Public Zero TextBox_LostFocus (...) {timer.Stop (); } Public Zero TextBox_OnKeyDown (...) {typing = true; } Public Zero TimesTitcut (...) {if (Typing) {secs ++; } And {secs = 0; } If (sec> = 3) deposit data (); Typing = false; }  

I'm not sure that this is the best way (to collect data like this) but this should work. Note that this is only psuedo code.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

jquery - SimpleModal Confirm fails to submit form -