protected void TransmitTo(IObjectReceiver receiver, Dictionary <string, object> Objects) { receiver.Receive(Objects); /* * if (ControllerFrom.IsMasteredBy(ControllerDest, out FullPrefix)) * { * //put header * Dictionary<string, object> toSend = new Dictionary<string, object>(); * foreach (KeyValuePair<string, object> o in Objects) * toSend.Add(FullPrefix + o.Key, o.Value); * receiver.Receive(toSend); * } * else if (ControllerDest.IsMasteredBy(ControllerFrom, out FullPrefix)) * { * //delete header * int fullPrefixLength = FullPrefix.Length; * Dictionary<string, object> toSend = new Dictionary<string, object>(); * foreach (KeyValuePair<string, object> o in Objects) * { * if (o.Key.IndexOf(FullPrefix) == 0) * toSend.Add(o.Key.Substring(fullPrefixLength), o.Value); * else * toSend.Add(o.Key, o.Value); * } * receiver.Receive(toSend); * } * else * throw new Exception("Error. Components located at unrelated Controllers can not communicate.");*/ }
public Guid Subscribe(Type message, IObjectReceiver receiver) { var sub = new Subscriber { Receiver = receiver }; if (!_subCache.ContainsKey(message)) { _subCache.Add(message, new List <Subscriber>()); } _subCache[message].Add(sub); return(sub.Id); }