Esempio n. 1
0
        private void InitiateAddingItemsToDB()
        {
            _dispose?.Dispose();
            _dispose = null;
            waitSub?.Dispose();
            waitSub = null;

            _dispose = new BehaviorSubject <bool>(true);
            var currentSliderSpeed = ((ThoughtEntryVM)this.BindingContext).Speed;
            var adjustedSpeed      = currentSliderSpeed * 2;

            waitSub?.Dispose();
            if (Convert.ToInt32(currentSliderSpeed) != 100 && Convert.ToInt32(currentSliderSpeed) != 0)
            {
                waitSub = Observable
                          .Interval(TimeSpan.FromMilliseconds(adjustedSpeed))
                          .TakeUntil(_dispose.Where(p => !p))
                          //.Take(1)
                          .Subscribe(val =>
                {
                    if (jsonString == null)
                    {
                        jsonString = JsonConvert.SerializeObject(new List <string>()
                        {
                            "Me", "You", "Us"
                        });
                    }
                    var newobj = JsonConvert.DeserializeObject(jsonString);
                    ((ThoughtEntryVM)this.BindingContext).AutoThought         = JsonConvert.SerializeObject(newobj);
                    ((ThoughtEntryVM)this.BindingContext).AutoGetNumberOfRows = true;
                    ((ThoughtEntryVM)this.BindingContext).AutoGetDBSize       = true;
                });
            }
        }
 public void Dispose()
 {
     _connectionStatus?.Dispose();
     _readData?.OnCompleted();
     _readData?.Dispose();
     Close(null);
 }
Esempio n. 3
0
 public void Dispose()
 {
     _filterStateSubject?.Dispose();
     _reduceStateSubject?.Dispose();
     _resetSubject?.Dispose();
     _disposables?.Dispose();
 }
        private async Task CompleteAsync()
        {
            Debug.WriteLine("disposing GraphQLHttpWebSocket...");

            _incomingMessagesConnection?.Dispose();

            if (!_internalCancellationTokenSource.IsCancellationRequested)
            {
                _internalCancellationTokenSource.Cancel();
            }

            await CloseAsync();

            _requestSubscription?.Dispose();
            _clientWebSocket?.Dispose();

            _stateSubject?.OnCompleted();
            _stateSubject?.Dispose();

            _exceptionSubject?.OnCompleted();
            _exceptionSubject?.Dispose();
            _internalCancellationTokenSource.Dispose();

            _sendLoopScheduler?.Dispose();
            _receiveLoopScheduler?.Dispose();

            Debug.WriteLine("GraphQLHttpWebSocket disposed");
        }
Esempio n. 5
0
        public void Value_ThrowsOnDispose()
        {
            var s = new BehaviorSubject <int>(42);

            Assert.AreEqual(42, s.Value);

            s.Dispose();

            Assert.Fail("Should not be able to read Value: {0}", s.Value);
        }
Esempio n. 6
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            if (!disposing)
            {
                return;
            }

            collectionChangedSubject?.Dispose();
        }
Esempio n. 7
0
        public void HasObservers_Dispose3()
        {
            var s = new BehaviorSubject <int>(42);

            Assert.False(s.HasObservers);
            Assert.False(s.IsDisposed);

            s.Dispose();
            Assert.False(s.HasObservers);
            Assert.True(s.IsDisposed);
        }
 protected virtual void dispose(bool disposing)
 {
     if (!_disposedValue)
     {
         if (disposing)
         {
             _provider.Dispose();
         }
         _disposedValue = true;
     }
 }
        protected override Task DestroyInternal()
        {
            _cancel.Cancel();

            _state.OnCompleted();
            _state.Dispose();

            _publisherSocket.Close();
            _publisherSocket.Dispose();

            return(Task.CompletedTask);
        }
Esempio n. 10
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_isDisposed)
            {
                if (disposing)
                {
                    _isReloadingData?.Dispose();
                }

                _isDisposed = true;
            }
        }
Esempio n. 11
0
        public override Task Stop()
        {
            _cancel.Cancel();

            _poller.Stop();

            _client.Close();
            _client.Dispose();

            _isConnected.OnCompleted();
            _isConnected.Dispose();

            return(Task.CompletedTask);
        }
