/// <summary>Handle the hello message</summary> private void HandleMsg(OutMsg.RequestInstrumentStop msg) { // Remove the transmitter for the requested instrument Transmitter trans; if (!Transmitters.TryGetValue(msg.SymbolCode, out trans)) { return; } // Remove the unwanted time frame if (msg.TimeFrame != ETimeFrame.None) { trans.TimeFrames = trans.TimeFrames.Except(msg.TimeFrame).ToArray(); } else { trans.TimeFrames = new ETimeFrame[0]; } // Remove transmitters containing no time frames if (trans.TimeFrames.Length == 0) { Transmitters.Remove(msg.SymbolCode); trans.Dispose(); } }
/// <summary>Handle a request to stop sending instrument data</summary> private void HandleMsg(OutMsg.RequestInstrumentStop req) { // Find the associated transmitter var trans = FindTransmitter(req.SymbolCode); if (trans == null) { return; } // Remove the specified time frame if (req.TimeFrame == ETimeFrame.None) { trans.TimeFrames = new ETimeFrame[0]; } else { trans.TimeFrames = trans.TimeFrames.Except(req.TimeFrame).ToArray(); } }