public static void BeginInvoke(Action callback, int timeout = 0) { if (timeout == 0) { Context.Post(state => callback(), null); return; } InvokeHandlers.Add(new UpdateHandler(callback, new TimeoutHandler(timeout, true))); }
public static void BeginInvoke(Action callback, int timeout = 0) { if (timeout < 0) { throw new ArgumentOutOfRangeException(nameof(timeout)); } if (timeout == 0) { Threading.SynchronizationContext.Post(state => callback(), null); return; } InvokeHandlers.Add(new UpdateHandler(callback, new TimeoutHandler(timeout, true))); }