public void Run() { while (true) { Thread.Sleep(1000); if (OnTimer != null) { DateEventArgs DateToSend = new DateEventArgs(); DateToSend.Date = DateTime.Now; OnTimer(this, DateToSend); } } }
private static void publishit_OnTimer(object sender, DateEventArgs dateArgs) { Console.WriteLine(dateArgs.Date); }