using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
namespace iReaper{
public class TimerManager
{
public static event EventHandler OnTimer;
public static void Init()
{
string Update_Interval = ConfigurationManager.AppSettings["Update_Interval"];
double sec;
if (!double.TryParse(Update_Interval, out sec))
{
sec = 3600 * 24;
}
timer = new System.Timers.Timer();
timer.Interval = sec * 1000;
timer.AutoReset = true;
timer.Elapsed += new System.Timers.ElapsedEventHandler(delegate
{
if (OnTimer != null)
{
OnTimer(null, EventArgs.Empty);
}
});
return;
}
static System.Timers.Timer timer;
}
}
|