6.7 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T11:05:22.275750+00:00 | zai-org/GLM-5-FP8 | 1 | 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:
IViewerSettingsViewmust always resolve toViewerSettingsView, andIViewerSettingsViewModelmust always resolve toViewerSettingsViewModelafter the module is loaded. - Assembly Attributes: Both
ViewerSettingsModuleNameAttributeandViewerSettingsModuleImageAttributeare applied at assembly level withAllowMultiple = 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—IModuleinterface for module lifecycle.Prism.Ioc—IContainerProvider,IContainerRegistryfor DI registration.Unity—IUnityContainerfor Unity-specific DI operations.System.Windows.Media.Imaging—BitmapImagefor module imagery.DTS.Common—AssemblyNamesenum (inferred from usage).DTS.Common.Interface—TextAttribute,ImageAttributebase classes;eAssemblyGroups,eAssemblyRegionenums;AssemblyInfostatic 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
-
Misleading Singleton Comment: The comment on line 35 states "Register View & View-Model... as a singleton," but
_unityContainer.RegisterType<TFrom, TTo>()without an explicitContainerControlledLifetimeManagerregisters types as transient, not singleton. Either the comment is incorrect, or the implementation is missing the lifetime manager. -
Non-standard Initialization Pattern:
Initialize()is invoked fromRegisterTypes(), whileOnInitialized()is empty. The typical Prism pattern is to register types inRegisterTypes()and perform post-registration initialization inOnInitialized(). This conflation may cause confusion. -
Unused Constructor Parameter: Both attribute classes have constructors accepting a
string sparameter that is never used. This appears to be a requirement for attribute syntax compatibility, but its purpose is unclear from source alone. -
Redundant Image Initialization: In
ViewerSettingsModuleImageAttribute,_imgis assigned in both the constructor and theAssemblyImageproperty getter. The property getter reassigns_imgon every access, which is redundant after the first call. -
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.