6.1 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T11:07:35.667287+00:00 | zai-org/GLM-5-FP8 | 1 | b8a48119ee42a5bd |
Documentation: DTS.Viewer.Navigation
1. Purpose
This module serves as the entry point for the Navigation component within 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. Additionally, it defines assembly-level attributes (NavigationPropertiesNameAttribute, NavigationPropertiesImageAttribute) that expose metadata—such as the assembly name, icon, and region assignment—to the broader application, likely for dynamic UI generation or module listing in the main shell.
2. Public Interface
NavigationModule
The main Prism module class responsible for DI registration.
NavigationModule(IUnityContainer unityContainer)- Constructor that accepts an
IUnityContainerinstance via dependency injection and stores it in a private readonly field.
- Constructor that accepts an
void RegisterTypes(IContainerRegistry containerRegistry)- Implements
IModule.RegisterTypes. Calls the privateInitialize()method to perform type registration.
- Implements
void OnInitialized(IContainerProvider containerProvider)- Implements
IModule.OnInitialized. Currently contains an empty implementation block.
- Implements
NavigationPropertiesNameAttribute
An assembly-level attribute extending TextAttribute used to expose the assembly name.
NavigationPropertiesNameAttribute()- Default constructor. Initializes the internal assembly name string.
NavigationPropertiesNameAttribute(string s)- Overloaded constructor accepting a string
s(which appears to be ignored in the implementation).
- Overloaded constructor accepting a string
override string AssemblyName- Property getter returning the string value of
AssemblyNames.Navigation.
- Property getter returning the string value of
override Type GetAttributeType()- Returns
typeof(TextAttribute).
- Returns
override string GetAssemblyName()- Returns the
AssemblyNameproperty value.
- Returns the
NavigationPropertiesImageAttribute
An assembly-level attribute extending ImageAttribute used to expose visual metadata (image, group, region).
NavigationPropertiesImageAttribute()- Default constructor. Initializes the assembly image.
NavigationPropertiesImageAttribute(string s)- Overloaded constructor accepting a string
s(ignored in implementation).
- Overloaded constructor accepting a string
override BitmapImage AssemblyImage- Property getter that retrieves a
BitmapImageviaAssemblyInfo.GetImage.
- Property getter that retrieves a
override string AssemblyName- Returns
AssemblyNames.Navigation.ToString().
- Returns
override string AssemblyGroup- Returns
eAssemblyGroups.Viewer.ToString().
- Returns
override eAssemblyRegion AssemblyRegion- Returns
eAssemblyRegion.NavigationRegion.
- Returns
override BitmapImage GetAssemblyImage()- Returns the
AssemblyImageproperty.
- Returns the
override string GetAssemblyName()- Returns the
AssemblyNameproperty.
- Returns the
override eAssemblyRegion GetAssemblyRegion()- Returns the
AssemblyRegionproperty.
- Returns the
override string GetAssemblyGroup()- Returns the
AssemblyGroupproperty.
- Returns the
3. Invariants
- Module Name: The
NavigationModuleis identified by the string"NavigationProperties"via the[Module]attribute. - Attribute Usage: Both custom attributes are decorated with
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)], ensuring only one instance of each exists per assembly. - Type Registration: The
INavigationViewinterface is always mapped to theNavigationViewclass, andINavigationViewModelis mapped toNavigationViewModel. - Metadata Constants: The
AssemblyNameis strictly derived fromAssemblyNames.Navigation, theAssemblyGroupfromeAssemblyGroups.Viewer, and theAssemblyRegionfromeAssemblyRegion.NavigationRegion.
4. Dependencies
Internal Dependencies (referenced but not defined in source):
DTS.Common: Likely containsAssemblyNames,eAssemblyGroups,eAssemblyRegion, andAssemblyInfo.DTS.Common.Interface: DefinesTextAttribute,ImageAttribute,INavigationView, andINavigationViewModel.DTS.Viewer.Navigation(local namespace): ContainsNavigationViewandNavigationViewModelclasses (referenced but not shown in source).
External Frameworks:
Prism.Ioc,Prism.Modularity: For module definition and DI abstractions.Unity:IUnityContainerfor specific dependency injection implementation.System.Windows.Media.Imaging: ForBitmapImage.
5. Gotchas
- Comment/Code Mismatch (Singleton vs. Transient): The comment in
Initialize()states: "Register View & View-Model ... as a singleton." However, the code uses_unityContainer.RegisterType<...>(). In Unity,RegisterTyperegisters a transient mapping (new instance per resolve) by default. To register as a singleton,ContainerControlledLifetimeManagershould be used. The code does not match the intent described in the comment. - Ignored Constructor Parameters: Both attribute classes possess constructors taking a
string s, but the parameter is never used inside the constructor body. The_assemblyNameor_imgfields are always populated using hardcodedAssemblyNames.Navigationlookups. - Side Effects in Property Getters: The
AssemblyImageproperty getter inNavigationPropertiesImageAttributehas a side effect: it assigns the private field_imgbefore returning it (_img = ...; return _img;). This is non-standard property behavior and could lead to unnecessary object creation if the property is accessed frequently. - Mixed Container Usage: The module uses
IUnityContainer(passed via constructor) to register types insideInitialize, but theRegisterTypesmethod receives anIContainerRegistry. The code bridges this by ignoring theIContainerRegistryparameter and using the stored_unityContainerreference directly.