Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        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)));
        }