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
Post a Comment