10 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T10:59:56.665208+00:00 | zai-org/GLM-5-FP8 | 1 | 24a83d36ea7d74c2 |
PSDReport Module Documentation
1. Purpose
The DTS.Viewer.PSDReport module is a Prism-based plugin module for the DTS Viewer application that provides PSD (Power Spectral Density) report functionality. It implements the IModule interface for modular composition and can operate in both standalone and integrated modes. The module includes custom assembly attributes for metadata discovery, a session management system for bootstrapping Prism infrastructure, and a custom UnityBootstrapper for configuring dependency injection, region adapters, and dynamic module loading.
2. Public Interface
PSDReportModule.cs
Class: PSDReportModule
public PSDReportModule(IUnityContainer unityContainer)
Constructor accepting an IUnityContainer dependency injection.
public void Initialize()
Registers IPSDReportModule to PSDReportModule with ContainerControlledLifetimeManager (singleton lifetime).
public void StartSession()
Resolves IEventAggregator, publishes a LoadViewModulEvent with LoadViewModulArg, and sets SessionStarted to true.
public void RegisterTypes(IContainerRegistry containerRegistry)
Prism module lifecycle method; calls Initialize().
public void OnInitialized(IContainerProvider containerProvider)
Prism module lifecycle method; currently empty implementation.
Property: SessionStarted (read-only)
public bool SessionStarted { get; private set; }
Indicates whether StartSession() has been called.
Class: PSDReportModuleNameAttribute (extends TextAttribute)
public PSDReportModuleNameAttribute()
public PSDReportModuleNameAttribute(string s)
Assembly-level attribute returning AssemblyNames.PSDReport.ToString() for AssemblyName.
public override Type GetAttributeType()
public override string GetAssemblyName()
Class: PSDReportModuleImageAttribute (extends ImageAttribute)
public PSDReportModuleImageAttribute()
public PSDReportModuleImageAttribute(string s)
Assembly-level attribute providing image, name, group, and region metadata.
public override BitmapImage AssemblyImage { get; }
public override string AssemblyName { get; }
public override string AssemblyGroup { get; } // Returns eAssemblyGroups.Viewer.ToString()
public override eAssemblyRegion AssemblyRegion { get; } // Returns eAssemblyRegion.PSDReportRegion
PSDReportSession.cs
Class: PSDReportSession
public PSDReportSession()
Default (empty) constructor.
public void CreateSession(bool standalone, string customConfigPath = "")
Creates the bootstrapper, resolves container services (IUnityContainer, IEventAggregator, IServiceLocator, IRegionManager), loads plugins via PluginManager, and publishes the plugin list via AssemblyListNotificationViewer event.
public void Terminate()
Empty implementation; intended for shutdown scenarios.
Properties:
public IUnityContainer Container { get; private set; }
public IServiceLocator _serviceLocator { get; private set; }
public IEventAggregator _eventAggregator { get; private set; }
public IRegionManager _regionManager { get; private set; }
public string CustomConfigPath { get; set; }
Bootstrapper.cs
Class: Bootstrapper (extends UnityBootstrapper)
public Bootstrapper(bool standalone, string customConfigPath = "")
Constructor accepting standalone mode flag and optional custom config path.
protected override void ConfigureContainer()
Registers IPSDReportMainViewGrid to PSDReportMainViewGrid and IPSDReportMainViewModel to PSDReportMainViewModel (singleton). Calls base.ConfigureContainer().
protected override RegionAdapterMappings ConfigureRegionAdapterMappings()
Registers region adapters for Selector, ItemsControl, ContentControl, and conditionally StackPanel (standalone mode only). Each registration is wrapped in try/catch to handle duplicate mappings.
protected override DependencyObject CreateShell()
Creates the shell by resolving IPSDReportMainViewModel, registering regions dynamically, setting DataContext, and initializing the view model. Returns null on exception.
protected override IModuleCatalog CreateModuleCatalog()
Returns resolved IModuleCatalog or creates new AggregateModuleCatalog.
protected override void ConfigureModuleCatalog()
For standalone mode only: reads plugin folder paths from configuration section DTS.Common.Core.PluginLib.Config and creates a DirectoryModuleCatalog.
protected override void InitializeModules()
For standalone mode only: registers IDTSViewRegionManager to DTSViewRegionManager (singleton) and calls base.InitializeModules().
Properties:
public bool Standalone { get; set; }
public string CustomConfigPath { get; set; }
public IServiceLocator _ServiceLocator { get; private set; }
public IEventAggregator _EventAggregator { get; private set; }
3. Invariants
-
Singleton Registration:
IPSDReportModuleis registered withContainerControlledLifetimeManager, ensuring a single instance per container. -
Session State:
SessionStartedisfalseuntilStartSession()is called; it cannot be reset tofalsethrough the public interface. -
Bootstrapper Creation:
CreateBootstrapper()will not create a new bootstrapper if_bootstrapperis already non-null. -
Standalone Mode Behavior:
ConfigureModuleCatalog()only adds directory catalog whenStandaloneistrue.InitializeModules()only registersIDTSViewRegionManagerwhenStandaloneistrue.StackPanelregion adapter is only registered whenStandaloneistrue.
-
Region Registration: In
CreateShell(), regions are only added if they don't already exist (ContainsRegionWithNamecheck). -
Assembly Attributes: Both
PSDReportModuleNameAttributeandPSDReportModuleImageAttributeare decorated withAllowMultiple = false.
4. Dependencies
This module depends on:
Prism Framework:
Prism.Ioc-IContainerRegistry,IContainerProviderPrism.Modularity-IModule,ModuleAttribute,IModuleCatalogPrism.Events-IEventAggregatorMicrosoft.Practices.Prism.Events-IEventAggregator(legacy)Microsoft.Practices.Prism.Modularity-IModuleCatalog,UnityBootstrapperMicrosoft.Practices.Prism.Regions-IRegionManager,RegionAdapterMappings,Region,RegionManagerMicrosoft.Practices.Prism.UnityExtensions-UnityBootstrapper
Unity DI:
Unity-IUnityContainerUnity.Lifetime-ContainerControlledLifetimeManagerMicrosoft.Practices.Unity-IUnityContainer,InjectionMember
DTS Common Libraries:
DTS.Common-AssemblyNames,AssemblyInfo,eAssemblyGroups,eAssemblyRegionDTS.Common.Events-LoadViewModulEvent,LoadViewModulArg,AssemblyListNotificationViewer,AssemblyListInfoDTS.Common.Interface-IPSDReportModule,IPSDReportMainViewGrid,IPSDReportMainViewModel,IShellViewModel,IDTSViewRegionManagerDTS.Common.Base-TextAttribute,ImageAttributeDTS.Common.Core.PluginLib-PluginManager,PluginConfigSectionHandler,FilterHashElement,DTSViewRegionManager
WPF/.NET:
System.Windows-DependencyObject,DependencyPropertySystem.Windows.Controls-ItemsControl,ContentControl,StackPanelSystem.Windows.Media.Imaging-BitmapImageSystem.Configuration-ConfigurationManagerSystem.ComponentModel.Composition.Hosting- (imported but not directly used in visible code)
What depends on this module:
Not determinable from source alone. The module publishes LoadViewModulEvent and AssemblyListNotificationViewer events, suggesting other components subscribe to these events.
5. Gotchas
-
Dual EventAggregator Imports: The code imports
IEventAggregatorfrom bothPrism.Events(modern) andMicrosoft.Practices.Prism.Events(legacy).PSDReportModuleuses the modern namespace whilePSDReportSessionuses the legacy namespace. This could cause runtime issues if they resolve to different instances. -
Empty Constructor Comment:
PSDReportSessionhas a comment// ReSharper disable EmptyConstructorsuggesting the empty constructor may be intentional but non-obvious. -
Bootstrapper Memory Footprint: The comment in
PSDReportSessionnotes: "It appears that the current bootstrapper loads around 40 MB into memory. To completely unload the bootstrapper would take same research and effort." There is no mechanism to unload or recreate the bootstrapper. -
Silent Failure in CreateShell:
CreateShell()catches all exceptions, stores the message in a local variablesthat is never used, and returnsnull. This silently swallows errors. -
Region Adapter Registration Swallows Errors:
ConfigureRegionAdapterMappings()wraps each registration in try/catch with empty catch blocks, silently ignoring duplicate mapping exceptions. -
Commented-Out Code in ConfigureContainer: There is commented-out code for conditional registration based on
Standalonemode, suggesting the registration strategy changed but the old code was preserved. -
TODO Comment:
PSDReportSession.CreateSession()contains//TODO: review publishPlugins vs base.InitializeModules();indicating incomplete design review. -
Inconsistent Naming Convention: Some private fields use underscore prefix (
_unityContainer,_eventAggregator) while others don't (Container). Public properties mix conventions (_serviceLocatoris public with underscore prefix). -
Unused Imports:
System.Runtime.InteropServices.ComTypesis imported inBootstrapper.csbut theIStreamtype is not used. -
Module Self-Registration:
PSDReportModule.Initialize()registers its own type (IPSDReportModule→PSDReportModule), which is unusual since the module instance already exists whenInitialize()is called.