public IDisposable Schedule(Action action) { var d = new BooleanDisposable(); #if NETFX_CORE Task.Run(()=> { if (!d.IsDisposed) { action(); } }); #else Action act = () => { if (!d.IsDisposed) { action(); } }; act.BeginInvoke(ar => act.EndInvoke(ar), null); #endif return d; }
public IDisposable Schedule(Action action) { var d = new BooleanDisposable(); contextDispatcher.Post(() => { if(!d.IsDisposed) { action(); } }); return d; }
public IDisposable Schedule(TimeSpan dueTime, Action action) { var d = new BooleanDisposable(); var time = Normalize(dueTime); contextDispatcher.StartCoroutine(DelayAction(time, () => { if(!d.IsDisposed) { action(); } })); return d; }
public IDisposable Schedule(Action action) { var d = new BooleanDisposable(); System.Threading.ThreadPool.QueueUserWorkItem(_ => { if (!d.IsDisposed) { action(); } }); return d; }
public IDisposable Schedule(Action action) { var d = new BooleanDisposable(); Action act = () => { if (!d.IsDisposed) { action(); } }; act.BeginInvoke(ar => act.EndInvoke(ar), null); return d; }
public IDisposable Schedule(TimeSpan dueTime, Action action) { var wait = Scheduler.Normalize(dueTime); var d = new BooleanDisposable(); #if NETFX_CORE Task.Run(()=> { if (!d.IsDisposed) { if (wait.Ticks > 0) { Thread.Sleep(wait); } action(); } }); #else Action act = () => { if (!d.IsDisposed) { if (wait.Ticks > 0) { Thread.Sleep(wait); } action(); } }; act.BeginInvoke(ar => act.EndInvoke(ar), null); #endif return d; }
public IDisposable Schedule(TimeSpan dueTime, Action action) { var wait = Scheduler.Normalize(dueTime); var d = new BooleanDisposable(); Action act = () => { if (!d.IsDisposed) { if (wait.Ticks > 0) { Thread.Sleep(wait); } action(); } }; act.BeginInvoke(ar => act.EndInvoke(ar), null); return(d); }
public IDisposable Schedule(Action action) { var d = new BooleanDisposable(); #if NETFX_CORE Task.Run(() => { if (!d.IsDisposed) { action(); } }); #else Action act = () => { if (!d.IsDisposed) { action(); } }; act.BeginInvoke(ar => act.EndInvoke(ar), null); #endif return d; }
protected Context() { this.disposable = new BooleanDisposable(); this.container = new Container(); container.Register<IContext>(this); container.Register<IContainer>(container); }
public void Boolean() { SetScehdulerForImport(); var bd = new BooleanDisposable(); bd.IsDisposed.IsFalse(); bd.Dispose(); bd.IsDisposed.IsTrue(); UniRx.Scheduler.SetDefaultForUnity(); }
public IDisposable Schedule(TimeSpan dueTime, Action action) { var d = new BooleanDisposable(); var time = Scheduler.Normalize(dueTime); MainThreadDispatcher.SendStartCoroutine(DelayAction(time, () => { if (!d.IsDisposed) { action(); } }, d)); return d; }
public IDisposable SchedulePeriodic(TimeSpan period, Action action) { var d = new BooleanDisposable(); var time = Scheduler.Normalize(period); MainThreadDispatcher.SendStartCoroutine(PeriodicAction(time, action, d)); return d; }