5.6 KiB
5.6 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:43:31.988830+00:00 | zai-org/GLM-5-FP8 | 1 | 9f0f5c6b474b7ca8 |
Documentation: DTS.Viewer.ViewerSettings Module
1. Purpose
This module serves as the entry point for the "Viewer Settings" feature within the DTS application. It is responsible for self-registering its View and ViewModel components with the Unity dependency injection container and providing assembly metadata (name, image, grouping, and region) to the broader application infrastructure. It follows the Prism modular architecture to encapsulate viewer configuration logic.
2. Public Interface
ViewerSettingsModule
The main module class implementing Prism.Modularity.IModule.
ViewerSettingsModule(IUnityContainer unityContainer)- Constructor that accepts an
IUnityContainerinstance via dependency injection and stores it in a private readonly field_unityContainer.
- Constructor that accepts an
void RegisterTypes(IContainerRegistry containerRegistry)- Implements
IModule.RegisterTypes. Calls the privateInitialize()method to perform type registrations.
- Implements
void OnInitialized(IContainerProvider containerProvider)- Implements
IModule.OnInitialized. Currently contains no implementation logic.
- Implements
ViewerSettingsModuleNameAttribute
An assembly-level attribute extending TextAttribute used to define the module's name.
ViewerSettingsModuleNameAttribute()- Default constructor.
ViewerSettingsModuleNameAttribute(string s)- Overloaded constructor accepting a string argument (which is unused in the body).
string AssemblyName { get; }- Returns the string representation of
AssemblyNames.ViewerSettings.
- Returns the string representation of
Type GetAttributeType()- Returns
typeof(TextAttribute).
- Returns
string GetAssemblyName()- Returns the
AssemblyNameproperty value.
- Returns the
ViewerSettingsModuleImageAttribute
An assembly-level attribute extending ImageAttribute used to provide visual metadata for the module.
ViewerSettingsModuleImageAttribute()- Default constructor.
ViewerSettingsModuleImageAttribute(string s)- Overloaded constructor accepting a string argument (unused in the body).
BitmapImage AssemblyImage { get; }- Retrieves an image using
AssemblyInfo.GetImage(AssemblyNames.ViewerSettings.ToString()).
- Retrieves an image using
string AssemblyName { get; }- Returns the string representation of
AssemblyNames.ViewerSettings.
- Returns the string representation of
string AssemblyGroup { get; }- Returns
eAssemblyGroups.Viewer.ToString().
- Returns
eAssemblyRegion AssemblyRegion { get; }- Returns
eAssemblyRegion.ViewerSettingsRegion.
- Returns
- Methods:
GetAttributeType(),GetAssemblyImage(),GetAssemblyName(),GetAssemblyGroup(),GetAssemblyRegion()return the values of their respective properties.
3. Invariants
- Registration Mapping: The module registers the interface
IViewerSettingsViewto the concrete typeViewerSettingsViewandIViewerSettingsViewModeltoViewerSettingsViewModel. - Attribute Usage: Both
ViewerSettingsModuleNameAttributeandViewerSettingsModuleImageAttributeare decorated withAttributeUsage(AttributeTargets.Assembly, AllowMultiple = false), ensuring they appear only once per assembly. - Naming Consistency: The
AssemblyNameproperty in both attribute classes is hardcoded to theAssemblyNames.ViewerSettingsenum value. - Region Assignment: The module is explicitly assigned to the
eAssemblyRegion.ViewerSettingsRegion.
4. Dependencies
Internal Dependencies (Inferred from usage)
DTS.Common: Used forAssemblyNames,eAssemblyGroups,eAssemblyRegion, andAssemblyInfo.DTS.Common.Interface: DefinesTextAttribute,ImageAttribute,IViewerSettingsView, andIViewerSettingsViewModel.ViewerSettingsView/ViewerSettingsViewModel: Concrete types referenced inInitialize()(source not provided, assumed to exist in this or a related assembly).
External Libraries
Prism.Ioc: ProvidesIContainerProvider,IContainerRegistry.Prism.Modularity: ProvidesIModule.Unity: ProvidesIUnityContainer(Microsoft.Practices.Unity).System.Windows.Media.Imaging: ProvidesBitmapImage.
5. Gotchas
- Mixed Container Abstractions: The
RegisterTypesmethod receives anIContainerRegistry(Prism abstraction) but ignores it. Instead, it callsInitialize(), which uses the injectedIUnityContainer(concrete Unity implementation) directly. This bypasses Prism's container abstraction, which could cause issues if the container implementation is swapped or if the registry context is required for specific Prism features. - Commented-Out Registration: The line
_unityContainer.RegisterType<IViewerSettingsModel, ViewerSettingsModel>();is commented out. It is unclear if the Model is intentionally excluded, obsolete, or if this is incomplete work. - Unused Constructor Parameters: Both attribute classes (
ViewerSettingsModuleNameAttributeandViewerSettingsModuleImageAttribute) define constructors that accept astring sparameter but never use it. This suggests legacy refactoring or a design pattern where the parameter is ignored. - Property Side-Effects: In
ViewerSettingsModuleImageAttribute, theAssemblyImageproperty getter modifies the private field_img(lazy initialization pattern inside a getter). This is a side-effect that can be confusing during debugging.