how to run periodic tasks every 5 minutes or more frequently in windows phone 8

前端 未结 3 1733
半阙折子戏
半阙折子戏 2021-01-24 07:37

In my WP8 application I need to download some json data every 5 minutes.
But in MSDN it\'s written that periodic tasks are run every 30 minutes.

Are there any wor

3条回答
  •  逝去的感伤
    2021-01-24 08:09

    I think this might be do your work.try this.

    dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
    dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);
    dispatcherTimer.Interval = new TimeSpan(0,5,0);
    dispatcherTimer.Start();
    

    And DispatcherTimer_Tick Method

    private void dispatcherTimer_Tick(object sender, EventArgs e)
    {
          //Do your Method...
    }
    

    Go to MSDN Dispatcher Timer for more Details.

提交回复
热议问题