using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Remoting.Messaging; using System.Timers; using Logger; namespace Untitly { public class myTimer { public static System.Timers.Timer timers; public myTimer() { } public void time() { timers = new System.Timers.Timer(10000); timers.Elapsed += new ElapsedEventHandler(myTimer_Elapsed); timers.Enabled = true; timers.AutoReset = true; } public delegate string GetLogDelegate(); private static string GetLogs() { return DateTime.Now.ToString(); } private static void LogTableCallBack(IAsyncResult tag) { AsyncResult result = (AsyncResult)tag; GetLogDelegate del = (GetLogDelegate)result.AsyncDelegate; Test.Write(del.EndInvoke(tag)); } static void myTimer_Elapsed(object source, ElapsedEventArgs e) { try { GetLogDelegate getLogDel = new GetLogDelegate(GetLogs); getLogDel.BeginInvoke(new AsyncCallback(LogTableCallBack), null); } catch (Exception ex) { Log.WriteErrorLog(ex); } } } }