Skip to main content
Participant
July 2, 2009
Question

What is the way to re-use the Events?

  • July 2, 2009
  • 1 reply
  • 1426 views

What is the best way to re-use the events with different parameter?


For example in one view, we dispatch an event called GetStudentsEvent("FirstYear");

in another view, we dispatch an event called GetStudentsEvent("SecondYear");

The problem is, in the Command, we should set the result in ModelLoator,

for example modelLocator.studentList;

So the 2 views will have the some result.

What I do is to create every time a different object in modelLocator when

an event is re-used. For example:  modelLocator.studentList1, modelLocator.studentList2, ...

and in the Command, I check the event's parameter and set the values to different modelLocator.


Are there any better ways to do this?

This topic has been closed for replies.

1 reply

Known Participant
July 2, 2009

Hi

I've yet to find a better way of reducing the number of command classes than by using the Universal Minds extensions for Cairngorm. They won't take much learning once you are comfortable with CG, and seeing as you have already started your project without them you'll find they can be integrated with what you have already without needing to change your old code, you can start using the extensions features and then go back and change old code if you want/need to.

This is what happened for me. I'd started using bare cairngorm, and had already many classes. Then added UM extensions and used it for all the new classes, then slowly worked back changing what i needed as and when.

Contact me off forum if you like

Good luck

glenn

maoanzAuthor
Participant
July 2, 2009

Hi, Glenn,

Do you have any documentations or examples of that?

I made a search, few things are found about the Universal Minds Extension.

Thanks.