winrt xaml - Can timer run in Background Task -


say have 3 pages: p1, p2 , p3

user can navigate p1 -> p2 -> p3

at p3 , need timer keep running , trigger call function @ interval. say, timer call function in every 1 minute interval.

1) timer function:  tick = 60;  if (_fixedtick > 0) {     _fixedtick--; } else {  call func();  } 

the problem:

  • if user navigate p3 p2 , stop timer.

i come across background task

question

a)how build timer call function @ fixed interval. ie: tick =60.
b) above (1) timer function way handle timing?

c) can some1 show me how create background timer in background task. can use above (1) timer function in background task timer keep running whether user navigate p3 p2.

namespace mytimertask {     public sealed class firsttask : ibackgroundtask     {         public void run(ibackgroundtaskinstance taskinstance)         {           }     } 

appreciate help.

thanks

no, background task not way go. create simple dispatchertimer in global location static class, static property on app.xaml.cs, etc.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -