private static void sleepFunction(Control control, int time, CallBackTag d, object Tag) { System.Threading.Thread.Sleep(time); if (d != null && !control.IsDisposed) { try { control.Invoke(d, Tag); } catch (Exception) { } } }
public static void Start(Control control, int time, CallBackTag callBack, object Tag) { ActionSleep sleep = sleepFunction; sleep.BeginInvoke(control, time, callBack, Tag, null, null); }