Why the EventArgs are blocked in CommandAdapter ?

Topics: CAB & Smart Client Software Factory
Oct 28, 2005 at 6:10 AM
originally posted by: jwang49

In EventCommandAdapter :
public void InvokerEventHandler(object sender, EventArgs e)

In CommandAdapter :

public virtual void FireCommand()
if (ExecuteCommand != null)

My question is why the original sender and EventArgs are not passed into the FireCommand ?
I am more concerned about EventArgs. For example the Invoker is a TextBox, I need to get
the characters that user has typed.
Oct 28, 2005 at 6:25 AM
originally posted by: DLorenz

I'm pretty sure this doesn't matter. I don't lose any of the event arg information. If it didn't work, you wouldn't be able to use the DataEventArgs correctly, but I know for a fact that it works. Are you losing the information, or did you just look at the code and aare sking questions about it?

I think that the ExecuteCommand calls something on the incoming EventCommandAdapter, which already stores the sender and event args. Then when it goes to call into the actual method that subscribed, it uses its stored data rather than the execute command data. You'd probably have to trace through a bunch of stuff to confirm that theory, though. :)
Oct 28, 2005 at 6:51 AM
originally posted by: jwang49

I am actually loosing information. This is what I have done:

I have a Infragistics TextBoxTool, and register EventCommandAdapter for this type

commandAdapterMapService.Register(typeof(TextBoxTool), typeof(EventCommandAdapter<TextBoxTool>));

then I add invoker to the command

Command cmd = workItem.Commands"MyTextbox";

then I add a handler

public void TextBoxHandler(object sender, EventArgs e)
The EventArgs gets here is an empty one
The sender gets here is a Command. Are you saying that the original EventArgs is
stored somewhere in the Adapter ? and I should use Command to find the adapter
and then retrieve the information ?

Thanks for the help
Oct 29, 2005 at 4:10 AM
originally posted by: DLorenz

Oh, CommandHandlers... I thought you were talking about EventPublication/EventSubscriptions...
Feb 9, 2006 at 4:54 PM
originally posted by: AndrePiwoni

Here's a good explanation why EventArgs are empty:


In addition, CommandStrategy when it registres handler it creates Delegate of EventHandler type.