Dispatch an event from a command.

visnik's Avatar


26 Jul, 2011 11:26 PM

Would it be OK to dispatch an event from a command for a mediator to listen for, or is that highly discouraged?
I have a situation where when the user opens a drop-down the app needs to pull values from my model, but no necessarily update them. My logic is when the user opens the drop-down, the mediator dispatches an event, a command is executed, it gets the values from the model and sends them back to the view in another event.

I see I can use the IContext's IEventDispatcher within the command so I assume it is all good, but a little voice in the back of my mind says 'don't do it, you'll be sorry"

  1. 1 Posted by Stray on 27 Jul, 2011 07:34 AM

    Stray's Avatar

    Hi Visnik - don't worry, you won't be sorry - it's a very much official and approved and valid way of doing things!

    So yes, go ahead with this flow - it works very well.


  2. 2 Posted by visnik on 27 Jul, 2011 02:45 PM

    visnik's Avatar

    cool, thank you Stray

  3. visnik closed this discussion on 29 Jul, 2011 08:09 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac