Right place to handle event WorkItem or ModuleInit?

Topics: CAB & Smart Client Software Factory
Mar 16, 2007 at 6:29 PM
Hi,

I have the following scenario in a smart client app (using only CAB, not SCSF):
Module A (contains ModuleInit A, View A and WorkItem A)
Module B (contains ModuleInit B, View B and WorkItem B)

The user selects an item in View A and an event is fired with the details for the item selected as a parameter.

Is the following usage correct?

View A > Fires Event > ModuleInit B catches event > Module B starts WorkItem B > Module B sets state on WorkItem B > WorkItem B displays View B

Thanks,

Ali
Coordinator
Mar 17, 2007 at 12:59 PM
You can use that. But I would use ModuleInit only for initialization purpose. The pattern used in SCSF is to have a ModuleController workitem where you can handle those kind of events so it would be something like:

View A > Fires Event > ModuleController B catches event > ModuleController B starts WorkItem B > Module B sets state on WorkItem B > WorkItem B displays View B

Also, it's a recommended practice that the presenters raise events and have the views the minimum code possible (only to show and respond to user events).

Matias
http://staff.southworks.net/blogs/matiaswoloski