CAB QuickStarts: Module Loader

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:

Module Loader QS

This is a list of the procedures in this post:

Run

  1. The shell loads the GPSModule.dll MODULE specified in ProfileCatalog.xml, and gets there by using default implementations from the CAB.
  2. Gets the ROOTWORKITEM by using ServiceDependency (is a dependency in a service and will be dependency injected when added to a work item)
  3. The Load Method, adds a SampleWorkItem from the GPS module (DOES NOT EXIST IN CAB STRUCTURE).
  4. The SampleWorkItem overloads the OnRunStarted Method.
  5. The OnRunStarted Method:
    1. Calls base.OnRunStarted.
    2. References to the Deck Workspace [“MainWorkSpace”] on the MainForm.
    3. Shows the workspace by previously adding GPSview as a SmartPart.
  6. The GPSview gets the values from GPSService, because it has a Service Dependency.
  7. The GPSService has a service attribute (means that it is automatically loaded into the WorkItem).
  8. 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)]).

Get Latitude Button

  1. The button event is fired.
  2. The event handler calls the IGPSService.GetLatitude() Method.
  3. 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

  1. The IDistanceCalculatorService.ComputeDistance() Method is called by the event handler passing as values the Latitude and Longitud from the GPSService.
  2. 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.



No Comments

Leave a Reply