--- source_files: - DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/PSDReportSettingsModule.cs generated_at: "2026-04-16T10:59:04.135002+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "272bb780c04413d3" --- # Documentation: PSDReportSettingsModule ## 1. Purpose This module serves as the entry point for the "PSD Report Settings" feature within the DTS Viewer application. It is a Prism Module (`PSDReportSettingsModule`) responsible for registering its associated View, ViewModel, and Model dependencies with the Unity dependency injection container. Additionally, it defines assembly-level attributes to expose metadata (name, image, grouping, and region) to the main application shell, allowing the module to be discovered and displayed in the UI as an available component. ## 2. Public Interface ### Classes **`PSDReportSettingsModule`** Inherits from: `IModule` * `PSDReportSettingsModule(IUnityContainer unityContainer)`: Constructor that accepts a `IUnityContainer` instance and stores it in a readonly field. * `void RegisterTypes(IContainerRegistry containerRegistry)`: Implements `IModule.RegisterTypes`. Executes the `Initialize()` method to register types with the container. * `void OnInitialized(IContainerProvider containerProvider)`: Implements `IModule.OnInitialized`. Currently contains no implementation logic. * `void Initialize()`: Registers the following interface-to-concrete-type mappings using the injected `_unityContainer`: * `IPSDReportSettingsViewModel` → `PSDReportSettingsViewModel` * `IPSDReportSettingsModel` → `PSDReportSettingsModel` * `IPSDReportSettingsView` → `PSDReportSettingsView` **`PSDReportSettingsModuleNameAttribute`** Inherits from: `TextAttribute` * `[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]` * `PSDReportSettingsModuleNameAttribute()`: Default constructor. * `PSDReportSettingsModuleNameAttribute(string s)`: Overloaded constructor (parameter `s` is unused). * `string AssemblyName { get; }`: Overrides the base property. Returns the string representation of `AssemblyNames.PSDReportSettings`. * `Type GetAttributeType()`: Returns `typeof(TextAttribute)`. * `string GetAssemblyName()`: Returns the value of the `AssemblyName` property. **`PSDReportSettingsModuleImageAttribute`** Inherits from: `ImageAttribute` * `[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]` * `PSDReportSettingsModuleImageAttribute()`: Default constructor. * `PSDReportSettingsModuleImageAttribute(string s)`: Overloaded constructor (parameter `s` is unused). * `BitmapImage AssemblyImage { get; }`: Returns a `BitmapImage` retrieved via `AssemblyInfo.GetImage(AssemblyNames.PSDReportSettings.ToString())`. * `string AssemblyName { get; }`: Returns the string representation of `AssemblyNames.PSDReportSettings`. * `string AssemblyGroup { get; }`: Returns `eAssemblyGroups.Viewer.ToString()`. * `eAssemblyRegion AssemblyRegion { get; }`: Returns `eAssemblyRegion.PSDReportSettingsRegion`. * `Type GetAttributeType()`: Returns `typeof(ImageAttribute)`. * `BitmapImage GetAssemblyImage()`: Returns `AssemblyImage`. * `string GetAssemblyName()`: Returns `AssemblyName`. * `string GetAssemblyGroup()`: Returns `AssemblyGroup`. * `eAssemblyRegion GetAssemblyRegion()`: Returns `AssemblyRegion`. ## 3. Invariants * **Module Name:** The module is identified by the string `"PSDReportSettings"` in the `[Module]` attribute. * **Assembly Group:** The module belongs to the `Viewer` assembly group (defined by `eAssemblyGroups.Viewer`). * **Region:** The module is associated with the `PSDReportSettingsRegion` (defined by `eAssemblyRegion.PSDReportSettingsRegion`). * **Registration:** The types `IPSDReportSettingsViewModel`, `IPSDReportSettingsModel`, and `IPSDReportSettingsView` are registered with the Unity container as transient types (default `RegisterType` behavior) upon module initialization. ## 4. Dependencies **Internal Dependencies (referenced types):** * `DTS.Common`: Uses `AssemblyNames` enum. * `DTS.Common.Interface`: Uses `TextAttribute`, `ImageAttribute`, `eAssemblyGroups`, `eAssemblyRegion`. Also implies the existence of `IPSDReportSettingsViewModel`, `IPSDReportSettingsModel`, and `IPSDReportSettingsView` interfaces. * `DTS.Viewer.PSDReportSettings`: Uses `PSDReportSettingsViewModel`, `PSDReportSettingsModel`, `PSDReportSettingsView` concrete classes and `AssemblyInfo` static class. **External Frameworks:** * `Prism.Ioc`: Uses `IContainerProvider`, `IContainerRegistry`. * `Prism.Modularity`: Uses `IModule`, `ModuleAttribute`. * `Unity`: Uses `IUnityContainer`. * `System.Windows.Media.Imaging`: Uses `BitmapImage`. ## 5. Gotchas * **Ignored Constructor Parameters:** Both `PSDReportSettingsModuleNameAttribute` and `PSDReportSettingsModuleImageAttribute` have constructors that accept a `string s` parameter, but this parameter is completely ignored in the logic. It is unclear why this parameter exists. * **Mixed Container Usage:** The `RegisterTypes` method receives an `IContainerRegistry` (Prism abstraction) but the actual registration logic inside `Initialize()` uses the injected `IUnityContainer` (Unity specific). This bypasses the Prism abstraction layer, which could cause issues if the container implementation details differ or if the container wrapper is expected to manage lifestyle scopes. * **Property Getter Side Effects:** In `PSDReportSettingsModuleImageAttribute`, the `AssemblyImage` property getter performs a method call `AssemblyInfo.GetImage(...)` and assigns it to the private field `_img` every time the getter is accessed. This is not a pure getter; it causes a new image lookup (and potentially a new object allocation) on every read access, rather than returning a cached value. * **Empty OnInitialized:** The `OnInitialized` method is empty. If the module requires runtime initialization logic (like starting services or registering region views), it is not present here. The module currently only performs type registration.