This project has moved. For the latest updates, please go here.

WorkItem hierarchy

1. Overview

Figure 1 presents the WorkItem hierarchy of the Test Suite.

workitems.png
Figure 1

Typically, every CAB module provides its own WorkItem. The services registered by a module are available at the module WorkItem or any sub WorkItems. Only the services registered at the root WorkItem can be accessed in the whole application. Due to this fact, the modules FunctionGen.Driver, FunctionGen.ControlView and SignalVisualizer register their module WorkItems in the TestDevice.Manager WorkItem. Hence, these WorkItems can access the services provided by the TestDevice.Manager.

The sub WorkItems shown in Figure 1 represents documents or devices. The count of sub WorkItems a module is able to create is not limited.

2. How to register a module WorkItem in another module WorkItem?

The generated code of the Smart Client Software Factory registers all module WorkItems in the root WorkItem. Thus the registration has to be modified:

1. Set a name to the parent WorkItem. Add the parameter "TestDevice" to the AddNew method in the Module class.

public override void Load()
{
    base.Load();
    ControlledWorkItem<ModuleController> workItem = 
            rootWorkItem.WorkItems.AddNew<ControlledWorkItem<ModuleController>>("TestDevice");
    workItem.Controller.Run();
}

2. A sub module (e.g. SignalVisualizer) needs first to retrieve the "TestDevice" WorkItem. Then the own module WorkItem has to be registered in the TestDevice WorkItem instead of the root WorkItem.

public override void Load()
{
    base.Load();
    WorkItem testDeviceWorkItem = rootWorkItem.WorkItems["TestDevice"];
    ControlledWorkItem<ModuleController> workItem = 
            testDeviceWorkItem.WorkItems.AddNew<ControlledWorkItem<ModuleController>>();
    workItem.Controller.Run();
}

3. Conclusion

In my opinion a flat WorkItem hierarchy should be preferred because it is easier to understand. The alternative to the solution presented above is that the TestDevice.Manager module register its services and UIExtensionSites at the root WorkItem. Thus every module is able to access these services. This approach has two advantages. It is not necessary to change the Module implementation generated by the Smart Client Software Factory. The second advantage is that it keeps the WorkItem hierarchy flat.

Last edited Oct 8, 2007 at 1:54 PM by jbe2277, version 5

Comments

No comments yet.