public SourceInfo(ICandleSource <Candle> source, CandleManager manager) { _source = source ?? throw new ArgumentNullException(nameof(source)); _manager = manager; _source.Processing += OnProcessing; }
private void UnSubscribe(ICandleSource <Candle> source) { lock (_info.SyncRoot) { var info = _info[source]; info.Dispose(); _info.Remove(source); } }
public SourceInfo(ICandleSource <Candle> source, CandleManager manager) { if (source == null) { throw new ArgumentNullException(nameof(source)); } _source = source; _manager = manager; _source.Processing += OnProcessing; _source.Error += _manager.RaiseError; }
protected override void OnAdded(ICandleSource <Candle> item) { Subscribe(item); base.OnAdded(item); }
private void Subscribe(ICandleSource <Candle> source) { _info.Add(source, new SourceInfo(source, _manager)); }
protected override void OnInserted(int index, ICandleSource <Candle> item) { Subscribe(item); base.OnInserted(index, item); }
protected override bool OnRemoving(ICandleSource <Candle> item) { UnSubscribe(item); return(base.OnRemoving(item)); }