首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

windows服务有关问题 急等.

2012-03-30 
windows服务问题 急等...#region 时钟调度private void timer1_Elapsed(object sender, System.Timers.Ela

windows服务问题 急等...
#region 时钟调度
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{

this.timer1.Enabled = false;
try
{

//////提醒
MissionReport_VacationApply_TX();//提醒
}
catch(Exception ex)
{
string xun = ex.ToString();
}
this.timer1.Enabled = true;
}
#endregion

代码如上 ,我怎么样判断 服务运行时,每一天下午 17:00 走( MissionReport_VacationApply_TX() 方法)  
并且只 走 一次???

[解决办法]
在Timer_Tick中你判断DateTime.Now.Hours==17:00
[解决办法]
走一次?
int times=1;
private void timer1_Tick(object sender, EventArgs e)
{
if(times<=0)
{
timer1.Stop();

return;
}
times--;
}

热点排行