EventBroker is limited to EventHandler/Generic

Topics: CAB & Smart Client Software Factory
Dec 8, 2005 at 12:26 PM
originally posted by: danipham

I don't see why EventBroker is limited to event of type EventHandler and EventHandler<Type>.

It is not posible not declare this :
public event KeyEventHandler KeyPress;

public void OnKeyPress(object sender, KeyEventArgs e)

Removing the check: ThrowIfInvalidEventHandler(publishedEvent);
in the "Publication" class
in the method "public Publication(EventTopic topic, object publisher, string eventName, WorkItem workItem, PublicationScope scope)"
makes it works fine!

Could you help me to see the reason behind the limitation?
Dec 9, 2005 at 6:08 AM
originally posted by: DLorenz

It is possible. You need to do the following:

public event KeyEventHandler As EventHandler(Of DataEventArgs(Of KeyEventArgs))

Raiseevent KeyEventHandler(sender, new DataEventArgs(Of KeyEventArgs)(e))

public void OnKeyPress(object sender, DataEventArgs(Of KeyEventArgs) e)
Dec 9, 2005 at 8:26 AM
originally posted by: danipham

Thanks. But I still not see the reason of the check