Command Pattern

Jun 28, 2010 at 8:45 AM

Hi, I like your IoC framework very much, but there's one thing I'm missing. It's a Command Pattern - I'd like to register GUI controls to commands, register service methods for the commands and make each command behave atomically - enabling/disabling a command will enable/disable its controls, events of its controls will call the registered methods, etc. Just like Composite UI Application Block do it.

Do you plan to implement this?

Coordinator
Jun 28, 2010 at 2:35 PM
I looked at Commands early on in the development cycle and decided not to implement them becasue they really are a lot like events and I felt that you can achieve the same ends by simply using an EventSubscription and an EventPublication. The only downside I see is that the publisher has to explicitly declare the EventPublication, whereas if you used a Command the publisher can get the command by name from the Command list and invoke it. Otherwise I see them and functionally equal. Am I missing something? Is there something compelling that a Command offers that Events don't? Or are you talking broader that you not only want Commands but also things like the UIExtensionSites and UIElements?
Jun 28, 2010 at 4:20 PM

I'm talking about the commands connected with UI. No matter if it's connected by some common UI* classes, by adapters for each base WinForm class (Control, MenuItem, ...) or whatever.

I'm just missing the possibility to handle each command from one place (object). Two examples:
1) I've got a command and a control which should raise events of this command. I'd like to tell command.AddInvoker(control) (or something like this) and let the control register all aplicable event handlers.
2) I've got several controls registered to command and I want to disable the command. I'd like the command to handle automaticaly disabling all the registered controls.

Maybe there're more advantages of this pattern - these two I'm interested in now.

Thanks for your reply!

Jul 2, 2010 at 8:01 AM
What do you think about it? I'm just making a decision whether to use or not to use your library in our future projects. I've found it useful but I'm missing this Command Pattern. One option is also to le me implement it and add it to your library.
Coordinator
Jul 2, 2010 at 3:01 PM

It certainly an interesting idea.  I don't have the time to work on it right now as I'm focusing on the ORM project and a few other things.  If you want to implement it and submit it as a patch, feel free.