Files
DP44/enriched-qwen3-coder-next/DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults.md
2026-04-17 14:55:32 -04:00

93 lines
6.2 KiB
Markdown

---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/PSDReportResultsModule.cs
generated_at: "2026-04-16T13:37:15.973434+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1cb458d29a5aed08"
---
# PSDReportResultsModule Documentation
## 1. Purpose
This module serves as the Prism module definition for the PSD Report Results feature within the DTS Viewer application. It is responsible for registering the view and view model components (`IPSDReportResultsView` and `IPSDReportResultsViewModel`) with the Unity dependency injection container, and providing assembly-level metadata (name, image, group, and region) that the main application uses to discover and display this module as an available component.
## 2. Public Interface
### PSDReportResultsModule
**Signature:** `public class PSDReportResultsModule : IModule`
The main module class implementing Prism's `IModule` interface.
| Method | Signature | Description |
|--------|-----------|-------------|
| Constructor | `PSDReportResultsModule(IUnityContainer unityContainer)` | Accepts an injected `IUnityContainer` instance and stores it in `_unityContainer`. |
| Initialize | `public void Initialize()` | Registers `IPSDReportResultsViewModel``PSDReportResultsViewModel` and `IPSDReportResultsView``PSDReportResultsView` with the Unity container. |
| OnInitialized | `public void OnInitialized(IContainerProvider containerProvider)` | Empty implementation; no initialization logic executed. |
| RegisterTypes | `public void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()` for type registration. |
### PSDReportResultsModuleNameAttribute
**Signature:** `public class PSDReportResultsModuleNameAttribute : TextAttribute`
Assembly attribute providing the module's name.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `PSDReportResultsModuleNameAttribute()` | Default constructor. |
| Constructor | `PSDReportResultsModuleNameAttribute(string s)` | Overloaded constructor; the string parameter is not used. |
| AssemblyName | `public override string AssemblyName { get; }` | Returns `AssemblyNames.PSDReportResults.ToString()`. |
| GetAttributeType | `public override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
| GetAssemblyName | `public override string GetAssemblyName()` | Returns the `AssemblyName` property value. |
### PSDReportResultsModuleImageAttribute
**Signature:** `public class PSDReportResultsModuleImageAttribute : ImageAttribute`
Assembly attribute providing the module's image, name, group, and region for UI display.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `PSDReportResultsModuleImageAttribute()` | Default constructor. |
| Constructor | `PSDReportResultsModuleImageAttribute(string s)` | Overloaded constructor; the string parameter is not used. |
| AssemblyImage | `public override BitmapImage AssemblyImage { get; }` | Lazy-loads image via `AssemblyInfo.GetImage(AssemblyNames.PSDReportResults.ToString())`. |
| AssemblyName | `public override string AssemblyName { get; }` | Returns `AssemblyNames.PSDReportResults.ToString()`. |
| AssemblyGroup | `public override string AssemblyGroup { get; }` | Returns `eAssemblyGroups.Viewer.ToString()`. |
| AssemblyRegion | `public override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.PSDReportResultsRegion`. |
| GetAttributeType | `public override Type GetAttributeType()` | Returns `typeof(ImageAttribute)`. |
| GetAssemblyImage | `public override BitmapImage GetAssemblyImage()` | Returns `AssemblyImage`. |
| GetAssemblyName | `public override string GetAssemblyName()` | Returns `AssemblyName`. |
| GetAssemblyGroup | `public override string GetAssemblyGroup()` | Returns `AssemblyGroup`. |
| GetAssemblyRegion | `public override eAssemblyRegion GetAssemblyRegion()` | Returns `AssemblyRegion`. |
## 3. Invariants
- The module is decorated with `[Module(ModuleName = "PSDReportResults")]` and must be loaded by Prism's module system.
- Both assembly attributes are applied at assembly level with `AllowMultiple = false`, ensuring only one instance of each attribute exists per assembly.
- `AssemblyName` properties in both attribute classes always return the string representation of `AssemblyNames.PSDReportResults`.
- `AssemblyGroup` always returns `eAssemblyGroups.Viewer.ToString()`.
- `AssemblyRegion` always returns `eAssemblyRegion.PSDReportResultsRegion`.
- Type registrations for `IPSDReportResultsViewModel` and `IPSDReportResultsView` are required for the module to function.
## 4. Dependencies
### This module depends on:
- **Prism.Ioc** - `IContainerProvider`, `IContainerRegistry`
- **Prism.Modularity** - `IModule`, `ModuleAttribute`
- **Unity** - `IUnityContainer`
- **System.Windows.Media.Imaging** - `BitmapImage`
- **DTS.Common** - `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`
- **DTS.Common.Interface** - `TextAttribute`, `ImageAttribute`
- **Local types** (not shown in source but referenced): `PSDReportResultsViewModel`, `PSDReportResultsView`, `IPSDReportResultsViewModel`, `IPSDReportResultsView`
### What depends on this module:
- The main DTS Viewer application shell (inferred from module pattern and `eAssemblyGroups.Viewer` group assignment)
## 5. Gotchas
1. **Mixed container usage in RegisterTypes**: The `RegisterTypes(IContainerRegistry containerRegistry)` method receives an `IContainerRegistry` parameter but ignores it entirely, instead calling `Initialize()` which uses the injected `IUnityContainer` directly. This bypasses Prism's container abstraction layer.
2. **Unused constructor parameters**: Both attribute classes have constructors accepting a `string s` parameter that is completely ignored. The reason for this design pattern is unclear from the source alone.
3. **Redundant image initialization**: In `PSDReportResultsModuleImageAttribute`, the `_img` field is set both in the constructor and in the `AssemblyImage` property getter. The property getter unconditionally reassigns `_img` on every access, which could cause unnecessary image reloading.
4. **Empty OnInitialized**: The `OnInitialized` method is explicitly implemented but empty. It is unclear whether this is intentional or represents incomplete initialization logic.