public void registerDataListener(int service, int action, DataHandledDelegate handler) { lock (dataListeners) { Dictionary<int, DataHandledDelegate> serviceHandlers; if (dataListeners.TryGetValue(service, out serviceHandlers)) { serviceHandlers[action] = handler; } else { serviceHandlers = new Dictionary<int, DataHandledDelegate>(); serviceHandlers[action] = handler; dataListeners[service] = serviceHandlers; } } }
public void registerDataListener(DataMessage forMessage, DataHandledDelegate handler) { registerDataListener(forMessage.Service, forMessage.Action, handler); }