C# 后台代理中的计时器
这是我上一个问题的后续问题: 我正在寻找一种方法,从我的BackgroundAudioPlayer中每隔20-30秒运行一次函数,以便查询web服务器 目前,我正尝试以这种方式使用计时器: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
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声明,在备注部分,此调用将结束后台代理的执行。好的,有没有办法获得我想要的功能?