public void RegisterHandler(IEventHandlerStub eventHandler, string eventServiceName) { if (eventHandler == null) { throw new ArgumentNullException("eventHandler"); } if (eventServiceName == null) { throw new ArgumentNullException("eventServiceName"); } if (!this.services.TryAdd(eventServiceName, eventHandler)) { throw new ArgumentException("An element with the same key already exists.", "eventServiceName"); } }
/// <summary> /// Add and event handler that allows to listen to events sent by the remote peer. /// </summary> /// <param name="handler">Handler instance.</param> /// <param name="eventInterfaceName">Event interface name.</param> public void AddEventListener(IEventHandlerStub handler, string eventInterfaceName) { this.eventServiceManager.RegisterHandler(handler, eventInterfaceName); }