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,94 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.ViewerSettings/ViewerSettingsModule.cs
generated_at: "2026-04-16T11:05:22.275750+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9f0f5c6b474b7ca8"
---
# Documentation: ViewerSettingsModule
## 1. Purpose
This module serves as the Prism module definition for the ViewerSettings feature within the DTS Viewer application. It is responsible for registering the ViewerSettings View and ViewModel with the Unity dependency injection container, and providing assembly-level metadata (name, image, group, and region) that enables the main application to discover and display this module as an available component. The module belongs to the "Viewer" assembly group and targets the "ViewerSettingsRegion" for UI composition.
---
## 2. Public Interface
### `ViewerSettingsModule` (class)
Implements `Prism.Modularity.IModule`. The primary module entry point for the ViewerSettings feature.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ViewerSettingsModule(IUnityContainer unityContainer)` | Accepts a Unity container instance via dependency injection and stores it in `_unityContainer`. |
| `RegisterTypes` | `void RegisterTypes(IContainerRegistry containerRegistry)` | Calls `Initialize()` to perform type registrations. |
| `OnInitialized` | `void OnInitialized(IContainerProvider containerProvider)` | Empty implementation; no post-registration logic executed. |
| `Initialize` | `void Initialize()` | Registers `IViewerSettingsView``ViewerSettingsView` and `IViewerSettingsViewModel``ViewerSettingsViewModel` with Unity. A commented-out registration for `IViewerSettingsModel` exists but is not active. |
### `ViewerSettingsModuleNameAttribute` (class)
Extends `DTS.Common.Interface.TextAttribute`. Assembly-level attribute providing the module's name.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ViewerSettingsModuleNameAttribute()` | Default constructor; sets `AssemblyName` to `AssemblyNames.ViewerSettings.ToString()`. |
| Constructor | `ViewerSettingsModuleNameAttribute(string s)` | Overload accepting a string parameter (unused). |
| `AssemblyName` | `override string AssemblyName { get; }` | Returns `AssemblyNames.ViewerSettings.ToString()`. |
| `GetAttributeType` | `override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
| `GetAssemblyName` | `override string GetAssemblyName()` | Returns the `AssemblyName` property value. |
### `ViewerSettingsModuleImageAttribute` (class)
Extends `DTS.Common.Interface.ImageAttribute`. Assembly-level attribute providing the module's image, name, group, and region metadata.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ViewerSettingsModuleImageAttribute()` | Default constructor; initializes `_img` via `AssemblyInfo.GetImage()`. |
| Constructor | `ViewerSettingsModuleImageAttribute(string s)` | Overload accepting a string parameter (unused). |
| `AssemblyImage` | `override BitmapImage AssemblyImage { get; }` | Lazy-loads and returns the module's image via `AssemblyInfo.GetImage(AssemblyNames.ViewerSettings.ToString())`. |
| `AssemblyName` | `override string AssemblyName { get; }` | Returns `AssemblyNames.ViewerSettings.ToString()`. |
| `AssemblyGroup` | `override string AssemblyGroup { get; }` | Returns `eAssemblyGroups.Viewer.ToString()`. |
| `AssemblyRegion` | `override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.ViewerSettingsRegion`. |
| `GetAttributeType` | `override Type GetAttributeType()` | Returns `typeof(ImageAttribute)`. |
| `GetAssemblyImage` | `override BitmapImage GetAssemblyImage()` | Returns `AssemblyImage`. |
| `GetAssemblyName` | `override string GetAssemblyName()` | Returns `AssemblyName`. |
| `GetAssemblyGroup` | `override string GetAssemblyGroup()` | Returns `AssemblyGroup`. |
| `GetAssemblyRegion` | `override eAssemblyRegion GetAssemblyRegion()` | Returns `AssemblyRegion`. |
---
## 3. Invariants
- **Module Registration**: `IViewerSettingsView` must always resolve to `ViewerSettingsView`, and `IViewerSettingsViewModel` must always resolve to `ViewerSettingsViewModel` after the module is loaded.
- **Assembly Attributes**: Both `ViewerSettingsModuleNameAttribute` and `ViewerSettingsModuleImageAttribute` are applied at assembly level with `AllowMultiple = false`, ensuring exactly one instance of each per assembly.
- **Region Assignment**: The module is always associated with `eAssemblyRegion.ViewerSettingsRegion`.
- **Group Assignment**: The module always belongs to `eAssemblyGroups.Viewer`.
---
## 4. Dependencies
### This Module Depends On:
- `Prism.Modularity``IModule` interface for module lifecycle.
- `Prism.Ioc``IContainerProvider`, `IContainerRegistry` for DI registration.
- `Unity``IUnityContainer` for Unity-specific DI operations.
- `System.Windows.Media.Imaging``BitmapImage` for module imagery.
- `DTS.Common``AssemblyNames` enum (inferred from usage).
- `DTS.Common.Interface``TextAttribute`, `ImageAttribute` base classes; `eAssemblyGroups`, `eAssemblyRegion` enums; `AssemblyInfo` static class (inferred from usage).
### What Depends On This Module:
- **Main DTS Viewer Application** — Loads this module dynamically via Prism's module catalog; uses the assembly attributes to display the module in available components list and navigate to the appropriate region.
---
## 5. Gotchas
1. **Misleading Singleton Comment**: The comment on line 35 states "Register View & View-Model... as a singleton," but `_unityContainer.RegisterType<TFrom, TTo>()` without an explicit `ContainerControlledLifetimeManager` registers types as **transient**, not singleton. Either the comment is incorrect, or the implementation is missing the lifetime manager.
2. **Non-standard Initialization Pattern**: `Initialize()` is invoked from `RegisterTypes()`, while `OnInitialized()` is empty. The typical Prism pattern is to register types in `RegisterTypes()` and perform post-registration initialization in `OnInitialized()`. This conflation may cause confusion.
3. **Unused Constructor Parameter**: Both attribute classes have constructors accepting a `string s` parameter that is never used. This appears to be a requirement for attribute syntax compatibility, but its purpose is unclear from source alone.
4. **Redundant Image Initialization**: In `ViewerSettingsModuleImageAttribute`, `_img` is assigned in both the constructor and the `AssemblyImage` property getter. The property getter reassigns `_img` on every access, which is redundant after the first call.
5. **Commented-Out Model Registration**: Line 39 contains a commented registration for `IViewerSettingsModel`. It is unclear whether this represents incomplete work, a deprecated pattern, or intentional removal.