Common cancel command

Topics: CAB & Smart Client Software Factory
Mar 8, 2006 at 12:15 AM
originally posted by: Tomcic

I got the situation...

- MDI with UltraMdiTabWorkspace from Infragistics.
- Cancel menu item in main shell view, connected with COMMON_CANCEL command.
- COMMON_CANCEL command should terminate active workitem and make some additional action with active workitem if need be.

My soulution is create custom base workitem with command handler

public virtual void CancelCommand(object sender, EventArgs e)
if (Status == WorkItemStatus.Active)

I've realized that this is not good solution. When I have few workitems and I terminating first one, second one becomes active. This is becouse of using UltraMdiTabWorkspace - next SmartPart automatically is activating and activate its workitem.
So, activating second workitem is before executing CancelCommand in this workitem. Becouse of that, all workitems will be terminated.

I asking you for help to manage with this problem, opinion and maybe another solution. I get confused, I'm on the good way?
Mar 8, 2006 at 6:14 AM
originally posted by: DLorenz

I thought that the CommandHandlers and EventSubscriptions were one in the same. However, I guess you could try using EventSubscriptions/Publications instead. On the menu item click, you can raise an event that all workitems will catch. Hopefully, that will fix it. However, if that doesn't work, then I would ask if you have multiple workitems showing on the screen at any given point, like the main work area, along with the main menu support on the outside. If that is the case, it is possible that the Main Menu is active and not the main work area. If you close the Main Menu, all of its child workitems will close along with it, resulting in the scenario you gave.