public ActiveSource(int id, TimeSpan timeoutSpan, SourceInstrument sourceInstrument) { this._Id = id; this._TimeoutSpan = timeoutSpan; this._TimeoutTime = DateTime.Now.Add(this._TimeoutSpan); this._IsTimeout = false; this._SourceInstrument = sourceInstrument; }
public void OnAddInstrumentSourceRelation(InstrumentSourceRelation relation) { lock (this._SourceInstruments) { if (this._SourceInstruments.ContainsKey(relation.InstrumentId)) { this._SourceInstruments[relation.InstrumentId].AddInstrumentSourceRelation(relation); } else { // Map for SourceId - InstrumentSourceRelation Dictionary<int, InstrumentSourceRelation> relations = new Dictionary<int, InstrumentSourceRelation>(); relations.Add(relation.SourceId, relation); SourceInstrument sourceInstrument = new SourceInstrument(relation.InstrumentId, relations, this); this._SourceInstruments.Add(relation.InstrumentId, sourceInstrument); } } }