Command Pattern

Topics: CAB & Smart Client Software Factory
Jun 7, 2005 at 2:18 AM
originally posted by: cpatterson

I would be interested to know if there has been talk of implementing a Command Pattern as part of this block. For example I could have a command interface defined as follows

bool IsEnabled(ICommandExecutionContext context);
bool IsVisible(ICommandExecutionContext context);
bool Execute(ICommandExecutionContext context);

Where the ICommandExecutionContext defines the current WorkItem and the activve SmartPart. You could then decorate the ICommand implementation with an Attribute defining where it should appear in the menu structure. This would allow a developer to define small tasks to be executed and have the command it self determine weather or not is is avialble in a given context rather than the developer having to go through th entire menu on each context change.

It maybe this type of scenario is already covered by WorkItems but they appear to be more UseCase oriented rather that individual task execution oriented.