1
下面是我试图用作我们正在构建的桌面任务计时器上的已用计时器的代码。现在,当它运行时,它只会计数到60秒,然后重置并且不会添加到分钟中。计时器在60秒后重置
//tick timer that checks to see how long the agent has been sitting in the misc timer status, reminds them after 5 mintues to ensure correct status is used
private void statusTime_Tick(object sender, EventArgs e)
{
counter++;
//The timespan will handle the push from the elapsed time in seconds to the label so we can update the user
//This shouldn't require a background worker since it's a fairly small app and nothing is resource heavy
var timespan = TimeSpan.FromSeconds(actualTimer.Elapsed.Seconds);
//convert the time in seconds to the format requested by the user
displaycounter.Text=("Elapsed Time in " + statusName+" "+ timespan.ToString(@"mm\:ss"));
//pull the thread into updating the UI
Application.DoEvents();
}
你能分享定时器初始化方式? –