Esempio n. 1
0
        public static IObservable <T> DelayFrame <T>(this IObservable <T> source, int frameCount)
        {
            if (frameCount < 0)
            {
                throw new ArgumentOutOfRangeException("frameCount");
            }

            return(Observable.Create <T>(observer =>
            {
                var cancel = new BooleanDisposable();

                source.Materialize().Subscribe(x =>
                {
                    if (x.Kind == NotificationKind.OnError)
                    {
                        observer.OnError(x.Exception);
                        cancel.Dispose();
                        return;
                    }

                    MainThreadDispatcher.StartCoroutine(DelayFrameCore(() => x.Accept(observer), frameCount, cancel));
                });

                return cancel;
            }));
        }
Esempio n. 2
0
 public void Cancel()
 {
     if (Status == TaskStatus.WaitingToRun || Status == TaskStatus.Running)
     {
         Status = TaskStatus.Canceled;
         cancellation.Dispose();
     }
 }
Esempio n. 3
0
 public void Boolean()
 {
     SetScehdulerForImport();
     var bd = new BooleanDisposable();
     bd.IsDisposed.IsFalse();
     bd.Dispose();
     bd.IsDisposed.IsTrue();
     UniRx.Scheduler.SetDefaultForUnity();
 }