using System;
using System.Timers;
using System.ServiceProcess;
class MainClass
{
private static void WriteLogEntry(object sender, ElapsedEventArgs e)
{
Console.WriteLine("Timer is active : " + e.SignalTime);
}
public static void Main()
{
System.Timers.Timer timer = new Timer();
double interval = 1000;
timer.Interval = interval;
timer.AutoReset = true;
timer.Elapsed += new ElapsedEventHandler(WriteLogEntry);
timer.Start();
Console.ReadLine();
}
}
|