CommandHandler - any limitation on where they go

Topics: CAB & Smart Client Software Factory
Nov 16, 2006 at 3:36 PM
originally posted by: Jrad

Is there any limitation as to where CommandHandler can be put. For example if I have added some Menu Items, such as Help, About using AfterShellCreated(), can I also add the handlers in the application start up file?

Nov 18, 2006 at 6:47 AM
originally posted by: jonimen

A CommandHandler only works in objects that are created through ObjectBuilder.
This is because the ObjectBuilder executes the CommandHandlerStrategy to search for CommandHandlers.

The creation of the ShellApplication.cs (application start up file), is not built up by ObjectBuilder.
The creation of the ShellApplication is a simple new of the object.

For example you can add a CommandHandler to a View because the creation of it, is done by a “WorkItem.SmartParts.AddNew<ViewType>()”.

The AddNew creates the Object through ObjectBuilder so, the CommandHandlerStrategy is executed.

I hope this helps you

Jonathan Menasches