This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
---
source_files:
- DataPRO/Modules/SensorsList/SensorsList/SensorsListModule.cs
generated_at: "2026-04-16T04:52:44.195014+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "281b61d00fb66791"
---
# SensorsList
## Documentation: SensorsListModule
### 1. Purpose
The `SensorsListModule` is a Prism module responsible for registering the view and view model types associated with the Sensors List UI component into the Unity dependency injection container. It enables modular composition of the application by exposing the `SensorsListView`, `SensorsListViewModel`, `SensorsListEditGroupView`, and `SensorsListEditGroupViewModel` as singleton services via their respective interfaces (`ISensorsListView`, `ISensorsListViewModel`, etc.). Additionally, the module contributes metadata (name, image, group, and region) to the host applications module discovery and UI assembly system via assembly-level attributes (`SensorsListModuleNameAttribute`, `SensorsListModuleImageAttribute`), allowing the main screen to display and categorize this module.
### 2. Public Interface
- **`SensorsListModule` class**
- `public SensorsListModule(IUnityContainer unityContainer)`
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration.
- `public void Initialize()`
Registers four types as singletons in the Unity container:
- `ISensorsListView``SensorsListView`
- `ISensorsListViewModel``SensorsListViewModel`
- `ISensorsListEditGroupView``SensorsListEditGroupView`
- `ISensorsListEditGroupViewModel``SensorsListEditGroupViewModel`
This method is called by `RegisterTypes`, and is also invoked directly during module initialization.
- `public void OnInitialized(IContainerProvider containerProvider)`
Currently empty; no logic is executed during Prisms `OnInitialized` phase.
- `public void RegisterTypes(IContainerRegistry containerRegistry)`
Delegates to `Initialize()`, which uses the injected `IUnityContainer` (not `containerRegistry`). *Note: `containerRegistry` is unused.*
- **`SensorsListModuleNameAttribute` class**
- `public override string AssemblyName { get; }`
Returns `"SensorsList"` (from `AssemblyNames.SensorsList.ToString()`).
- `public override Type GetAttributeType()`
Returns `typeof(TextAttribute)`.
- `public override string GetAssemblyName()`
Returns the value of `AssemblyName`.
- **`SensorsListModuleImageAttribute` class**
- `public override BitmapImage AssemblyImage { get; }`
Returns the image loaded via `AssemblyInfo.GetImage("SensorsList")`.
- `public override string AssemblyName { get; }`
Returns `"SensorsList"`.
- `public override string AssemblyGroup { get; }`
Returns `"Prepare"` (from `eAssemblyGroups.Prepare.ToString()`).
- `public override eAssemblyRegion AssemblyRegion { get; }`
Returns `eAssemblyRegion.SensorsListRegion`.
- `public override Type GetAttributeType()`
Returns `typeof(ImageAttribute)`.
- `public override BitmapImage GetAssemblyImage()`
Returns `AssemblyImage`.
- `public override string GetAssemblyName()`
Returns `AssemblyName`.
- `public override string GetAssemblyGroup()`
Returns `AssemblyGroup`.
- `public override eAssemblyRegion GetAssemblyRegion()`
Returns `AssemblyRegion`.
### 3. Invariants
- The module must be loaded *after* the Unity container is available (via Prisms module loading mechanism).
- The `SensorsListModuleNameAttribute` and `SensorsListModuleImageAttribute` must be applied at the assembly level (enforced via `[assembly: ...]` directives).
- The `AssemblyNames.SensorsList` enum value and `eAssemblyGroups.Prepare`, `eAssemblyRegion.SensorsListRegion` must be defined elsewhere (not in this file); their values are assumed constant.
- All registered types (`SensorsListView`, `SensorsListViewModel`, etc.) must have parameterless constructors or be resolvable by Unity (no explicit constructor injection is declared for them here).
- `Initialize()` is called *exactly once* per module instance, during `RegisterTypes`.
### 4. Dependencies
**Dependencies *of* this module:**
- `DTS.Common` and `DTS.Common.Interface` (specifically `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`)
- `Prism.Modularity` (`IModule`, `ModuleAttribute`)
- `Prism.Ioc` (`IContainerProvider`, `IContainerRegistry`)
- `Unity` (`IUnityContainer`)
- `System.Windows.Media.Imaging` (for `BitmapImage`)
**Dependencies *on* this module:**
- The host application (or other modules) that consumes the registered views/view models via `ISensorsListView`, `ISensorsListViewModel`, etc.
- UI composition logic that relies on `SensorsListModuleImageAttribute` metadata to render module icons and groupings in the main screen.
### 5. Gotchas
- **Unused parameter in `RegisterTypes`**: The `IContainerRegistry containerRegistry` parameter is ignored; the method uses the pre-injected `_unityContainer` instead. This may cause confusion if Prisms `RegisterTypes` is expected to use `containerRegistry`.
- **Redundant `Initialize()` call**: `Initialize()` is invoked both directly in the constructors usage path and via `RegisterTypes`, but since its idempotent (only performs registrations), this is safe. Still, its non-standard Prism pattern (typically `RegisterTypes` uses `containerRegistry`, and `OnInitialized` handles post-registration setup).
- **No error handling**: If `AssemblyInfo.GetImage("SensorsList")` fails (e.g., missing image resource), the attribute constructors will throw at assembly load time (not lazily), potentially breaking module discovery.
- **Attribute constructors perform side effects**: `SensorsListModuleImageAttribute`s constructor calls `AssemblyInfo.GetImage(...)`, which may involve I/O or resource loading. This happens at assembly load time, not module initialization time.
- **No documentation on view/view model lifetimes beyond "singleton"**: While Unity registration implies singleton, Prisms `IContainerRegistry` typically uses `ContainerControlledLifetimeManager` for singletons — but here the `IUnityContainer` is used directly, so behavior depends on Unitys default registration semantics (which *are* singleton unless overridden).
- **No usage of `IContainerProvider` in `OnInitialized`**: The method is empty, suggesting incomplete implementation or future extensibility.