• CAB QuickStarts: Module Loader

    Published by on May 15th, 2008 2:10 am under C#, CAB, Composite UI Application Block, p&p, Patterns & Practices

    5 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:

    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.

    Tags: , , , ,

    • http://theniceweb.com Lizet Pena

      We have a great deal of performance problems with our application and some of them are due to JIT compilation in the first few minutes. We are trying to resolve that by using NGen to generate Native Images. The Module Loader in the CAB version we’re using uses Assembly.LoadFrom to load the assemblies listed in the ProfileCatalog.xml
      The LoadFrom method cannot load the assembly from the native image repository and the loaded assembly still uses a great deal of JIT time.
      http://blogs.msdn.com/suzcook/archive/2003/05/29/57143.aspx

      Thanks in advance for your time.

    • dschenkelman

      Hi Lizet,
      Mariano Converti, from the P&P Sustained Engineering team has just blogged about:
      How To: Use the Ngen tool to improve the performance in CAB / SCSF applications
      .

      Please let me know if you find this useful,
      Damian

Archives

Categories