7.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:45:08.040619+00:00 | zai-org/GLM-5-FP8 | 1 | b8a48119ee42a5bd |
Documentation: DTS.Viewer.Navigation Module
1. Purpose
This module provides navigation functionality for the DTS Viewer application. It is a Prism module (NavigationModule) responsible for registering the navigation view and view-model with the Unity dependency injection container. The module also defines assembly-level metadata attributes (NavigationPropertiesNameAttribute, NavigationPropertiesImageAttribute) that expose the module's name, icon, group, and region information to the main application shell for display and routing purposes.
2. Public Interface
NavigationModule Class
A Prism IModule implementation that handles module initialization and type registration.
| Member | Signature | Description |
|---|---|---|
| Constructor | NavigationModule(IUnityContainer unityContainer) |
Accepts a Unity container via dependency injection and stores it in a private readonly field _unityContainer. |
RegisterTypes |
void RegisterTypes(IContainerRegistry containerRegistry) |
Implements IModule.RegisterTypes. Delegates to Initialize(). |
OnInitialized |
void OnInitialized(IContainerProvider containerProvider) |
Implements IModule.OnInitialized. Currently empty with no implementation. |
Initialize |
void Initialize() |
Registers INavigationView → NavigationView and INavigationViewModel → NavigationViewModel mappings with Unity via RegisterType<TFrom, TTo>(). |
Module Metadata:
- Decorated with
[Module(ModuleName = "NavigationProperties")]
NavigationPropertiesNameAttribute Class
An assembly-level attribute extending TextAttribute that provides the module's display name.
| Member | Signature | Description |
|---|---|---|
| Constructor | NavigationPropertiesNameAttribute() |
Default constructor. Sets _assemblyName to AssemblyNames.Navigation.ToString(). |
| Constructor | NavigationPropertiesNameAttribute(string s) |
Overloaded constructor accepting a string parameter (parameter is unused). |
AssemblyName |
override string AssemblyName { get; } |
Returns _assemblyName (value of AssemblyNames.Navigation.ToString()). |
GetAttributeType |
override Type GetAttributeType() |
Returns typeof(TextAttribute). |
GetAssemblyName |
override string GetAssemblyName() |
Returns AssemblyName property value. |
Attribute Usage: AttributeTargets.Assembly, AllowMultiple = false
NavigationPropertiesImageAttribute Class
An assembly-level attribute extending ImageAttribute that provides the module's icon, name, group, and region metadata.
| Member | Signature | Description |
|---|---|---|
| Constructor | NavigationPropertiesImageAttribute() |
Default constructor. Initializes _img via AssemblyInfo.GetImage(AssemblyNames.Navigation.ToString()). |
| Constructor | NavigationPropertiesImageAttribute(string s) |
Overloaded constructor accepting a string parameter (parameter is unused). |
AssemblyImage |
override BitmapImage AssemblyImage { get; } |
Getter re-assigns _img via AssemblyInfo.GetImage(...) then returns it. |
AssemblyName |
override string AssemblyName { get; } |
Returns AssemblyNames.Navigation.ToString(). |
AssemblyGroup |
override string AssemblyGroup { get; } |
Returns eAssemblyGroups.Viewer.ToString(). |
AssemblyRegion |
override eAssemblyRegion AssemblyRegion { get; } |
Returns eAssemblyRegion.NavigationRegion. |
GetAttributeType |
override Type GetAttributeType() |
Returns typeof(ImageAttribute). |
GetAssemblyImage |
override BitmapImage GetAssemblyImage() |
Returns AssemblyImage property. |
GetAssemblyName |
override string GetAssemblyName() |
Returns AssemblyName property. |
GetAssemblyRegion |
override eAssemblyRegion GetAssemblyRegion() |
Returns AssemblyRegion property. |
GetAssemblyGroup |
override string GetAssemblyGroup() |
Returns AssemblyGroup property. |
Attribute Usage: AttributeTargets.Assembly, AllowMultiple = false
3. Invariants
- The module must be instantiated with a non-null
IUnityContainerreference (constructor injection). NavigationViewandNavigationViewModelmust implementINavigationViewandINavigationViewModelinterfaces respectively (required forRegisterType<,>()calls).- Assembly attributes are applied exactly once per assembly (
AllowMultiple = false). - The enum values
AssemblyNames.Navigation,eAssemblyGroups.Viewer, andeAssemblyRegion.NavigationRegionmust be defined in external assemblies (DTS.Common). - The static method
AssemblyInfo.GetImage(string)must be available and return a validBitmapImage.
4. Dependencies
This Module Depends On:
- Prism.Ioc —
IContainerProvider,IContainerRegistry - Prism.Modularity —
IModule,ModuleAttribute - Unity —
IUnityContainer - System.Windows.Media.Imaging —
BitmapImage - DTS.Common —
AssemblyNames(enum),eAssemblyRegion(enum),eAssemblyGroups(enum),AssemblyInfo(static class withGetImagemethod) - DTS.Common.Interface —
TextAttribute,ImageAttribute(base classes)
What Depends On This Module:
NavigationView— Concrete view class (referenced but not defined in this file)NavigationViewModel— Concrete view-model class (referenced but not defined in this file)INavigationView— Interface (referenced but not defined in this file)INavigationViewModel— Interface (referenced but not defined in this file)- The main application shell (consumes assembly attributes for module discovery and display)
5. Gotchas
-
Misleading Comment: The comment on line 38 states "Register View & View-Model with Unity dependency injection container as a singleton." However,
RegisterType<TFrom, TTo>()registers types as transient, not singleton. To register as singleton,RegisterSingleton<TFrom, TTo>()orRegisterInstance<T>()should be used. -
Unused Constructor Parameters: Both attribute classes have constructors accepting a
string sparameter that is never used. This appears to be dead code, possibly required by attribute syntax conventions or leftover from refactoring. -
Side Effect in Property Getter: The
AssemblyImageproperty getter has a side effect—it reassigns_imgevery time it is called. This is unusual and could cause unnecessary image reloading if the property is accessed multiple times. -
Empty
OnInitializedImplementation: TheOnInitializedmethod is intentionally empty. It is unclear whether this is by design or incomplete implementation. -
Redundant Method Call:
RegisterTypes()simply delegates toInitialize(). While this satisfies the Prism module contract, the separation between these methods serves no functional purpose in this implementation.