Commands not firing

Topics: CAB & Smart Client Software Factory
Aug 25, 2006 at 11:36 AM
originally posted by: MiniMe

I have setup these commands in my WorkItemController, this is a nested WorkItem, as such:
private void ExtendMenu()
ToolStripMenuItem manage = new ToolStripMenuItem("Manage");
ToolStripMenuItem manageEnterprises = new ToolStripMenuItem("Manage Enterprises");

this.WorkItem.UIExtensionSites.RegisterSite("Manage", manage.DropDownItems);
this.WorkItem.CommandsCommandNames.ManageEnterprises.AddInvoker(manageEnterprises, "Click");

and my handler is:

private void ManageEnterprisesCommandHandler(object source, EventArgs e)

However my handler never gets called, is there anyone that can tell me what I could be doing wrong? I'm suspecting some service that I may be missing, but I haven't changed any of the services besides replacing the IAuthenticationService with a custom one.
Aug 26, 2006 at 6:50 AM
originally posted by: askew

You mentioned this is a nested WorkItem.

I would look at this nesting as the reason for the behavior.

Aug 26, 2006 at 6:55 AM
originally posted by: MiniMe

I did that as well, I changed the code to reference the WorkItem.RootWorkItem everywhere WorkItem was used, but that didn't help either.
I know there is tracing built in to the CAB, do Commands have tracing built in? If so can anyone enlighten me as to how to enable/view the tracing?
I've used the visualizer previously, but that didn't contain any info about commands, not that I remember of anyway.
Aug 26, 2006 at 7:12 AM
originally posted by: askew

Will the Command fire for a ToolStripMenuItem that is not a 'DropDownItem'?
e.g. can you make the "Manage" menu item run the command as a test?
Aug 26, 2006 at 7:31 AM
originally posted by: marianoszklanny

To register command handlers, ObjectBuilder reflects over public methods and registers those that have the CommandHandler attribute.

Your command handler is private, so ObjectBuilder won't register it. Please make it public and tell us if this solved your problem.

Mariano Szklanny
Aug 26, 2006 at 12:32 PM
originally posted by: MiniMe

I tried that as well, it doesn't work.
I was wrong about the visualizer however, I do see the Command in the visualizer.
Aug 26, 2006 at 12:46 PM
originally posted by: MiniMe

that was it, thank you so much...
this thing was causing me such mental anguish....
the funny part is that I was just reading a blog post 2-3 days ago about how there had been requests for the ObjectBuilder not to be able to use injection on private data, I never made the connection, actually i never thought to look at the protection level of the method.
Anyway, thank you