Post() public static method

Dispatch Asyncrhonous action.
public static Post ( Action action, object state ) : void
action Action
state object
return void
Ejemplo n.º 1
0
            public IDisposable Schedule(Action action)
            {
                BooleanDisposable booleanDisposable = new BooleanDisposable();

                MainThreadDispatcher.Post(scheduleAction, Tuple.Create(booleanDisposable, action));
                return(booleanDisposable);
            }
Ejemplo n.º 2
0
            public IDisposable Schedule(Action action)
            {
                var d = new BooleanDisposable();

                MainThreadDispatcher.Post(scheduleAction, Tuple.Create(d, action));
                return(d);
            }
Ejemplo n.º 3
0
            public IDisposable Schedule(Action action)
            {
                BooleanDisposable d = new BooleanDisposable();

                MainThreadDispatcher.Post(delegate
                {
                    if (!d.IsDisposed)
                    {
                        action();
                    }
                });
                return(d);
            }
Ejemplo n.º 4
0
            public IDisposable Schedule <TState>(TState state, Func <IScheduler, TState, IDisposable> action)
            {
                var d = new SingleAssignmentDisposable();

                MainThreadDispatcher.Post(() =>
                {
                    if (!d.IsDisposed)
                    {
                        d.Disposable = action(this, state);
                    }
                });
                return(d);
            }
 public override void Post(SendOrPostCallback d, object state)
 {
     // If is in mainthread, call direct.
     if (MainThreadDispatcher.IsInMainThread)
     {
         d(state);
     }
     else
     {
         MainThreadDispatcher.Post(x =>
         {
             Pair pair = (Pair)x;
             pair.Callback(pair.State);
         }, new Pair(d, state));
     }
 }
 public static void Send(Action action)
 {
     if (MainThreadDispatcher.mainThreadToken != null)
     {
         try
         {
             action.Invoke();
         }
         catch (Exception ex)
         {
             MainThreadDispatcher mainThreadDispatcher = MainThreadDispatcher.Instance;
             if (mainThreadDispatcher != null)
             {
                 mainThreadDispatcher.unhandledExceptionCallback.Invoke(ex);
             }
         }
     }
     else
     {
         MainThreadDispatcher.Post(action);
     }
 }
 public static void Send(Action <object> action, object state)
 {
     if (MainThreadDispatcher.mainThreadToken != null)
     {
         try
         {
             action(state);
         }
         catch (Exception obj)
         {
             MainThreadDispatcher mainThreadDispatcher = MainThreadDispatcher.Instance;
             if (mainThreadDispatcher != null)
             {
                 mainThreadDispatcher.unhandledExceptionCallback(obj);
             }
         }
     }
     else
     {
         MainThreadDispatcher.Post(action, state);
     }
 }
Ejemplo n.º 8
0
 public void ScheduleQueueing <T>(ICancelable cancel, T state, Action <T> action)
 {
     MainThreadDispatcher.Post(QueuedAction <T> .Instance, Tuple.Create(cancel, state, action));
 }
Ejemplo n.º 9
0
 public void ScheduleQueueing <T>(ICancelable cancel, T state, Action <T> action)
 {
     MainThreadDispatcher.Post(Scheduler.IgnoreTimeScaleMainThreadScheduler.QueuedAction <T> .Instance, Tuple.Create <ICancelable, T, Action <T> >(cancel, state, action));
 }
Ejemplo n.º 10
0
            IEnumerator DelayAction(TimeSpan dueTime, Action action)
            {
                yield return(new WaitForSeconds((float)dueTime.TotalSeconds));

                MainThreadDispatcher.Post(action);
            }