public void OnNext(ObservableEvent <T> value)
        {
            switch (value)
            {
            case AddedObservableEvent <T> addedObservableEvent:
                Add(addedObservableEvent.Value);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(value));
            }
        }
 private void Publish(ObservableEvent <T> @event)
 {
     for (int index = 0; index < _observers.Count; index++)
     {
         try
         {
             _observers[index].OnNext(@event);
         }
         catch
         {
             // ignore
         }
     }
 }
Beispiel #3
0
 private void Publish(ObservableEvent <TValue> @event)
 {
     lock (_observers)
     {
         for (var index = 0; index < _observers.Count; index++)
         {
             try
             {
                 _observers[index].OnNext(@event);
             }
             catch
             {
                 // ignore
             }
         }
     }
 }
Beispiel #4
0
 private void Publish(ObservableEvent <TValue> @event)
 {
     using (_observersLock.ReadLock())
     {
         foreach (var observer in _observers)
         {
             try
             {
                 observer.OnNext(@event);
             }
             catch
             {
                 // ignore
             }
         }
     }
 }
Beispiel #5
0
        public void OnNext(ObservableEvent <TValue> value)
        {
            switch (value)
            {
            case AddedObservableEvent addedObservableEvent:
                Add(addedObservableEvent.Key, addedObservableEvent.Value);
                break;

            case RemovedObservableEvent removedObservableEvent:
                Remove(removedObservableEvent.Key);
                break;

            case ReplacedObservableEvent replacedObservableEvent:
                this[replacedObservableEvent.Key] = replacedObservableEvent.Value;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(value));
            }
        }
        public void OnNext(ObservableEvent <T> value)
        {
            switch (value)
            {
            case AddedObservableEvent addedObservableEvent:
                Add(addedObservableEvent.Value);
                break;

            case RemovedObservableEvent removedObservableEvent when !removedObservableEvent.Index.HasValue:
                Remove(removedObservableEvent.Value);
                break;

            case RemovedObservableEvent removedObservableEvent when removedObservableEvent.Index.HasValue:
                RemoveAt(removedObservableEvent.Index.Value);
                break;

            case ReplacedObservableEvent replacedObservableEvent:
                this[replacedObservableEvent.Index] = replacedObservableEvent.Value;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(value));
            }
        }