Limit Command to a single instance

Topics: CAB & Smart Client Software Factory
Jun 5, 2007 at 9:14 PM
Edited Jun 5, 2007 at 9:17 PM

I have an order application that has n number of order smartparts in a deck workspace. The order smartpart contains a commandhandler to save the order, and each order smartpart lives in it's own WorkItem. The shell has a toolbar button that registers a save order button (as a command).

The problem is that when I click the save order button, each of the order smart parts commandhandlers fires and each order tries to save (the instances are in the deck workspace). I want to limit the functionality so that only the ActiveSmartPart in the deck receives the command.

I have already tried deactivating the commands, but because of the way they are stored, they are either on or off. Enabling or disabling WorkItems also did not work. This seems like a simple common scenario, but I can't seem to make it work. If anyone has run into this and found a solution, please let me know, I appreciate it!

Jun 5, 2007 at 11:40 PM
One possible solution: