CAB QuickStarts: Module Loader5 Comments
This is the second post of a series that covers the basic ground of CAB QuickStarts from a simple point of view.
Other posts in this series
For more information about CAB see:
- CAB introduction posts (Spanish) by Mariano
- Composite UI Application Block (Spanish) by Jonathan
Module Loader QS
This is a list of the procedures in this post:
- The shell loads the GPSModule.dll MODULE specified in ProfileCatalog.xml, and gets there by using default implementations from the CAB.
- Gets the ROOTWORKITEM by using ServiceDependency (is a dependency in a service and will be dependency injected when added to a work item)
- The Load Method, adds a SampleWorkItem from the GPS module (DOES NOT EXIST IN CAB STRUCTURE).
- The SampleWorkItem overloads the OnRunStarted Method.
- The OnRunStarted Method:
- Calls base.OnRunStarted.
- References to the Deck Workspace ["MainWorkSpace"] on the MainForm.
- Shows the workspace by previously adding GPSview as a SmartPart.
- The GPSview gets the values from GPSService, because it has a Service Dependency.
- The GPSService has a service attribute (means that it is automatically loaded into the WorkItem).
- The reason a message box appears the first time the GetDistance Event is triggered is because the DistanceCalculatorService has a service attribute containing the property (AddOnDemand = true) ([Service(typeof(IDistanceCalculatorService), AddOnDemand = true)]).
- The button event is fired.
- The event handler calls the IGPSService.GetLatitude() Method.
GPSService has the [Service(typeof(IGPSService))] meaning that when the methods described in the service are executed the ones called are in GPSService NOT IGPSService (the class, not the interface).
Get Distance Button
- The IDistanceCalculatorService.ComputeDistance() Method is called by the event handler passing as values the Latitude and Longitud from the GPSService.
- The results return because the DistanceCalculatorService has the [Service(typeof( IDistanceCalculatorService))] meaning that when the methods described in the service are executed the ones called are in DistanceCalculatorService has NOT IDistanceCalculatorService (the class, not the interface).
The next post will be about SmartPart QS, so don’t go anywhere.
Leave a comment
Your email address will not be published.