locked
Problem with DispatcherTimer accelerates RRS feed

  • Question

  • I have a problem with this code, is that I want to implement a countdown and the first time I go to this page (the counter), decrements of 1 in 1 second, that is correct, but the second time 2 2 seconds and the third 3 on 3, and so on, which can be caused if each initialize variables?

    Sunday, January 25, 2015 5:02 PM

Answers

  • Seems like you are creating second timer that operates on the same variable. Do you create timer only in OnNavigatedTo? On the other hand - you should stop the timer when the user leaves the app (OnNavigatedFrom/Suspending/Other event). 

     I' d written refreshTime.Stop(); in HardwareButtons_BackPressed. now I' ve written it in OnNavigatedFrom. this problem is solved :) 

    Sunday, January 25, 2015 5:27 PM

All replies

  • Seems like you are creating second timer that operates on the same variable. Do you create timer only in OnNavigatedTo? On the other hand - you should stop the timer when the user leaves the app (OnNavigatedFrom/Suspending/Other event). 

     I' d written refreshTime.Stop(); in HardwareButtons_BackPressed. now I' ve written it in OnNavigatedFrom. this problem is solved :) 

    Sunday, January 25, 2015 5:27 PM
  • When a question is solved (wehter by yourself or by another user), mark the answere please to let everybody see that. 

    Thanks.


    © 2015 Thomas Roskop

    Germany // Deutschland

    Sunday, January 25, 2015 5:49 PM