/// <summary>
/// 定时器
/// </summary>
public void TimeDo()
{
System.Timers.Timer aTimer = new System.Timers.Timer();
aTimer.Elapsed += new System.Timers.ElapsedEventHandler(TimeEvent);
aTimer.Interval = 1000;
aTimer.Enabled = true;
}
/// <summary>
/// 定时器触发事件
/// </summary>
/// <param name="source"></param>
/// <param name="e"></param>
private static void TimeEvent(object source, System.Timers.ElapsedEventArgs e)
{
int intHour = e.SignalTime.Hour;
int intMinute = e.SignalTime.Minute;
int intSecond = e.SignalTime.Second;
int iHour = 10;
int iMinute = 30;
int iSecond = 00;
// 设置 每秒钟的开始执行一次
if (int
c# 利用Time实现定时启动程序
最新推荐文章于 2025-03-16 13:58:53 发布