public virtual Action <TimePeriodTrigger> LookFor(TimePeriodTrigger tpt, Action <TimePeriodTrigger> openMessage) { b.Info.Log("Lookfor Timer Event Started"); InitialiseTimerIfNeccesary(); HubMessageBase msg; if (UseStrongReferences) { msg = new StrongMessageReader <TimePeriodTrigger>(openMessage); } else { msg = new WeakMessageReader <TimePeriodTrigger>(openMessage); } timeEventsWaiting.Add(new Tuple <TimePeriodTrigger, HubMessageBase>(tpt, msg)); return(openMessage); }
public virtual Action <int> LookFor(int thisMessage, Action <int> openMessage) { if (!simpleMessagePeopleSearching.ContainsKey(thisMessage)) { simpleMessagePeopleSearching.Add(thisMessage, new List <HubMessageBase>()); } b.Verbose.Log(GetTraceMessage($"Adding listener for simple int message type {thisMessage}")); HubMessageBase msg; if (UseStrongReferences) { msg = new StrongMessageReader <int>(openMessage); } else { msg = new WeakMessageReader <int>(openMessage); } simpleMessagePeopleSearching[thisMessage].Add(msg); return(openMessage); }
// public virtual Func<T1, T1> LookFor<T1>(Func<T1,T1> openMessage) { public virtual Action <T1> LookFor <T1>(Action <T1> openMessage) { Type msgType = typeof(T1); b.Verbose.Log(GetTraceMessage($"Adding listener for message type {msgType}")); if (!peopleSearching.ContainsKey(msgType)) { peopleSearching.Add(msgType, new List <HubMessageBase>()); } HubMessageBase msg; if (UseStrongReferences) { msg = new StrongMessageReader <T1>(openMessage); } else { msg = new WeakMessageReader <T1>(openMessage); } peopleSearching[msgType].Add(msg); return(openMessage); }