Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/338.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 后台代理中的计时器_C#_Silverlight_Windows Phone 7 - Fatal编程技术网

C# 后台代理中的计时器

C# 后台代理中的计时器,c#,silverlight,windows-phone-7,C#,Silverlight,Windows Phone 7,这是我上一个问题的后续问题: 我正在寻找一种方法,从我的BackgroundAudioPlayer中每隔20-30秒运行一次函数,以便查询web服务器 目前,我正尝试以这种方式使用计时器: public AudioPlayer() { if (!_classInitialized) { _classInitialized = true; // Subscribe to the managed exceptio

这是我上一个问题的后续问题:

我正在寻找一种方法,从我的BackgroundAudioPlayer中每隔20-30秒运行一次函数,以便查询web服务器

目前,我正尝试以这种方式使用计时器:

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);
        }
    }

但是,每当我调用NotifyComplete时,计时器就不再滴答作响。有可能做到这一点吗?如果是,怎么做?

您写道:当我调用NotifyComplete时,计时器不再滴答作响。当然NotifyComplete documentation声明,在备注部分,此调用将结束后台代理的执行。好的,有没有办法获得我想要的功能?