62,269
社区成员
发帖
与我相关
我的任务
分享 private void LoadTimerStart()
{
System.Timers.Timer myTimer = new System.Timers.Timer(120000);
//关联事件
myTimer.Elapsed += new System.Timers.ElapsedEventHandler(mess);
myTimer.AutoReset = true;
//给Application["TIMEDEMO"]一个初始值
Application.Lock();
Application["TIMEDEMO"] = DateTime.Now.ToString();
Application.UnLock();
myTimer.Enabled = true;
}
private void mess(object sender, System.Timers.ElapsedEventArgs e)
{
SentEmail();
//获取当前时间
Application.Lock();
Application["TIMEDEMO"] = DateTime.Now.ToString();
Application.UnLock();
}