0

This is a followup question to my previous question: HttpWebRequest from AudioPlayerAgent

I am looking for a way to run a function every 20-30 seconds from inside my BackgroundAudioPlayer in order to query a web server.

Currently, I'm trying to use a timer in this fashion:

public AudioPlayer()
    {
        if (!_classInitialized)
        {
            _classInitialized = true;
            // Subscribe to the managed exception handler
            Deployment.Current.Dispatcher.BeginInvoke(delegate
            {
                Application.Current.UnhandledException += AudioPlayer_UnhandledException;

            });
            trackTimer = new Timer(TrackTimerTick, null, 0, 2000);
        }
    }

However, whenever I call NotifyComplete(), the timer no longer ticks. Is it possible to make this work? If so, how?

Community
  • 1
  • 1
bfink
  • 158
  • 2
  • 10
  • You wrote: "When I call `NotifyComplete()`, the timer no longer ticks." Of course! `NotifyComplete()` documentation states, in the Remarks section, "this call will end background agent execution." – Keith Robertson May 07 '12 at 21:26
  • Ok, so is there a way to get the functionality I want? – bfink May 07 '12 at 21:32

0 Answers0