public void Unsubscribe(Channel type, PubSubDelegate d) { if (_dict.ContainsKey(type)) { _dict[type] -= d; } }
public void Subscribe(Channel type, PubSubDelegate d) { PubSubDelegate del = null; if (_dict.TryGetValue(type, out del)) { _dict[type] -= d; _dict[type] += d; } else { del += d; _dict.Add(type, del); } }
public void Publish(Channel type, object sender, Hashtable data) { Signal s = new Signal(type, sender, data); PubSubDelegate del = null; if (_dict.TryGetValue(type, out del)) { if (del != null) { del(s); } } }