Esempio n. 12
0
        protected virtual void Dispose(bool isDisposing)
        {
            if (_isDisposed)
            {
                return;
            }

            if (isDisposing)
            {
                _isReloadingData?.Dispose();
            }

            _isDisposed = true;
        }
Esempio n. 13
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed == false)
            {
                if (disposing)
                {
                    _observables.OnCompleted();

                    _recorder.Dispose();
                    _observables.Dispose();
                }
                _disposed = true;
            }
            base.Dispose(disposing);
        }
Esempio n. 14
0
        protected async override Task DestroyInternal()
        {
            _cancel.Cancel();

            _state.OnCompleted();
            _state.Dispose();

            _publisherSocket.Close();
            _publisherSocket.Dispose();

            _heartbeatPoller.Stop();

            await WaitForWorkProceduresToComplete(_heartbeatProc);

        }
Esempio n. 15
0
        public void Value_ThrowsOnDispose()
        {
            var s = new BehaviorSubject <int>(42);

            Assert.Equal(42, s.Value);

            s.Dispose();

            ReactiveAssert.Throws <ObjectDisposedException>(() =>
            {
                var ignored = s.Value;
            });

            Assert.False(s.TryGetValue(out var x));
        }
Esempio n. 16
0
        protected async override Task DestroyInternal()
        {
            _cancel.Cancel();

            _cleanup.Dispose();

            _state.OnCompleted();
            _state.Dispose();

            _sourceCache.Dispose();

            _cacheUpdatePoller.Stop();
            _heartbeatPoller.Stop();

            await WaitForWorkProceduresToComplete(_workProc, _heartbeatProc, _caughtUpWithStateOfTheWorldProc);
        }
        protected override Task DestroyInternal()
        {
            _cancel.Cancel();

            _observeCacheState.Dispose();

            _state.OnCompleted();
            _state.Dispose();

            _sourceCache.Dispose();

            _cacheUpdateSocket.Close();
            _cacheUpdateSocket.Dispose();

            return(Task.CompletedTask);
        }
Esempio n. 18
0
        /// <summary>
        /// Unsubcribe all subscription.
        /// </summary>
        public void Dispose()
        {
            if (isDisposed)
            {
                return;
            }

            isDisposed = true;
            anotherTrigger.Dispose();
            raiseSubscription.Dispose();
            sourceDisposable.Dispose();
            ((IDisposable)validationTrigger).Dispose();
            validateNotifyErrorSubscription.Dispose();
            errorsTrigger.OnCompleted();
            errorsTrigger.Dispose();
        }
        /// <summary>
        /// Unsubcribe all subscription.
        /// </summary>
        public void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            IsDisposed = true;
            AnotherTrigger.Dispose();
            RaiseSubscription.Dispose();
            SourceDisposable.Dispose();
            ((IDisposable)ValidationTrigger).Dispose();
            ValidateNotifyErrorSubscription.Dispose();
            ErrorsTrigger.OnCompleted();
            ErrorsTrigger.Dispose();
        }
Esempio n. 20
0
        // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
        // ~NavigationService()
        // {
        //   // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
        //   Dispose(false);
        // }

        /// <summary>
        /// Releases unmanaged and - optionally - managed resources.
        /// </summary>
        /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    _modalSubject?.Dispose();
                    _navigationSubject?.Dispose();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }
Esempio n. 21
0
        public void HasObservers_Dispose2()
        {
            var s = new BehaviorSubject <int>(42);

            Assert.IsFalse(s.HasObservers);

            var d = s.Subscribe(_ => { });

            Assert.IsTrue(s.HasObservers);

            d.Dispose();
            Assert.IsFalse(s.HasObservers);

            s.Dispose();
            Assert.IsFalse(s.HasObservers);
        }
    // Start is called before the first frame update
    void Start()
    {
        var behaviorSubject = new BehaviorSubject <int>(0);

        //behaviorSubject.OnNext(1);
        //behaviorSubject.OnNext(2);
        //behaviorSubject.OnNext(3);

        behaviorSubject.Subscribe(
            x => Debug.Log("OnNext:" + x),
            ex => Debug.LogError("OnError:" + ex),
            () => Debug.Log("OnCompleted"));

        behaviorSubject.OnNext(4);
        behaviorSubject.OnCompleted();

        behaviorSubject.Dispose();
    }
