public IDisposable Schedule(Action action) { BooleanDisposable booleanDisposable = new BooleanDisposable(); MainThreadDispatcher.Post(scheduleAction, Tuple.Create(booleanDisposable, action)); return(booleanDisposable); }
public IDisposable Schedule(Action action) { var d = new BooleanDisposable(); MainThreadDispatcher.Post(scheduleAction, Tuple.Create(d, action)); return(d); }
public IDisposable Schedule(Action action) { BooleanDisposable d = new BooleanDisposable(); MainThreadDispatcher.Post(delegate { if (!d.IsDisposed) { action(); } }); return(d); }
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); } }
public void ScheduleQueueing <T>(ICancelable cancel, T state, Action <T> action) { MainThreadDispatcher.Post(QueuedAction <T> .Instance, Tuple.Create(cancel, state, action)); }
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)); }
IEnumerator DelayAction(TimeSpan dueTime, Action action) { yield return(new WaitForSeconds((float)dueTime.TotalSeconds)); MainThreadDispatcher.Post(action); }