public void Register([NotNull] ISignalReceiver receiver) { if (receiver == null) { throw new ArgumentNullException("receiver"); } int key = receiver.Id; if (!ReceiverLookup.ContainsKey(key)) { ReceiverLookup[key] = new List <ISignalReceiver>(); } List <ISignalReceiver> list = ReceiverLookup[key]; if (list.Contains(receiver)) { return; } list.Add(receiver); List <SignalPacket> packetList; if (m_SignalsLastFrame.TryGetValue(key, out packetList)) { foreach (SignalPacket packet in packetList) { receiver.Receive(packet.Sender, packet.Data); packet.NoReceivers = false; } } }
public static IObservable <TSignal> Receive <TSignal, TParameter>(this ISignalReceiver <TSignal> signalReceiver, TParameter parameter) where TSignal : ISignal <TParameter> { return(signalReceiver.Receive().Where(signal => Equals(signal.Parameter, parameter))); }