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;
		}
Пример #4
0
            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;
            }
Пример #7
0
            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;
			}
Пример #9
0
		protected Context() {
			this.disposable = new BooleanDisposable();
			this.container = new Container();
			container.Register<IContext>(this);
			container.Register<IContainer>(container);
		}
Пример #10
0
 public void Boolean()
 {
     SetScehdulerForImport();
     var bd = new BooleanDisposable();
     bd.IsDisposed.IsFalse();
     bd.Dispose();
     bd.IsDisposed.IsTrue();
     UniRx.Scheduler.SetDefaultForUnity();
 }
Пример #11
0
            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;
            }
Пример #12
0
            public IDisposable SchedulePeriodic(TimeSpan period, Action action)
            {
                var d = new BooleanDisposable();
                var time = Scheduler.Normalize(period);

                MainThreadDispatcher.SendStartCoroutine(PeriodicAction(time, action, d));

                return d;
            }