Event data with custom classes

Topics: CAB & Smart Client Software Factory
Jan 10, 2007 at 10:30 PM
I want to pass an object from a class I made across a couple of events. I have the following event declared:

public event EventHandler<EventArgs<Customer>> CurrentCustomer;

When I try to set the CurrentCustomer to the current customer I have selected - CurrentCustomer(this, selectedCustomer); it says:

Error 2 Argument '2': cannot convert from Infrastructure.Interface.BusinessEntities.Customer' to 'Infrastructure.Interface.EventArgs<Infrastructure.Interface.BusinessEntities.Customer>'

What I'm confused about is, what do I have to do to get it to accept my Customer object? I tried using a delegate, that did not work, throwing an invalid handler exception. I also tried removing EventArgs, and that still did not work, throwing the same error as above.

Any help would be appreciated.

Jan 10, 2007 at 10:52 PM
Nevermind, I just used DataEventArgs and it worked. Sorry for the post.
Jan 11, 2007 at 1:31 AM
Ok, after trying every which way from Sunday, I'm stumped. I have two events right now, one to open a view, and another to store the current customer that I am working with. If I just put the event in by itself to show the view, it works fine. If I add my next event and run it, it says: "One or more exceptions occurred while firing the topic 'ShowPOC'", which makes no sense as ShowPOC is the event to show the view that worked fine before I added the second event. If I go back and remove everything I have added for the second event, and revert it back to the way things were with just the event to show the view, it still throws the exact same error.

I have no clue what to do, and I'm ready to pull my hair out. If anyone has any clue what could be going wrong, please let me know.
Jan 11, 2007 at 1:40 AM
Sorry to keep making posts, but there's no edit and I put the wrong error in my previous post. It's actually "Object reference not set to an instance of an object."

I don't know if this helps any more, but the reflected type is:

{Name = "EventTopic" FullName = "Microsoft.Practices.CompositeUI.EventBroker.EventTopic"}

And the return type:

{Name = "Void" FullName = "System.Void"}

It also shows 1 publication and 1 subscription.