Esempio n. 23
0
        private void Dispose(bool isDisposing)
        {
            if (_notifySubscription != null)
            {
                _notifySubscription.Dispose();
                _notifySubscription = null;
            }

            if (_values != null)
            {
                _values.Dispose();
                _values = null;
            }

            if (isDisposing)
            {
                GC.SuppressFinalize(this);
            }
        }
Esempio n. 24
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources.
                Shutdown();
                _stateSubject.Dispose();
                _eventGenerator.Dispose();
            }

            // Dispose unmanaged resources.

            // Set disposed flag.
            _disposed = true;
        }
Esempio n. 25
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (disposing)
                {
                    disposables.Dispose();

                    if (sharp7 != null)
                    {
                        sharp7.Disconnect();
                        sharp7 = null;
                    }

                    connectionStateSubject?.Dispose();
                }

                disposed = true;
            }
        }
Esempio n. 26
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources.
                Close();
                AfterClose();
                _isSessionReady.Dispose();
                _playFailed.Dispose();
            }

            // Dispose unmanaged resources.

            // Set disposed flag.
            _disposed = true;
        }
Esempio n. 27
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources.
                _controlSubject.Dispose();
                _generalSubject.Dispose();
                Disconnect();
                _isConnected.Dispose();
                _sendControlLock.Dispose();
                _sendGeneralLock.Dispose();
            }

            // Dispose unmanaged resources.

            // Set disposed flag.
            _disposed = true;
        }
Esempio n. 28
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                // Dispose managed resources.
                Stop();
                Disconnect();
                _playStarted.Dispose();
                _videoStreamInfo.Subject.Dispose();
                _audioStreamInfo.Subject.Dispose();
                _rtspClient.Dispose();
            }

            // Dispose unmanaged resources.

            // Set disposed flag.
            _disposed = true;
        }
Esempio n. 29
0
 public void Dispose()
 {
     Stop();
     _intervalSubscription?.Dispose();
     _fileScanned?.Dispose();
 }
        public void Value_ThrowsOnDispose()
        {
            var s = new BehaviorSubject<int>(42);
            Assert.AreEqual(42, s.Value);

            s.Dispose();

            Assert.Fail("Should not be able to read Value: {0}", s.Value);
        }
        public void HasObservers_Dispose3()
        {
            var s = new BehaviorSubject<int>(42);
            Assert.IsFalse(s.HasObservers);

            s.Dispose();
            Assert.IsFalse(s.HasObservers);
        }
        public void HasObservers_Dispose2()
        {
            var s = new BehaviorSubject<int>(42);
            Assert.IsFalse(s.HasObservers);

            var d = s.Subscribe(_ => { });
            Assert.IsTrue(s.HasObservers);

            d.Dispose();
            Assert.IsFalse(s.HasObservers);

            s.Dispose();
            Assert.IsFalse(s.HasObservers);
        }
Esempio n. 33
0
        public void Value_ThrowsOnDispose()
        {
            var s = new BehaviorSubject<int>(42);
            Assert.AreEqual(42, s.Value);

            s.Dispose();

            ReactiveAssert.Throws<ObjectDisposedException>(() =>
            {
                var ignored = s.Value;
            });

            var x = default(int);
            Assert.IsFalse(s.TryGetValue(out x));
        }
Esempio n. 34
0
 public void Dispose()
 {
     logs?.Dispose();
     lastSequenceToken?.Dispose();
     subscription?.Dispose();
 }
Esempio n. 35
0
        /// <summary>
        /// トリガーにかかるか例外が出るまで待つ
        /// </summary>
        /// <param name="bs"></param>
        /// <param name="trigger"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        private async Task WaitTriggerAsync(BehaviorSubject<bool> bs, IDisposable trigger, StatusItem status)
        {

            await this.SendLineAsync(null);

            this.StatusSubject.OnNext(status);

            var waiting = await bs
                .Where(x => x)
                .Select(x => new WaitResultContainer(null))
                .Merge(this.ExceptionObservable)
                .Take(1);

            trigger.Dispose();
            bs.Dispose();

            if (!waiting.IsSucceeded)
            {
                throw waiting.Exception;
            }

            await this.WaitIfPausingAsync();
        }