public static CompositeDisposable CreateComposite(this IDisposable disposable, IDisposable other)
        {
            CompositeDisposable disposables = new CompositeDisposable();

            disposable.AddTo(disposables);
            other.AddTo(disposables);
            return(disposables);
        }
Exemplo n.º 2
0
 public void Blink()
 {
     Observable.Timer(TimeSpan.FromSeconds(DelayInSec)).Subscribe(l =>
     {
         _currentCoRoutine?.Dispose();
         _currentCoRoutine = Observable.FromCoroutine(BlinkCoroutine).Subscribe();
         _currentCoRoutine.AddTo(this);
     });
 }
Exemplo n.º 3
0
 public static IDisposable AddTo(this IDisposable disposable, Component gameObjectComponent)
 {
     if (gameObjectComponent == null)
     {
         disposable.Dispose();
         return(disposable);
     }
     return(disposable.AddTo(gameObjectComponent.gameObject));
 }
        internal SlidingWindowBase(
            IDisposable disposeOnDisposal,
            IScheduler notificationScheduler)
        {
            disposeOnDisposal.AddTo(CompositeDisposable);

            Size   = 0;
            Offset = 0;
            CountOfBackedDataSet   = 0;
            _notificationScheduler = notificationScheduler;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Executed when constructor is called, OnDeserializingAttribute is fired or Bind() is called. Will not be executed again, if already executed in the past.
 /// </summary>
 protected virtual void OnConstruct()
 {
     wasConstructed = true;
     if (DisposablesProperty == null)
     {
         DisposablesProperty = new ReactiveProperty <CompositeDisposable>(new CompositeDisposable());
     }
     OnDisposing     = new ReactiveCommand();
     OnAfterBind     = new ReactiveCommand();
     bindAllListener = bindAllCommand.Subscribe(e => Bind(e));
     bindAllListener.AddTo(this);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Used internally to listen to controller dispose. No need to call this manually.
 /// </summary>
 protected void ListenToControllerDispose()
 {
     if (Controller != null)
     {
         if (controllerDisposeListener != null)
         {
             controllerDisposeListener.Dispose();
         }
         controllerDisposeListener = Controller.OnDisposing.Subscribe(e => OnControllerDispose());
         controllerDisposeListener.AddTo(this);
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// Used internally to listen to model dispose. No need to call this manually.
 /// </summary>
 protected void ListenToModelDispose()
 {
     if (modelDisposeListener != null)
     {
         modelDisposeListener.Dispose();
     }
     if (Model != null)
     {
         modelDisposeListener = Model.OnDisposing.Subscribe(e => OnModelDispose());
         modelDisposeListener.AddTo(this);
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// <para>Add disposable(self) to CompositeDisposable(or other ICollection) and Dispose self on target gameObject has been destroyed.</para>
 /// <para>Return value is self disposable.</para>
 /// </summary>
 public static IDisposable AddTo(this IDisposable disposable, ICollection <IDisposable> container, GameObject gameObject)
 {
     return(disposable.AddTo(container).AddTo(gameObject));
 }
Exemplo n.º 9
0
 public void Add(IDisposable disposable)
 {
     disposable.AddTo(View.GameObject);
 }
Exemplo n.º 10
0
 protected void AddToDisposables(IDisposable disposable)
 {
     disposable.AddTo(this.Disposables);
 }