BarCommand - How do you programmatically execute a command?

Docking/MDI for Windows Forms Forum

Posted 18 years ago by Bill Jacquot
This is WRT UIStudio 2.0 for .NET 2.0. The BarCommand is very nice for UI based invocation of a command. However one additional benefit of the GoF command pattern is to allow for macros i.e. programmatic invocation of a command. In this case, you need to be able to programmatically "execute" a command hence the basic GoF command pattern has an "Execute" method. So how do you "execute" a BarCommand?

Also, another pattern commonly involved with the command pattern is the composite pattern in the implementation of a "MacroCommand". MacroCommand would contain a collection of "commands" but also implements the command pattern. When you execute the MacroCommand it in turn calls execute on each contained command. It might be a nice addition for a future release.

Comments (1)

Posted 18 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Bill,

Thanks for the suggestions. Right now there isn't a generic Execute method however a lot of the various command types can be executed if you cast them to their appropriate type.

For instance, all the various commands with buttons have a RaiseClickEvent method that is essentially the same as an Execute method.

Actipro Software Support

The latest build of this product (v24.1.0) was released 4 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.