Use services via controller or straight from view?

Topics: CAB & Smart Client Software Factory
Feb 16, 2006 at 1:12 PM
originally posted by: sklett

I have found 2 different approaches in the CAB sample solutions. In BankTeller CustomerAccountView the AccountService is being utilized directly. From what I have understood thus far, the controller is used for something like getting data or using a service. Just when I think I recognize a rule I see something that invalidates it.

I'm using an MVC in my app(I think, I'm not sure anymore ;0)

Are there guidlines I can read somewhere? Is it OK to do both?
Feb 16, 2006 at 7:07 PM
originally posted by: matiaswoloski

I try to keep the view as clean as possible.
This is the guideline I follow when writing Views and Presenters:

Responsabilities from the View
- Manage UI mapping
- Call the controller/presenter to accomplish the work
- Manage cross thread marshalling (InvokeRequired/BeginInvoke)
- Create the presenter using ObjectBuilder CreateNew

Responsabilities from the Presenter
- Use service agents to communicate to external services
- Use created by injection on their ctor
- Publish events via EventBroker (like status update)
- Subscribe to events
- Call the views to show their work
- Execute CAB commands

I recommend you to look at the reference implementation AppraisalWorkbench 1


Feb 16, 2006 at 7:16 PM
originally posted by: sklett

OK, understood. Thank you for the reply, this will help me move forward with my design. I felt that the view should be clean as well, it was just those different examples that were confusing me.

Thanks again,