This module, named SensorSettingsModule, is a Prism-based modular component responsible for registering the view and view model for the sensor settings UI within a modular WPF application. It integrates with the Unity dependency injection container to expose ISensorSettingsView and ISensorSettingsViewModel as singleton services, enabling the main application shell to display and manage sensor configuration UI. It also contributes metadata (name, image, group, region) to the host application’s module discovery and UI assembly system via custom assembly-level attributes.
2. Public Interface
SensorSettingsModuleModule class
public SensorSettingsModuleModule(IUnityContainer unityContainer)
Constructor that receives the Unity container via dependency injection. Stores the container for later use in type registration.
public void Initialize()
Registers the following types as singletons in the Unity container:
ISensorSettingsView → SensorSettingsView
ISensorSettingsViewModel → SensorSettingsViewModel
This method is called both directly by the constructor’s usage pattern (via RegisterTypes) and by Prism’s module initialization pipeline.
public void OnInitialized(IContainerProvider containerProvider)
Currently empty; no logic is executed during Prism’s OnInitialized phase.
public void RegisterTypes(IContainerRegistry containerRegistry)
Delegates to Initialize() (despite using a different container interface, IContainerRegistry, the method still invokes the internal Initialize() that uses _unityContainer). Note: This may indicate a potential inconsistency, as containerRegistry is unused.
public override eAssemblyRegion AssemblyRegion { get; }
Returns eAssemblyRegion.SensorSettingsModuleRegion.
public override Type GetAttributeType()
Returns typeof(ImageAttribute).
public override BitmapImage GetAssemblyImage() / GetAssemblyName() / GetAssemblyGroup() / GetAssemblyRegion()
Delegate to their respective properties.
3. Invariants
The module must be loaded into a Prism-based application using Unity as the DI container.
ISensorSettingsView and ISensorSettingsViewModel are registered as singletons (per container lifetime).
The AssemblyName for this module is strictly "SensorSettingsModule" (derived from AssemblyNames.SensorSettingsModule enum).
The module belongs to the "Administrative" group (eAssemblyGroups.Administrative) and is assigned to eAssemblyRegion.SensorSettingsModuleRegion.
The module image is loaded from a static AssemblyInfo.GetImage(...) method, implying a fixed image resource naming convention ("SensorSettingsModule").
4. Dependencies
Imports / External Dependencies
Prism.Modularity (IModule, ModuleAttribute) — for module lifecycle integration.
Unity (IUnityContainer, IContainerRegistry) — for DI container access.
DTS.Common and DTS.Common.Interface — defines core contracts:
AssemblyNames, AssemblyInfo, eAssemblyGroups, eAssemblyRegion, TextAttribute, ImageAttribute — used by attributes.
System.Windows.Media.Imaging — for BitmapImage type.
Depended Upon
The host application (via Prism’s module catalog) depends on this module to provide sensor settings UI.
Other modules or views may depend on ISensorSettingsView/ISensorSettingsViewModel being registered (e.g., to inject or navigate to the view).
5. Gotchas
RegisterTypes uses IContainerRegistry but calls Initialize() which uses _unityContainer (of type IUnityContainer) — this may cause confusion or runtime issues if IContainerRegistry is not internally backed by the same Unity container instance. The containerRegistry parameter is unused.
OnInitialized is empty — if future logic is added here, it must be compatible with Prism’s module initialization order.
Assembly-level attributes are applied unconditionally — their behavior relies on AssemblyNames.SensorSettingsModule and AssemblyInfo.GetImage(...) being correctly defined elsewhere in DTS.Common.
No validation or error handling is visible — if AssemblyInfo.GetImage(...) fails (e.g., missing image resource), the attribute constructor may throw silently or return null (behavior depends on AssemblyInfo implementation).
No public API beyond module registration — this module does not expose domain logic; it only bootstraps UI components.