This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,158 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/PSDReportModule.cs
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/PSDReportSession.cs
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Bootstrapper.cs
generated_at: "2026-04-16T13:38:15.717558+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "24a83d36ea7d74c2"
---
# PSDReport Module Documentation
## 1. Purpose
The `DTS.Viewer.PSDReport` module is a Prism-based modular component within the DTS Viewer application responsible for providing PSD (Power Spectral Density) report visualization functionality. It implements the `IModule` interface from the Prism framework, enabling dynamic loading and lifecycle management. The module manages its own bootstrapping process, plugin loading, and region-based view composition, supporting both standalone operation and integration within a larger host application.
---
## 2. Public Interface
### PSDReportModule Class
**Implements:** `IPSDReportModule`, `IModule`
| Member | Signature | Description |
|--------|-----------|-------------|
| `SessionStarted` | `public bool SessionStarted { get; private set; }` | Property indicating whether a session has been started. Set to `true` after `StartSession()` completes. |
| Constructor | `public PSDReportModule(IUnityContainer unityContainer)` | Constructs the module with an injected Unity container. |
| `Initialize` | `public void Initialize()` | Registers `IPSDReportModule` to `PSDReportModule` with container-controlled lifetime. |
| `StartSession` | `public void StartSession()` | Publishes a `LoadViewModulEvent` with `LoadViewModulArg` and sets `SessionStarted` to `true`. |
| `RegisterTypes` | `public void RegisterTypes(IContainerRegistry containerRegistry)` | Prism module lifecycle method; delegates to `Initialize()`. |
| `OnInitialized` | `public void OnInitialized(IContainerProvider containerProvider)` | Prism module lifecycle method; currently empty implementation. |
### PSDReportSession Class
| Member | Signature | Description |
|--------|-----------|-------------|
| `Container` | `public IUnityContainer Container { get; private set; }` | Exposes the Unity container after session creation. |
| `_serviceLocator` | `public IServiceLocator _serviceLocator { get; private set; }` | Exposes the service locator after session creation. |
| `_eventAggregator` | `public IEventAggregator _eventAggregator { get; private set; }` | Exposes the event aggregator after session creation. |
| `_regionManager` | `public IRegionManager _regionManager { get; private set; }` | Exposes the region manager after session creation. |
| `CustomConfigPath` | `public string CustomConfigPath { get; set; }` | Path to custom configuration file; defaults to empty string. |
| Constructor | `public PSDReportSession()` | Empty constructor. |
| `CreateSession` | `public void CreateSession(bool standalone, string customConfigPath = "")` | Main entry point; creates bootstrapper, resolves core services, loads plugins via `PluginManager`, and publishes `AssemblyListNotificationViewer` event. |
| `Terminate` | `public void Terminate()` | Called during application shutdown; currently empty. |
### Bootstrapper Class
**Inherits:** `UnityBootstrapper`
| Member | Signature | Description |
|--------|-----------|-------------|
| `_ServiceLocator` | `public IServiceLocator _ServiceLocator { get; private set; }` | Resolved service locator instance. |
| `_EventAggregator` | `public IEventAggregator _EventAggregator { get; private set; }` | Resolved event aggregator instance. |
| `Standalone` | `public bool Standalone { get; set; }` | Indicates whether running in standalone mode. |
| `CustomConfigPath` | `public string CustomConfigPath { get; set; }` | Path to custom configuration. |
| Constructor | `public Bootstrapper(bool standalone, string customConfigPath = "")` | Initializes bootstrapper with mode and config path. |
| `ConfigureContainer` | `protected override void ConfigureContainer()` | Registers `IPSDReportMainViewGrid``PSDReportMainViewGrid` and `IPSDReportMainViewModel``PSDReportMainViewModel` (singleton). |
| `ConfigureRegionAdapterMappings` | `protected override RegionAdapterMappings ConfigureRegionAdapterMappings()` | Registers region adapters for `Selector`, `ItemsControl`, `ContentControl`, and conditionally `StackPanel` (standalone mode only). |
| `CreateShell` | `protected override DependencyObject CreateShell()` | Creates the main shell view, registers regions, initializes the view model, and returns the view. |
| `CreateModuleCatalog` | `protected override IModuleCatalog CreateModuleCatalog()` | Returns resolved `IModuleCatalog` or new `AggregateModuleCatalog`. |
| `ConfigureModuleCatalog` | `protected override void ConfigureModuleCatalog()` | In standalone mode, reads plugin folders from config section `DTS.Common.Core.PluginLib.Config` and adds `DirectoryModuleCatalog`. |
| `InitializeModules` | `protected override void InitializeModules()` | In standalone mode, registers `IDTSViewRegionManager``DTSViewRegionManager` (singleton) and calls base. |
### PSDReportModuleNameAttribute Class
**Inherits:** `TextAttribute`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PSDReportModuleNameAttribute()` / `public PSDReportModuleNameAttribute(string s)` | Sets `AssemblyName` to `AssemblyNames.PSDReport.ToString()`. |
| `AssemblyName` | `public override string AssemblyName { get; }` | Returns the PSDReport assembly name. |
| `GetAttributeType` | `public override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
| `GetAssemblyName` | `public override string GetAssemblyName()` | Returns `AssemblyName`. |
### PSDReportModuleImageAttribute Class
**Inherits:** `ImageAttribute`
| Member | Signature | Description |
|--------|-----------|-------------|
| `AssemblyImage` | `public override BitmapImage AssemblyImage { get; }` | Loads image via `AssemblyInfo.GetImage(AssemblyNames.PSDReport.ToString())`. |
| `AssemblyName` | `public override string AssemblyName { get; }` | Returns `AssemblyNames.PSDReport.ToString()`. |
| `AssemblyGroup` | `public override string AssemblyGroup { get; }` | Returns `eAssemblyGroups.Viewer.ToString()`. |
| `AssemblyRegion` | `public override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.PSDReportRegion`. |
| `GetAssemblyImage` | `public override BitmapImage GetAssemblyImage()` | Returns `AssemblyImage`. |
| `GetAssemblyName` | `public override string GetAssemblyName()` | Returns `AssemblyName`. |
| `GetAssemblyGroup` | `public override string GetAssemblyGroup()` | Returns `AssemblyGroup`. |
| `GetAssemblyRegion` | `public override eAssemblyRegion GetAssemblyRegion()` | Returns `AssemblyRegion`. |
---
## 3. Invariants
1. **Single Bootstrapper Instance:** The `_bootstrapper` field in `PSDReportSession` must only be created once. Re-creating it will not re-initialize modules already loaded in the `DirectoryModuleCatalog`.
2. **Container Registration Order:** `Initialize()` must be called (via `RegisterTypes()`) before `StartSession()` to ensure `IPSDReportModule` is registered in the container.
3. **Standalone Mode Behavior:** Several behaviors are conditional on `Standalone` being `true`:
- `StackPanelRegionAdapter` registration
- Module catalog configuration from config file
- `IDTSViewRegionManager` registration
- Shell parent context assignment
4. **Region Registration:** Regions are only added if they do not already exist (`ContainsRegionWithName` check in `CreateShell`).
5. **Assembly Attributes:** Both `PSDReportModuleNameAttribute` and `PSDReportModuleImageAttribute` are applied at assembly level with `AllowMultiple = false`.
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Purpose |
|-----------|---------|
| `Prism.Ioc`, `Prism.Modularity`, `Prism.Events` | Modern Prism framework (modularity, DI, events) |
| `Microsoft.Practices.Prism.Events`, `Microsoft.Practices.Prism.Modularity`, `Microsoft.Practices.Prism.Regions`, `Microsoft.Practices.Prism.UnityExtensions` | Legacy Prism framework (used by `Bootstrapper` and `PSDReportSession`) |
| `Unity`, `Microsoft.Practices.Unity` | Unity IoC container |
| `Microsoft.Practices.ServiceLocation` | Service locator pattern |
| `DTS.Common` | Common utilities (`AssemblyNames`, `AssemblyInfo`) |
| `DTS.Common.Events` | Event definitions (`LoadViewModulEvent`, `LoadViewModulArg`, `AssemblyListNotificationViewer`, `AssemblyListInfo`) |
| `DTS.Common.Interface` | Interfaces (`IPSDReportModule`, `IPSDReportMainViewGrid`, `IPSDReportMainViewModel`, `IShellViewModel`, `IDTSViewRegionManager`) |
| `DTS.Common.Base` | Base types |
| `DTS.Common.Core.PluginLib` | Plugin infrastructure (`PluginManager`, `PluginConfigSectionHandler`, `FilterHashElement`) |
| `System.Windows`, `System.Windows.Controls` | WPF UI framework |
| `System.Configuration` | Configuration management |
| `System.ComponentModel.Composition.Hosting` | MEF composition (for `DirectoryModuleCatalog` in legacy Prism) |
### Internal Dependencies (Inferred)
The following types are referenced but not defined in the provided source:
- `IPSDReportModule` (interface)
- `IPSDReportMainViewGrid`, `PSDReportMainViewGrid`
- `IPSDReportMainViewModel`, `PSDReportMainViewModel`
- `IShellViewModel`
- `IDTSViewRegionManager`, `DTSViewRegionManager`
- `TextAttribute`, `ImageAttribute` (base classes)
- `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion` (enums/utilities)
- `LoadViewModulEvent`, `LoadViewModulArg`, `AssemblyListNotificationViewer`, `AssemblyListInfo` (events)
- `PluginManager`, `PluginConfigSectionHandler`, `FilterHashElement`
---
## 5. Gotchas
1. **Mixed Prism Versions:** The codebase uses both modern Prism namespaces (`Prism.*`) and legacy Prism namespaces (`Microsoft.Practices.Prism.*`). `PSDReportModule` uses modern Prism interfaces (`Prism.Modularity.IModule`), while `Bootstrapper` and `PSDReportSession` use legacy Prism (`UnityBootstrapper`, `Microsoft.Practices.Prism.*`). This suggests an incomplete migration.
2. **Bootstrapper Memory Footprint:** The comment in `PSDReportSession` explicitly warns: *"Do not try to re-create the bootstrapper. Once modules are loaded, they will be be loaded into the DirectoryModuleCatalog and each Module initialization will not be called."* The bootstrapper loads ~40 MB into memory and cannot be fully unloaded without additional effort.
3. **Silent Failures in Region Adapter Registration:** `ConfigureRegionAdapterMappings()` uses empty `try { } catch { }` blocks to suppress exceptions when registering region adapters, potentially hiding configuration issues.
4. **Unconventional Initialization Pattern:** `PSDReportModule.RegisterTypes()` calls `Initialize()`, which registers the module's own type. This is unusual—typically `RegisterTypes` registers dependencies, not the module itself.
5. **Unclear Purpose:** The `PSDReportSession` class has a comment *"I think we need it..."* indicating uncertainty about its necessity.
6. **Exception Swallowing in CreateShell:** The `CreateShell()` method catches all exceptions, stores only the message in a local variable `s`, and returns `null`. This suppresses error details and could make debugging difficult.
7. **Commented-Out Code:** `ConfigureContainer()` contains commented-out registration code for `IPSDReportMainView`, suggesting refactoring in progress or dead code.
8. **Standalone Mode Required for Plugin Loading:** `ConfigureModuleCatalog()` and `InitializeModules()` both early-return if `Standalone` is `false`, meaning plugin discovery from directories only occurs in standalone mode.

View File

@@ -0,0 +1,40 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T13:41:53.575227+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d475bf20384ac0ba"
---
# Documentation for AssemblyInfo.cs
## 1. Purpose
This file provides assembly-level metadata and configuration attributes for the `DTS.Viewer.PSDReport` assembly. It defines the assembly's identity, version information, copyright details, and COM visibility settings. This module exists to embed standard manifest information into the compiled output, allowing the .NET runtime and host applications to identify and version the `DTS.Viewer.PSDReport` component correctly.
## 2. Public Interface
This file does not expose classes or methods in the traditional sense. Instead, it configures the following assembly-level attributes which are exposed via the assembly's manifest:
* **`AssemblyTitle`**: Set to `"DTS.Viewer.PSDReport"`. Specifies the friendly name for the assembly.
* **`AssemblyProduct`**: Set to `"DTS.Viewer.PSDReport"`. Specifies the product name information.
* **`AssemblyCopyright`**: Set to `"Copyright © 2021"`. Specifies copyright information.
* **`AssemblyVersion`**: Set to `"1.0.0.0"`. Specifies the version of the assembly used by the common language runtime.
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`. Specifies the file version number displayed on the file properties dialog.
* **`ComVisible`**: Set to `false`. Indicates that types within this assembly are not visible to COM components by default.
* **`Guid`**: Set to `"3d57ca12-a637-4cdb-b673-d9a5ff0cf062"`. Specifies a unique identifier for the assembly, primarily used if the project is exposed to COM.
## 3. Invariants
* **COM Visibility:** All types within this assembly are explicitly marked as not visible to COM components (`ComVisible(false)`). If a specific type needs to be exposed to COM, that specific type must override this attribute.
* **Version Consistency:** Both the assembly version and the file version are locked to `"1.0.0.0"`.
* **Identity:** The `Guid` attribute guarantees a unique identity for this assembly, which remains constant regardless of build or version changes unless manually updated.
## 4. Dependencies
* **Internal Dependencies:**
* `System.Reflection`: Required for the assembly attributes.
* `System.Runtime.CompilerServices`: Required for compilation support (standard boilerplate).
* `System.Runtime.InteropServices`: Required for the `Guid` and `ComVisible` attributes.
* **External Dependencies:** None identified from this source file alone. The assembly name suggests it is part of a larger "DTS Viewer" solution, but the specific consumers of this assembly cannot be determined from this file.
## 5. Gotchas
* **Empty Metadata:** The `AssemblyDescription`, `AssemblyConfiguration`, `AssemblyCompany`, and `AssemblyTrademark` attributes are initialized with empty strings. This may result in missing metadata in the compiled DLL properties, which can be problematic for automated tooling or corporate governance standards.
* **Static Versioning:** The `AssemblyVersion` and `AssemblyFileVersion` are hardcoded as `"1.0.0.0"`. If the project uses a CI/CD pipeline that expects auto-incrementing versions (e.g., via `1.0.*` syntax or MSBuild tasks), this file overrides that behavior, potentially leading to versioning conflicts during deployment.

View File

@@ -0,0 +1,66 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Resources/TranslateExtension.cs
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T13:41:18.748200+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "01cf0d845cbc5765"
---
# Documentation: DTS.Viewer.PSDReport.Resources
## 1. Purpose
This module provides localization infrastructure for the `DTS.Viewer.PSDReport` namespace. It consists of a strongly-typed resource accessor class (`StringResources`) generated from a `.resx` file, and a XAML markup extension (`TranslateExtension`) that allows UI elements to bind directly to localized strings declaratively. Its role is to centralize string management and support UI globalization within the PSD Report component.
## 2. Public Interface
### `TranslateExtension`
A `MarkupExtension` implementation for use in XAML binding.
* **Constructor**
* `public TranslateExtension(string key)` — Initializes the extension with the resource key to be looked up.
* **Methods**
* `public override object ProvideValue(IServiceProvider serviceProvider)` — Looks up the string resource identified by `_key`. Returns the localized string if found; otherwise, returns an error string.
### `StringResources` (Internal)
A strongly-typed resource class auto-generated by `StronglyTypedResourceBuilder`. It provides static properties to access localized strings.
* **Properties**
* `internal static global::System.Resources.ResourceManager ResourceManager` — Returns the cached `ResourceManager` instance for this assembly.
* `internal static global::System.Globalization.CultureInfo Culture` — Gets or sets the current `CultureInfo` used for resource lookups.
* `internal static string DataHeader` — Looks up a localized string (default: "Data").
* `internal static string DataSelectionHeader` — Looks up a localized string (default: "Data selection").
* `internal static string GraphsDefaultTitle` — Looks up a localized string (default: "Graphs ").
* `internal static string ModificationsHeader` — Looks up a localized string (default: "Modify").
* `internal static string PSDHeader` — Looks up a localized string (default: "PSD").
* `internal static string PSDResultsHeader` — Looks up a localized string (default: "Results").
* `internal static string PSDSettingsHeader` — Looks up a localized string (default: "PSD Settings").
* `internal static string SettingsTitle` — Looks up a localized string (default: "Settings").
* `internal static string TestsDefaultTitle` — Looks up a localized string (default: "Tests ").
## 3. Invariants
* **Error Handling:** `TranslateExtension.ProvideValue` will never return `null`. It guarantees a string return, either the resource value or a specific error constant.
* **Error Format:** If a resource key is not found, the return value follows the format `#stringnotfound# [key]`.
* **Empty Key:** If `TranslateExtension` is initialized with a `null` or empty `key`, `ProvideValue` returns exactly `#stringnotfound#` (without the key appended).
* **Resource Manager:** `StringResources.ResourceManager` uses a lazy initialization pattern (singleton) and is thread-safe regarding the initial check (via `ReferenceEquals` check).
* **Code Generation:** `StringResources` is marked `internal` and is auto-generated; manual modifications to the designer file will be overwritten by tooling.
## 4. Dependencies
### Imports (This module depends on)
* `System` (Core runtime)
* `System.Windows.Markup` (For `MarkupExtension` and `IServiceProvider` — implies a dependency on WPF core assemblies)
* `System.Resources` (For `ResourceManager`)
* `System.Globalization` (For `CultureInfo`)
* `System.CodeDom.Compiler`, `System.Diagnostics`, `System.ComponentModel` (Used for attributes on the designer class)
### Consumers (What depends on this)
* **XAML Files:** Any XAML views within the `DTS.Viewer.PSDReport` namespace (or referencing it) that use the `{local:Translate KeyName}` syntax.
* **C# Logic:** Any code-behind within the `DTS.Viewer.PSDReport` assembly that accesses `StringResources` properties directly (e.g., `StringResources.PSDHeader`).
## 5. Gotchas
* **Silent Failure Mode:** The `TranslateExtension` does not throw exceptions for missing keys. Instead, it renders `#stringnotfound#` into the UI. Developers must visually inspect the UI or write specific tests to detect missing translations.
* **Designer File Editing:** `StringResources.Designer.cs` is auto-generated. To add or modify strings, the underlying `.resx` file must be edited, and the project regenerated. Direct edits to this file will be lost.
* **Trailing Spaces:** The default values for `GraphsDefaultTitle` ("Graphs ") and `TestsDefaultTitle` ("Tests ") contain trailing spaces. This may be intentional for UI padding but could cause issues if trimmed or compared strictly.
* **Internal Visibility:** `StringResources` is `internal`. External assemblies cannot access the resource properties directly; they must rely on the `TranslateExtension` (if the XAML context allows) or the `ResourceManager` property if exposed.

View File

@@ -0,0 +1,79 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/View/PSDReportMainView.xaml.cs
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/View/PSDReportMainViewGrid.xaml.cs
generated_at: "2026-04-16T13:41:50.267646+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7e23a726984c27b1"
---
# Documentation: DTS.Viewer.PSDReport Views
## 1. Purpose
This module provides WPF view components for the PSD (Particle Size Distribution) Report feature within the DTS Viewer application. It contains two partial classes: `PSDReportMainView`, which serves as a shell view implementing `IPSDReportMainView`, and `PSDReportMainViewGrid`, a grid-based view implementing `IPSDReportMainViewGrid` that manages chart tab focus after graph loading completes via event-driven coordination with the application's event aggregator.
---
## 2. Public Interface
### PSDReportMainView (implements `IPSDReportMainView`)
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PSDReportMainView()` | Initializes the XAML component. Event handlers for `Loaded`/`Unloaded` are commented out. |
### PSDReportMainViewGrid (implements `IPSDReportMainViewGrid`)
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PSDReportMainViewGrid()` | Initializes the XAML component and subscribes to the `Loaded` routed event. |
| `_eventAggregator` | `private IEventAggregator` | Backing field for the Prism event aggregator, resolved at runtime. |
| `SetFocus` | `private void SetFocus()` | Sets `chartResultsTab` as selected, focusable, and focuses it. |
| `PSDReportMainViewGrid_Loaded` | `private void PSDReportMainViewGrid_Loaded(object sender, RoutedEventArgs e)` | Resolves `IEventAggregator` from `ContainerLocator.Container` and subscribes to `GraphLoadedCountNotification`. |
| `OnGraphLoadedCountNotification` | `private void OnGraphLoadedCountNotification(GraphLoadedCountNotificationArg arg)` | Handles the graph loaded notification; validates `DataContext` matches `arg.ParentVM`, then waits 3 seconds before invoking `SetFocus()` on the UI thread. |
---
## 3. Invariants
- **Event Aggregator Availability**: `_eventAggregator` is resolved in the `Loaded` event handler, ensuring the `ContainerLocator.Container` is initialized before resolution.
- **DataContext Type**: The `DataContext` of `PSDReportMainViewGrid` must be castable to `IBaseViewModel` for the notification filtering logic to function correctly.
- **Parent VM Matching**: Focus is only set when `arg.ParentVM` matches the view's `DataContext` (cast as `IBaseViewModel`), preventing cross-view interference.
- **UI Thread Marshaling**: `Dispatcher.BeginInvoke` is used to marshal the `SetFocus()` call back to the UI thread from the `Task.Run` background context.
---
## 4. Dependencies
### This module depends on:
| Namespace | Usage |
|-----------|-------|
| `DTS.Common.Interface` | `IPSDReportMainView`, `IPSDReportMainViewGrid`, `IBaseViewModel` interfaces |
| `DTS.Common.Base` | Base types (exact types unclear from source alone) |
| `DTS.Common.Events` | `GraphLoadedCountNotification` event, `GraphLoadedCountNotificationArg` argument class |
| `Prism.Ioc` | `ContainerLocator` for service resolution |
| `Prism.Events` | `IEventAggregator` for pub/sub messaging |
| `System` | `Action` delegate |
| `System.Threading` | `Thread.Sleep` |
| `System.Threading.Tasks` | `Task.Run` |
### What depends on this module:
- Consumers of `IPSDReportMainView` and `IPSDReportMainViewGrid` interfaces (exact consumers unclear from source alone).
- XAML files `PSDReportMainView.xaml` and `PSDReportMainViewGrid.xaml` (code-behind relationship).
---
## 5. Gotchas
1. **Hardcoded 3-Second Delay**: `OnGraphLoadedCountNotification` uses `Thread.Sleep(TimeSpan.FromSeconds(3))` to wait for graph rendering. This is a magic number with no configuration or cancellation token, making it brittle if graph rendering time varies.
2. **Commented-Out AvalonDock Serialization**: `PSDReportMainView` contains fully commented-out code for layout serialization/deserialization using `XmlLayoutSerializer` and a `DockManager` element. This suggests either incomplete implementation or intentional removal that was preserved in comments.
3. **Event Subscription Timing**: Per the comment "FB 14797", event subscription is deliberately deferred to the `Loaded` event to ensure `IEventAggregator` availability. This is a workaround for container initialization ordering.
4. **Null-Conditional Pattern**: `_eventAggregator?.GetEvent<...>()` uses null-conditional operator, meaning if the container resolution fails, the subscription silently does nothing.
5. **Multiple ReSharper Suppressions**: The file `PSDReportMainView.xaml.cs` has extensive ReSharper suppressions including `PossibleNullReferenceException`, indicating potential null safety concerns were suppressed rather than handled.

View File

@@ -0,0 +1,93 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/ViewModel/PSDReportMainViewModel.cs
generated_at: "2026-04-16T13:41:19.428606+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "280cd655454826b4"
---
# Documentation: PSDReportMainViewModel.cs
## 1. Purpose
The `PSDReportMainViewModel` class serves as the primary view model (controller) for the PSD (Power Spectral Density) Report module within the DTS Viewer application. It orchestrates the layout and lifecycle of multiple child views (graphs, tests, settings, navigation) by managing navigation regions and mediating communication via an event aggregator. This class is responsible for handling user interactions such as file selection, calibration settings, and zoom controls, while maintaining the state of the busy indicator and UI titles based on data loading events.
## 2. Public Interface
### Constructor
* `PSDReportMainViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`
* Initializes the view model, creates interaction requests (`NotificationRequest`, `ConfirmationRequest`), resolves the main view (`IPSDReportMainViewGrid`) via the Unity container, and sets the DataContext.
### Properties
* `IBaseView View { get; set; }`: Gets or sets the associated view.
* `InteractionRequest<Notification> NotificationRequest { get; }`: Request object for triggering notifications.
* `InteractionRequest<Confirmation> ConfirmationRequest { get; }`: Request object for triggering confirmation dialogs.
* **Region Context Properties** (Manage content of specific regions on the View):
* `object ContextNavigationRegion`: Maps to `NavigationRegion`.
* `object ContextGraphsRegion`: Maps to `GraphListRegion`.
* `object ContextGraphListRegion`: Maps to `GraphListRegion`.
* `object ContextTestsRegion`: Maps to `TestsRegion`.
* `object ContextLegendRegion`: Maps to `LegendRegion`.
* `object ContextPropertyRegion`: Standalone property (logic not fully visible).
* `object ContextChartOptionsRegion`: Maps to `ChartOptionsRegion`.
* `object ContextViewerSettingsRegion`: Maps to `SettingsRegion`.
* `object ContextReportDataSelectRegion`: Maps to `DataSelectRegion`.
* `object ContextGraphRegion`: Maps to `GraphRegion`.
* `object ContextReportChartOptionsRegion`: Maps to `ReportChartOptionsRegion`.
* `object ContextReportResultsRegion`: Maps to `ReportResultsRegion`.
* `string ConfigPath { get; set; }`: Throws `NotImplementedException`.
* `string TitleTests { get; set; }`: Title for the Tests section.
* `int TotalSelectedTests { get; set; }`: Count of selected tests; updates `TitleTests`.
* `int TotalLoadedTests { get; set; }`: Count of loaded tests; updates `TitleTests`.
* `string TitleGraphs { get; set; }`: Title for the Graphs section.
* `int TotalSelectedGraphs { get; set; }`: Count of selected graphs; updates `TitleGraphs`.
* `int TotalLoadedGraphs { get; set; }`: Count of loaded graphs; updates `TitleGraphs`.
* `string SelectedDataFolder { get; set; }`: Sets the data folder and publishes `DataFolderChangedEvent`.
* `string SelectedDataFile { get; set; }`: Sets the data file and publishes `DataFolderChangedEvent`.
* `IsoViewMode ChannelCodeViewMode { get; set; }`: Gets/sets channel code view mode; publishes `ChannelCodesViewChangedEvent`.
* `CalibrationBehaviors CalibrationBehaviorSetting { get; set; }`: Gets/sets calibration behavior; publishes `CalibrationBehaviorSettingChangedEvent`.
* `bool CalibrationBehaviorSettableInViewer { get; set; }`: Determines if calibration is settable; publishes event and forces tab selection logic.
* `Visibility SettingsVisibility { get; }`: Controls visibility of settings.
* `bool IsBusy { get; set; }`: Controls busy indicator visibility.
* `string IsBusyMessage { get; set; }`: Text displayed when busy.
* `bool IsMenuIncluded { get; set; }`: Inherited behavior flag.
* `bool IsNavigationIncluded { get; set; }`: Inherited behavior flag.
* `bool IsDirty { get; }`: Throws `NotImplementedException`.
### Methods
* `List<FrameworkElement> GetRegions()`: Retrieves child elements named "Region" from the `MainShell`.
* `void Initialize()`: Calls `Subscribe()` to register event listeners.
* `void Initialize(object parameter)`: Sets the `Parent` window model and calls `Subscribe()`.
* `void LeftKeyPress()`: Throws `NotImplementedException`.
* `void RightKeyPress()`: Throws `NotImplementedException`.
* `void ZoomReset()`: Publishes `ResetZoomChangedEvent` to reset zoom levels.
* `void SelectAndIncludeDataFile(string value)`: Sets the selected data file and publishes a `DataFolderChangedEvent` with `SetSelected` flag.
## 3. Invariants
* **View Type Constraint**: The `View` property must resolve to a `PSDReportMainViewGrid` type (or compatible type) because the region properties explicitly cast `View` to `PSDReportMainViewGrid` to access named UI elements (e.g., `NavigationRegion`, `GraphListRegion`).
* **Parent Type**: The `Initialize(object parameter)` method expects `parameter` to be castable to `IBaseWindowModel`.
* **Event Aggregator Presence**: The class relies heavily on `IEventAggregator` being injected; it will fail to function (specifically in property setters) if `_eventAggregator` is null.
* **Setter Guards**: Properties `SelectedDataFolder` and `SelectedDataFile` will return without action if the value is null or empty.
## 4. Dependencies
### Internal Dependencies (Inferred from imports)
* `DTS.Common.Base`: `BaseViewModel`, `IBaseView`, `IBaseViewModel`, `IBaseWindowModel`.
* `DTS.Common.Enums`: `IsoViewMode`, `CalibrationBehaviors`.
* `DTS.Common.Events`: `DataFolderChangedEvent`, `LoadViewModulEvent`, `ChannelCodesViewChangedEvent`, `CalibrationBehaviorSettingChangedEvent`, `ResetZoomChangedEvent`, etc.
* `DTS.Common.Interface`: `IPSDReportMainViewModel`, `IGraphView`, `IChartOptionsView`, etc.
* `DTS.Common.Utils`: `Utils` class (used for `GetChildrenByName`).
* `DTS.Common.Interactivity`: `InteractionRequest`, `Notification`, `Confirmation`.
* `DTS.Viewer.PSDReport.Resources`: `StringResources`.
### External Dependencies
* **Prism**: `IEventAggregator`, `IRegionManager` (Event driving and navigation).
* **Unity**: `IUnityContainer` (Dependency injection and view resolution).
* **System.Windows**: WPF UI components (`FrameworkElement`, `Visibility`).
## 5. Gotchas
* **MVVM Violation in Properties**: The region properties (e.g., `ContextNavigationRegion`) directly access and cast the View to `PSDReportMainViewGrid` to manipulate UI elements (`Content` properties). This creates a tight coupling between the ViewModel and the specific View implementation, violating standard MVVM principles.
* **Duplicate Region Logic**: `ContextGraphsRegion` and `ContextGraphListRegion` both access `((PSDReportMainViewGrid)View).GraphListRegion.Content`. This appears to be a copy-paste error where `ContextGraphsRegion` should likely target a different region.
* **Member Hiding**: The class uses the `new` keyword to hide base members (e.g., `IsBusy`, `IsBusyMessage`, `ConfirmationRequest`, `OnPropertyChanged`). This can lead to unexpected behavior if the object is accessed via a base class reference, as the base implementation will be called instead of the derived one.
* **Not Implemented Features**: Several public members throw `NotImplementedException` (`ConfigPath`, `IsDirty`, `LeftKeyPress`, `RightKeyPress`). These should not be relied upon in production code.
* **Direct Tab Manipulation**: The setter for `CalibrationBehaviorSettableInViewer` directly manipulates the `IsSelected` and `Focusable` properties of UI tabs (`graphsTab`, `testsTab`, `chartResultsTab`) found on the View. This logic references bug fix IDs (FB13946, FB14797) and implies fragile UI logic embedded in the ViewModel.

View File

@@ -0,0 +1,93 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/PSDReportResultsModule.cs
generated_at: "2026-04-16T13:37:15.973434+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1cb458d29a5aed08"
---
# PSDReportResultsModule Documentation
## 1. Purpose
This module serves as the Prism module definition for the PSD Report Results feature within the DTS Viewer application. It is responsible for registering the view and view model components (`IPSDReportResultsView` and `IPSDReportResultsViewModel`) with the Unity dependency injection container, and providing assembly-level metadata (name, image, group, and region) that the main application uses to discover and display this module as an available component.
## 2. Public Interface
### PSDReportResultsModule
**Signature:** `public class PSDReportResultsModule : IModule`
The main module class implementing Prism's `IModule` interface.
| Method | Signature | Description |
|--------|-----------|-------------|
| Constructor | `PSDReportResultsModule(IUnityContainer unityContainer)` | Accepts an injected `IUnityContainer` instance and stores it in `_unityContainer`. |
| Initialize | `public void Initialize()` | Registers `IPSDReportResultsViewModel``PSDReportResultsViewModel` and `IPSDReportResultsView``PSDReportResultsView` with the Unity container. |
| OnInitialized | `public void OnInitialized(IContainerProvider containerProvider)` | Empty implementation; no initialization logic executed. |
| RegisterTypes | `public void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()` for type registration. |
### PSDReportResultsModuleNameAttribute
**Signature:** `public class PSDReportResultsModuleNameAttribute : TextAttribute`
Assembly attribute providing the module's name.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `PSDReportResultsModuleNameAttribute()` | Default constructor. |
| Constructor | `PSDReportResultsModuleNameAttribute(string s)` | Overloaded constructor; the string parameter is not used. |
| AssemblyName | `public override string AssemblyName { get; }` | Returns `AssemblyNames.PSDReportResults.ToString()`. |
| GetAttributeType | `public override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
| GetAssemblyName | `public override string GetAssemblyName()` | Returns the `AssemblyName` property value. |
### PSDReportResultsModuleImageAttribute
**Signature:** `public class PSDReportResultsModuleImageAttribute : ImageAttribute`
Assembly attribute providing the module's image, name, group, and region for UI display.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `PSDReportResultsModuleImageAttribute()` | Default constructor. |
| Constructor | `PSDReportResultsModuleImageAttribute(string s)` | Overloaded constructor; the string parameter is not used. |
| AssemblyImage | `public override BitmapImage AssemblyImage { get; }` | Lazy-loads image via `AssemblyInfo.GetImage(AssemblyNames.PSDReportResults.ToString())`. |
| AssemblyName | `public override string AssemblyName { get; }` | Returns `AssemblyNames.PSDReportResults.ToString()`. |
| AssemblyGroup | `public override string AssemblyGroup { get; }` | Returns `eAssemblyGroups.Viewer.ToString()`. |
| AssemblyRegion | `public override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.PSDReportResultsRegion`. |
| GetAttributeType | `public override Type GetAttributeType()` | Returns `typeof(ImageAttribute)`. |
| GetAssemblyImage | `public override BitmapImage GetAssemblyImage()` | Returns `AssemblyImage`. |
| GetAssemblyName | `public override string GetAssemblyName()` | Returns `AssemblyName`. |
| GetAssemblyGroup | `public override string GetAssemblyGroup()` | Returns `AssemblyGroup`. |
| GetAssemblyRegion | `public override eAssemblyRegion GetAssemblyRegion()` | Returns `AssemblyRegion`. |
## 3. Invariants
- The module is decorated with `[Module(ModuleName = "PSDReportResults")]` and must be loaded by Prism's module system.
- Both assembly attributes are applied at assembly level with `AllowMultiple = false`, ensuring only one instance of each attribute exists per assembly.
- `AssemblyName` properties in both attribute classes always return the string representation of `AssemblyNames.PSDReportResults`.
- `AssemblyGroup` always returns `eAssemblyGroups.Viewer.ToString()`.
- `AssemblyRegion` always returns `eAssemblyRegion.PSDReportResultsRegion`.
- Type registrations for `IPSDReportResultsViewModel` and `IPSDReportResultsView` are required for the module to function.
## 4. Dependencies
### This module depends on:
- **Prism.Ioc** - `IContainerProvider`, `IContainerRegistry`
- **Prism.Modularity** - `IModule`, `ModuleAttribute`
- **Unity** - `IUnityContainer`
- **System.Windows.Media.Imaging** - `BitmapImage`
- **DTS.Common** - `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`
- **DTS.Common.Interface** - `TextAttribute`, `ImageAttribute`
- **Local types** (not shown in source but referenced): `PSDReportResultsViewModel`, `PSDReportResultsView`, `IPSDReportResultsViewModel`, `IPSDReportResultsView`
### What depends on this module:
- The main DTS Viewer application shell (inferred from module pattern and `eAssemblyGroups.Viewer` group assignment)
## 5. Gotchas
1. **Mixed container usage in RegisterTypes**: The `RegisterTypes(IContainerRegistry containerRegistry)` method receives an `IContainerRegistry` parameter but ignores it entirely, instead calling `Initialize()` which uses the injected `IUnityContainer` directly. This bypasses Prism's container abstraction layer.
2. **Unused constructor parameters**: Both attribute classes have constructors accepting a `string s` parameter that is completely ignored. The reason for this design pattern is unclear from the source alone.
3. **Redundant image initialization**: In `PSDReportResultsModuleImageAttribute`, the `_img` field is set both in the constructor and in the `AssemblyImage` property getter. The property getter unconditionally reassigns `_img` on every access, which could cause unnecessary image reloading.
4. **Empty OnInitialized**: The `OnInitialized` method is explicitly implemented but empty. It is unclear whether this is intentional or represents incomplete initialization logic.

View File

@@ -0,0 +1,53 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T13:40:09.689440+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a578e8bbaedafe8e"
---
# Documentation: DTS.Viewer.PSDReportResults Assembly Configuration
## 1. Purpose
This file provides assembly-level metadata and configuration attributes for the `DTS.Viewer.PSDReportResults` component within the DTS Viewer application. It exists to embed standard identifying information—such as title, version, and copyright—into the compiled assembly manifest, and to configure COM interoperability settings. It serves as the identity definition for this specific DLL or executable within the larger system.
## 2. Public Interface
This source file does not define any public classes, methods, or functions. It strictly defines assembly-level attributes via the `assembly` keyword.
**Defined Attributes:**
* **`AssemblyTitle`**: Set to `"DTS.Viewer.PSDReportResults"`. Provides a friendly name for the assembly.
* **`AssemblyDescription`**: Set to an empty string.
* **`AssemblyConfiguration`**: Set to an empty string.
* **`AssemblyCompany`**: Set to an empty string.
* **`AssemblyProduct`**: Set to `"DTS.Viewer.PSDReportResults"`.
* **`AssemblyCopyright`**: Set to `"Copyright © 2022"`.
* **`AssemblyTrademark`**: Set to an empty string.
* **`AssemblyCulture`**: Set to an empty string. Indicates the assembly is culture-neutral.
* **`ComVisible`**: Set to `false`. Makes types in this assembly invisible to COM components.
* **`Guid`**: Set to `"486af003-0dec-4b05-a7a5-39e6ca9ec629"`. A unique identifier for the assembly's type library if exposed to COM.
* **`AssemblyVersion`**: Set to `"1.0.0.0"`. Defines the version of the assembly.
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`. Defines the file version stored in the Win32 file version resource.
## 3. Invariants
* **Version Consistency:** Both `AssemblyVersion` and `AssemblyFileVersion` are explicitly defined and must match the format `"1.0.0.0"`.
* **COM Visibility:** `ComVisible` is explicitly `false`. Types within this assembly are not intended to be accessed by unmanaged COM code unless specifically overridden on individual types.
* **Culture Neutrality:** The `AssemblyCulture` attribute is empty, enforcing that this is a culture-neutral assembly (not a satellite assembly).
## 4. Dependencies
**Imports (Internal):**
* `System.Reflection`
* `System.Runtime.CompilerServices`
* `System.Runtime.InteropServices`
**External Dependencies:**
None inferred from this file; it relies solely on standard .NET Framework libraries.
**Dependents:**
The compiled assembly `DTS.Viewer.PSDReportResults` is a dependency of the broader `DTS Viewer` application, but specific consumers cannot be determined from this file alone.
## 5. Gotchas
* **Hardcoded Version:** The version numbers (`1.0.0.0`) are hardcoded strings. If the project uses CI/CD pipelines to auto-increment versions, this file may need to be updated automatically or ignored in favor of project-level settings (in SDK-style projects).
* **Missing Metadata:** `AssemblyDescription` and `AssemblyCompany` are empty strings. This may result in sparse metadata when viewing the file properties in Windows Explorer or reflection tools.
* **Legacy Structure:** The presence of an explicit `AssemblyInfo.cs` suggests a traditional .NET Framework project structure. Modern SDK-style projects typically auto-generate this content, which can lead to build conflicts (CS0579) if the project file is updated to SDK-style without removing or disabling this file.

View File

@@ -0,0 +1,73 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/Resources/TranslateExtension.cs
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T13:40:10.219585+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "154eee0c947eb6d0"
---
# Documentation: DTS.Viewer.PSDReportResults.Resources
## 1. Purpose
This module provides localization infrastructure for the PSD Report Results viewer within the DTS application. It bridges the gap between XAML UI definitions and localized string resources via a custom `TranslateExtension` markup extension. It allows developers to bind UI elements to resource keys declaratively, while relying on the auto-generated `StringResources` class to perform culture-aware string lookups for report-specific terminology such as "Channel Name," "Sample Rate," and export options.
## 2. Public Interface
### Class: `TranslateExtension`
**Namespace:** `DTS.Viewer.PSDReportResults`
**Inheritance:** `System.Windows.Markup.MarkupExtension`
This class is a XAML markup extension used to look up localized strings at runtime.
* **Constructor**
* `public TranslateExtension(string key)`: Initializes the extension with the resource key to be translated. The key is stored in a private readonly field `_key`.
* **Methods**
* `public override object ProvideValue(IServiceProvider serviceProvider)`: Returns the localized string corresponding to the `_key`.
* If `_key` is null or empty, it returns the constant `"#stringnotfound#"`.
* If the key is valid but no resource is found, it returns `"#stringnotfound# "` appended with the `_key`.
### Class: `StringResources`
**Namespace:** `DTS.Viewer.PSDReportResults.Resources`
**Accessibility:** `internal`
A strongly-typed resource class auto-generated by Visual Studio/ResGen. It provides access to localized strings defined in the corresponding `.resx` file.
* **Properties**
* `internal static global::System.Resources.ResourceManager ResourceManager`: Returns the cached `ResourceManager` instance responsible for looking up resources. The resource base name is `"DTS.Viewer.PSDReportResults.Resources.StringResources"`.
* `internal static global::System.Globalization.CultureInfo Culture`: Gets or sets the current `CultureInfo` used for resource lookups.
* `internal static string ChannelName`: Looks up a localized string (default: "Name").
* `internal static string ExportPSDHeader`: Looks up a localized string (default: "Export").
* `internal static string ExportPSDtoCSV`: Looks up a localized string (default: "Export PSD to CSV").
* `internal static string ExportPSDtoPDF`: Looks up a localized string (default: "Export PSD to PDF").
* `internal static string GRMS`: Looks up a localized string (default: "GRMS").
* `internal static string PSDResultsHeader`: Looks up a localized string (default: "Results").
* `internal static string SampleRate`: Looks up a localized string (default: "Sample Rate").
## 3. Invariants
1. **Return Type Guarantee:** The `TranslateExtension` class is decorated with `[MarkupExtensionReturnType(typeof(string))]`, guaranteeing that `ProvideValue` returns a `string` (despite the method signature returning `object`).
2. **Non-Null Return:** `TranslateExtension.ProvideValue` never returns null. It guarantees a string return, falling back to error indicators if the key is missing or empty.
3. **Resource Manager Singleton:** The `ResourceManager` property in `StringResources` implements a lazy-loading singleton pattern; it will only instantiate the `ResourceManager` once.
4. **Auto-Generated Constraint:** `StringResources` is marked with `DebuggerNonUserCodeAttribute` and `CompilerGeneratedAttribute`, indicating it should not be manually edited and must be regenerated when the `.resx` source changes.
## 4. Dependencies
* **Internal Dependencies:**
* `TranslateExtension` depends directly on `StringResources.ResourceManager` to perform lookups.
* **External Dependencies:**
* `System.Windows.Markup`: Required for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute` (implies this is a WPF or related XAML-based UI project).
* `System.Resources`: Required for `ResourceManager`.
* `System.Globalization`: Required for `CultureInfo`.
* **Dependents:**
* XAML files within the `DTS.Viewer.PSDReportResults` assembly are the intended consumers of `TranslateExtension`.
## 5. Gotchas
1. **Differentiated Error States:** The `ProvideValue` method handles errors differently depending on the cause.
* A null/empty key returns exactly `"#stringnotfound#"`.
* A valid key that is missing from resources returns `"#stringnotfound# "` (note the trailing space) followed by the key name. Developers parsing logs or UI output should be aware of this format difference.
2. **Internal Visibility:** The `StringResources` class is `internal`. It cannot be accessed directly from outside the `DTS.Viewer.PSDReportResults` assembly. External assemblies must rely on the `TranslateExtension` (if public) or other public wrappers to access these strings.
3. **Hardcoded Fallback Strings:** The error strings `"#stringnotfound#"` are hardcoded in `TranslateExtension.cs`. They are not localized themselves (i.e., if the system language changes, these error messages remain in English/code-form).

View File

@@ -0,0 +1,59 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/View/PSDReportResultsView.xaml.cs
generated_at: "2026-04-16T13:40:29.354621+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7dcd71bef7b7c279"
---
# Documentation: PSDReportResultsView
## 1. Purpose
This module provides a WPF view component for displaying PSD (Particle Size Distribution) report results within the DTS Viewer application. It implements the `IPSDReportResultsView` interface and serves as the presentation layer for report data, offering a grid-based UI with column header interaction and search capabilities. The view is designed to be a partial class paired with a XAML definition file.
---
## 2. Public Interface
### Class: `PSDReportResultsView`
**Implements:** `IPSDReportResultsView`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PSDReportResultsView()` | Initializes a new instance of the view and calls `InitializeComponent()` to load the associated XAML. |
| Event Handler | `private void GridViewColumnHeader_OnClick(object sender, System.Windows.RoutedEventArgs e)` | Handles click events on GridView column headers. **Currently has no implementation.** |
| Event Handler | `private void GridViewColumnHeaderSearchable_OnSearch(object sender, System.Windows.RoutedEventArgs e)` | Handles search events raised by searchable column headers. **Currently has no implementation.** |
---
## 3. Invariants
- The class is declared `partial`, requiring a corresponding XAML file (`PSDReportResultsView.xaml`) to define the UI structure.
- `InitializeComponent()` must be called in the constructor; this method is auto-generated from the XAML at build time.
- The class must implement `IPSDReportResultsView` to satisfy the interface contract defined in `DTS.Common.Interface`.
---
## 4. Dependencies
### This Module Depends On:
- `DTS.Common.Interface` — Provides the `IPSDReportResultsView` interface that this view implements.
- `System.Windows` (inferred from `System.Windows.RoutedEventArgs`) — WPF framework for UI event handling.
### What Depends On This Module:
- **Cannot be determined from source alone.** Consumers of `IPSDReportResultsView` or this specific view would be defined elsewhere in the codebase (likely a presenter, view model, or navigation service).
---
## 5. Gotchas
1. **Empty Event Handlers:** Both `GridViewColumnHeader_OnClick` and `GridViewColumnHeaderSearchable_OnSearch` have empty bodies. This suggests either:
- The functionality is not yet implemented (work in progress).
- The logic has been moved elsewhere (e.g., MVVM bindings in the XAML or a code-behind that was refactored).
2. **Missing XAML File:** The actual UI layout, column definitions, and event bindings are defined in `PSDReportResultsView.xaml`, which is not included here. The behavior of the view cannot be fully understood without it.
3. **Interface Contract Unknown:** The members required by `IPSDReportResultsView` are not visible in this source file. It is unclear whether this view fully satisfies the interface or if additional members exist in another partial class file.

View File

@@ -0,0 +1,99 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/ViewModel/PSDReportResultsViewModel.cs
generated_at: "2026-04-16T13:39:37.629543+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7cb2cb6c499c73c1"
---
# Documentation: PSDReportResultsViewModel.cs
## 1. Purpose
`PSDReportResultsViewModel` is a Prism-based ViewModel responsible for displaying PSD (Power Spectral Density) report results, specifically GRMS (G-RMS) summary data for channels. It serves as a child view model that receives data via event aggregation from a parent view model, maintains an observable collection of results for UI binding, and provides user-initiated export functionality to PDF and CSV formats.
---
## 2. Public Interface
### Class: `PSDReportResultsViewModel`
**Inheritance:** `BaseViewModel<IPSDReportResultsViewModel>`
**Implements:** `IPSDReportResultsViewModel`
### Constructor
```csharp
public PSDReportResultsViewModel(
IPSDReportSettingsView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Initializes the view model, sets the View's DataContext to itself, and creates `NotificationRequest` and `ConfirmationRequest` instances.
### Properties
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `View` | `IBaseView` | get/set | The associated view instance. |
| `Parent` | `IBaseViewModel` | get/set | Reference to the parent view model, used to filter event payloads. |
| `Results` | `ObservableCollection<IChannelGRMSSummary>` | get/set | Collection of GRMS summary results bound to the UI. |
| `NotificationRequest` | `InteractionRequest<Notification>` | get/private set | Interaction request for displaying notifications. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | get/private set | Interaction request for displaying confirmations. |
| `ExportToPDFCommand` | `DelegateCommand` | get | Lazily-initialized command that publishes `SaveReportToPDFRequestedEvent`. |
| `ExportToCSVCommand` | `DelegateCommand` | get | Lazily-initialized command that publishes `SaveReportToCSVRequestedEvent`. |
### Methods
```csharp
public override void Initialize(object parameter)
```
Sets `Parent` from the parameter, initializes `Results` as an empty collection, and subscribes to events.
---
## 3. Invariants
- **Parent Filtering:** Event handlers `OnGRMSValuesUpdated` and `OnGraphSelectedChannelsChanged` will early-return if `Parent` does not match `arg.ParentVM` (or `arg?.ParentVM`). This ensures the view model only processes events intended for its specific parent context.
- **Results Initialization:** `Results` is always initialized as a new empty `ObservableCollection<IChannelGRMSSummary>` in `Initialize()` before any events are processed.
- **Lazy Command Initialization:** Both `ExportToPDFCommand` and `ExportToCSVCommand` are lazily instantiated using the null-coalescing pattern.
- **UIThread Subscription:** `OnGRMSValuesUpdated` is explicitly subscribed with `ThreadOption.UIThread`, ensuring the handler executes on the UI thread.
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Usage |
|-----------|-------|
| `DTS.Common.Base` | `BaseViewModel<T>`, `IBaseView`, `IBaseViewModel` |
| `DTS.Common.Events` | `PSDReportGRMSValuesUpdatedEvent`, `PSDReportGRMSValuesUpdatedEventArg`, `GraphSelectedChannelsNotification`, `GraphSelectedChannelsNotificationArg`, `SaveReportToPDFRequestedEvent`, `SaveReportToPDFRequestedEventArgs`, `SaveReportToCSVRequestedEvent`, `SaveReportToCSVRequestedEventArgs` |
| `DTS.Common.Interactivity` | `InteractionRequest<T>`, `Notification`, `Confirmation` |
| `DTS.Common.Interface` | `IPSDReportResultsViewModel`, `IChannelGRMSSummary`, `ITestChannel`, `IPSDReportSettingsView` |
| `DTS.Common.Utils` | `ReplaceLast` extension method (inferred from usage on `string`) |
| `Prism.Commands` | `DelegateCommand` |
| `Prism.Events` | `IEventAggregator`, `ThreadOption` |
| `Prism.Regions` | `IRegionManager` |
| `Unity` | `IUnityContainer` |
### Event Dependencies
- **Subscribes to:**
- `PSDReportGRMSValuesUpdatedEvent` — populates `Results` collection
- `GraphSelectedChannelsNotification` — sets `Directory` for export operations
- **Publishes:**
- `SaveReportToPDFRequestedEvent` — triggered by `ExportToPDFCommand`
- `SaveReportToCSVRequestedEvent` — triggered by `ExportToCSVCommand`
---
## 5. Gotchas
1. **Constructor Parameter Type Mismatch:** The constructor accepts `IPSDReportSettingsView` but assigns it to `View` which is typed as `IBaseView`. This implies `IPSDReportSettingsView` must inherit from `IBaseView`, but the relationship is not visible in this file.
2. **Member Hiding with `new` Keyword:** Both `ConfirmationRequest` and `_regionManager` use the `new` keyword, hiding base class members with the same names. This could cause unexpected behavior if the base class members are accessed through a base-class reference.
3. **Property Name Shadows System Type:** The private property `Directory` shadows `System.IO.Directory`. While scoped locally, this could cause confusion during debugging or if `using System.IO;` is added.
4. **`ReplaceLast` Extension Method Undefined Here:** The call to `channels[0].BinaryFilePath.ReplaceLast("Binary", "Reports")` depends on an extension method from `DTS.Common.Utils`. Its behavior (e.g., what happens if "Binary" is not found) is not defined in this source.
5. **No Unsubscribe Logic:** The `Subscribe()` method subscribes to events, but there is no corresponding `Unsubscribe()` or cleanup in this file. If the view model lifecycle is not managed correctly, this could lead to memory leaks or stale event handlers.

View File

@@ -0,0 +1,90 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/PSDReportSettingsModule.cs
generated_at: "2026-04-16T13:37:20.992121+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "272bb780c04413d3"
---
# Documentation: PSDReportSettingsModule
## 1. Purpose
This module serves as the entry point for the "PSD Report Settings" feature within the DTS Viewer application. It is a Prism Module (`PSDReportSettingsModule`) responsible for registering its specific View, ViewModel, and Model implementations with the Unity dependency injection container. Additionally, it defines assembly-level attributes to expose metadata (name, image, group, and region) to the main application shell, enabling the module to be discovered and displayed as an available component.
## 2. Public Interface
### Class: `PSDReportSettingsModule`
Implements `Prism.Modularity.IModule`.
* **Constructor**: `PSDReportSettingsModule(IUnityContainer unityContainer)`
* Accepts an `IUnityContainer` instance via constructor injection and stores it in a readonly field.
* **Method**: `void Initialize()`
* Registers three type mappings in the Unity container:
* `IPSDReportSettingsViewModel` mapped to `PSDReportSettingsViewModel`.
* `IPSDReportSettingsModel` mapped to `PSDReportSettingsModel`.
* `IPSDReportSettingsView` mapped to `PSDReportSettingsView`.
* **Method**: `void RegisterTypes(IContainerRegistry containerRegistry)`
* Implements `IModule.RegisterTypes`. It invokes the `Initialize()` method.
* **Method**: `void OnInitialized(IContainerProvider containerProvider)`
* Implements `IModule.OnInitialized`. This method is currently empty.
### Class: `PSDReportSettingsModuleNameAttribute`
Inherits from `TextAttribute`.
* **Constructor**: `PSDReportSettingsModuleNameAttribute()` / `PSDReportSettingsModuleNameAttribute(string s)`
* Hardcodes the `AssemblyName` property to `AssemblyNames.PSDReportSettings.ToString()`. The string argument `s` in the overloaded constructor is ignored.
* **Property**: `string AssemblyName { get; }`
* Returns the hardcoded assembly name string.
* **Method**: `Type GetAttributeType()`
* Returns `typeof(TextAttribute)`.
* **Method**: `string GetAssemblyName()`
* Returns the value of the `AssemblyName` property.
### Class: `PSDReportSettingsModuleImageAttribute`
Inherits from `ImageAttribute`.
* **Constructor**: `PSDReportSettingsModuleImageAttribute()` / `PSDReportSettingsModuleImageAttribute(string s)`
* Initializes a private `BitmapImage` field (`_img`) by calling `AssemblyInfo.GetImage`. The string argument `s` is ignored.
* **Property**: `BitmapImage AssemblyImage { get; }`
* Gets the image by calling `AssemblyInfo.GetImage` with the `AssemblyNames.PSDReportSettings` enum value.
* **Property**: `string AssemblyName { get; }`
* Returns `AssemblyNames.PSDReportSettings.ToString()`.
* **Property**: `string AssemblyGroup { get; }`
* Returns `eAssemblyGroups.Viewer.ToString()`.
* **Property**: `eAssemblyRegion AssemblyRegion { get; }`
* Returns `eAssemblyRegion.PSDReportSettingsRegion`.
* **Methods**:
* `Type GetAttributeType()`: Returns `typeof(ImageAttribute)`.
* `BitmapImage GetAssemblyImage()`: Returns `AssemblyImage`.
* `string GetAssemblyName()`: Returns `AssemblyName`.
* `string GetAssemblyGroup()`: Returns `AssemblyGroup`.
* `eAssemblyRegion GetAssemblyRegion()`: Returns `AssemblyRegion`.
## 3. Invariants
* **Module Name**: The Prism module is identified by the string `"PSDReportSettings"` via the `[Module]` attribute.
* **Assembly Attributes**: The assembly is decorated with both `PSDReportSettingsModuleNameAttribute` and `PSDReportSettingsModuleImageAttribute` with `AllowMultiple = false`.
* **Registration Mapping**: The `Initialize` method guarantees that `IPSDReportSettingsViewModel`, `IPSDReportSettingsModel`, and `IPSDReportSettingsView` are registered with the container upon module initialization.
* **Region Assignment**: This module is statically bound to the region `eAssemblyRegion.PSDReportSettingsRegion`.
## 4. Dependencies
### Internal Dependencies
* **DTS.Common**: Referenced for `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, and `eAssemblyRegion`.
* **DTS.Common.Interface**: Referenced for base classes `TextAttribute` and `ImageAttribute`.
* **Local Types**: The module depends on the existence of `PSDReportSettingsViewModel`, `PSDReportSettingsModel`, and `PSDReportSettingsView` (and their corresponding interfaces), though these types are not defined in the provided source snippet.
### External Dependencies
* **Prism.Ioc**: For `IContainerProvider` and `IContainerRegistry`.
* **Prism.Modularity**: For `IModule` and `ModuleAttribute`.
* **Unity**: For `IUnityContainer` (used for specific registration logic).
* **System.Windows.Media.Imaging**: For `BitmapImage`.
### Consumers
* The DTS Viewer main application shell (inferred from the module structure and `eAssemblyGroups.Viewer` group assignment).
## 5. Gotchas
* **Mixed Container Abstractions**: The module implements `IModule`, which provides a `RegisterTypes(IContainerRegistry containerRegistry)` method intended for container-agnostic registration. However, the implementation ignores the `containerRegistry` argument and instead uses the injected `IUnityContainer` instance via the `Initialize()` method. This ties the module specifically to Unity, bypassing Prism's container abstraction layer.
* **Redundant Constructor Arguments**: Both attribute classes possess constructors accepting a `string s` argument. This argument is unused in both constructors, suggesting legacy code or a requirement of the base attribute constructor signature that was implemented but not utilized.
* **Property Side Effects**: In `PSDReportSettingsModuleImageAttribute`, the getter for `AssemblyImage` re-executes `AssemblyInfo.GetImage(...)` and reassigns the private field `_img` every time it is accessed, rather than returning the cached value.
* **Empty OnInitialized**: The `OnInitialized` method is explicitly empty. If the View needs to be loaded into a region automatically upon startup, that logic is absent from this module class.

View File

@@ -0,0 +1,96 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Model/PSDReportSettingsModel.cs
generated_at: "2026-04-16T13:39:22.438752+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b9213b8d6a0e210e"
---
# Documentation: PSDReportSettingsModel
## 1. Purpose
`PSDReportSettingsModel` is a data model class that encapsulates configuration settings for Power Spectral Density (PSD) report generation. It stores filter parameters (low-pass and high-pass), windowing configuration, and data range settings. The class implements `INotifyPropertyChanged` via `BasePropertyChanged` to support MVVM data binding and notifies a parent view model of changes through the `IPSDReportSettingsModel` interface.
---
## 2. Public Interface
### Properties
| Property | Type | Default Value | Description |
|----------|------|---------------|-------------|
| `Parent` | `IPSDReportSettingsViewModel` | `null` | Reference to the parent view model. Setter includes equality check to avoid redundant assignments. |
| `CanPublishChanges` | `bool` | `true` | Controls whether property changes trigger `Parent.PublishChanges()` notification. |
| `LowPassFilterEnabled` | `bool` | `false` | Enables/disables low-pass filter. Setting this sets `ReadData = true`. |
| `LowPassFilterFrequency` | `double` | `2000` | Low-pass filter cutoff frequency in Hz. |
| `LowPassFilterType` | `PassFilterType` | `PassFilterType.Butterworth` | Type of low-pass filter algorithm. |
| `LowPassFilterOrder` | `int` | `8` | Order of the low-pass filter. |
| `HighPassFilterEnabled` | `bool` | `false` | Enables/disables high-pass filter. |
| `HighPassFilterFrequency` | `double` | `5` | High-pass filter cutoff frequency in Hz. |
| `HighPassFilterType` | `PassFilterType` | `PassFilterType.Butterworth` | Type of high-pass filter algorithm. |
| `HighPassFilterOrder` | `int` | `8` | Order of the high-pass filter. |
| `WindowWidth` | `WindowWidth` | `WindowWidth.FortyNinetySix` | Width of the analysis window. |
| `WindowType` | `WindowType` | `WindowType.Hanning` | Window function type for spectral analysis. |
| `WindowAveragingType` | `WindowAveragingType` | `WindowAveragingType.Averaging` | Averaging method for window processing. |
| `WindowOverlappingPercent` | `double` | `50` | Percentage of overlap between consecutive windows. |
| `ShowEnvelope` | `bool` | `false` | Controls whether envelope is displayed. |
| `IsSaved` | `bool` | *(unclear)* | Read-only property. Initialization/setter not visible in source. |
| `ReadData` | `bool` | `false` | Flag indicating data should be re-read. |
| `DataStart` | `double` | `0D` | Start position for data range. |
| `DataEnd` | `double` | `0D` | End position for data range. |
### Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `OnPropertyChanged` | `override void OnPropertyChanged(string propertyName)` | Raises `PropertyChanged` event and conditionally calls `Parent.PublishChanges()` unless the property is `CanPublishChanges`, `Parent`, or `ReadData`. |
### Events
| Event | Type | Description |
|-------|------|-------------|
| `PropertyChanged` | `PropertyChangedEventHandler` | Override of base event; raised when any property value changes. |
---
## 3. Invariants
1. **Change Notification Behavior**: All property changes except `CanPublishChanges`, `Parent`, and `ReadData` will call `Parent?.PublishChanges()` if `CanPublishChanges` is `true`.
2. **ReadData Side Effect**: Setting any of the following properties automatically sets `ReadData = true` before the property value is updated:
- `LowPassFilterEnabled`, `LowPassFilterFrequency`, `LowPassFilterType`, `LowPassFilterOrder`
- `HighPassFilterEnabled`, `HighPassFilterFrequency`, `HighPassFilterType`, `HighPassFilterOrder`
- `WindowWidth`, `WindowType`, `WindowAveragingType`, `WindowOverlappingPercent`, `ShowEnvelope`
- `DataStart`, `DataEnd`
3. **Parent Assignment Guard**: The `Parent` setter will not raise `OnPropertyChanged` if `_parent != null && _parent.Equals(value)` is true.
4. **CanPublishChanges Default**: Initialized to `true`, meaning change notifications are published by default.
---
## 4. Dependencies
### This Module Depends On
- `DTS.Common.Enums.Viewer.Reports` — Provides `PassFilterType`, `WindowWidth`, `WindowType`, `WindowAveragingType` enums
- `DTS.Common.Interface` — Provides `IPSDReportSettingsModel` and `IPSDReportSettingsViewModel` interfaces
- `Common.Base.BasePropertyChanged` — Base class providing `SetProperty` method and `INotifyPropertyChanged` infrastructure (namespace not fully qualified in source)
### Consumers
- Any module referencing `IPSDReportSettingsModel` (exact consumers not determinable from this source alone)
---
## 5. Gotchas
1. **IsSaved Property Has No Visible Setter**: The `IsSaved` property has only a getter defined with no backing field or initializer visible. Its value source is unclear from this source alone—it may be computed elsewhere or require partial class definition.
2. **Parent Setter Equality Logic**: The condition `if (_parent != null && _parent.Equals(value))` means:
- If `_parent` is `null`, the assignment proceeds even if `value` is also `null`
- This differs from typical null-coalescing patterns and may result in redundant `OnPropertyChanged` calls when setting `Parent` to `null` multiple times
3. **ReadData Set Before SetProperty**: For filter and window properties, `ReadData = true` is set *before* calling `SetProperty`. This means `ReadData` will be `true` by the time `OnPropertyChanged` fires for the original property, which could affect any listeners checking `ReadData` during change notification.
4. **CanPublishChanges Does Not Set ReadData**: Unlike other boolean flags like `LowPassFilterEnabled`, setting `CanPublishChanges` does not set `ReadData = true`. This is intentional but inconsistent with other property behaviors.

View File

@@ -0,0 +1,57 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T13:38:42.196012+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "86a096c3d5cd87e0"
---
# Documentation: DTS.Viewer.PSDReportSettings Assembly Configuration
## 1. Purpose
This file provides assembly-level metadata for the `DTS.Viewer.PSDReportSettings` component within the DTS Viewer application. It exists to embed standard .NET assembly attributes—such as version information, copyright, COM visibility settings, and a unique identifier—into the compiled output. This is a boilerplate configuration file typically auto-generated by the .NET Framework project template and does not contain executable logic.
## 2. Public Interface
This file does not expose any public functions, classes, or methods. It exclusively defines assembly-level attributes via the `assembly` directive.
**Defined Assembly Attributes:**
| Attribute | Value |
|-----------|-------|
| `AssemblyTitle` | `"DTS.Viewer.PSDReportSettings"` |
| `AssemblyDescription` | `""` (empty) |
| `AssemblyConfiguration` | `""` (empty) |
| `AssemblyCompany` | `""` (empty) |
| `AssemblyProduct` | `"DTS.Viewer.PSDReportSettings"` |
| `AssemblyCopyright` | `"Copyright © 2021"` |
| `AssemblyTrademark` | `""` (empty) |
| `AssemblyCulture` | `""` (empty) |
| `ComVisible` | `false` |
| `Guid` | `"82faae11-3be9-4223-beb8-8a53643866f8"` |
| `AssemblyVersion` | `"1.0.0.0"` |
| `AssemblyFileVersion` | `"1.0.0.0"` |
## 3. Invariants
- **COM Visibility**: All types within this assembly are not visible to COM components by default (`ComVisible(false)`). To expose a specific type to COM, `ComVisible(true)` must be explicitly applied to that type.
- **Version Consistency**: Both `AssemblyVersion` and `AssemblyFileVersion` are fixed at `1.0.0.0`. These values will not automatically increment with builds unless manually updated or the project is migrated to a different versioning scheme.
- **Assembly Identity**: The `Guid` attribute value `82faae11-3be9-4223-beb8-8a53643866f8` uniquely identifies this assembly's type library if it were to be exposed to COM.
## 4. Dependencies
**This module depends on:**
- `System.Reflection` - Provides the `AssemblyTitleAttribute`, `AssemblyDescriptionAttribute`, and related metadata attribute classes.
- `System.Runtime.CompilerServices` - Included by default; unused in this file but commonly required for compiler-specific attributes.
- `System.Runtime.InteropServices` - Provides the `ComVisibleAttribute` and `GuidAttribute` classes for COM interop configuration.
**What depends on this module:**
- Unclear from source alone. This assembly appears to be a library or plugin within the larger `DTS Viewer` solution, likely providing settings or configuration for PSD (presumably "Process Specification Diagram" or a similar domain-specific acronym) report generation.
## 5. Gotchas
- **Empty Metadata**: `AssemblyDescription`, `AssemblyCompany`, `AssemblyConfiguration`, and `AssemblyTrademark` are all empty strings. This may hinder automated tooling that relies on assembly metadata for documentation or licensing checks.
- **Hardcoded Version**: The version is manually set to `1.0.0.0`. The commented-out line `// [assembly: AssemblyVersion("1.0.*")]` suggests automatic build numbering was considered but not enabled.
- **Legacy Project Format**: The presence of an explicit `AssemblyInfo.cs` with these attributes suggests a .NET Framework-style project (pre-SDK-style). Modern SDK-style projects typically auto-generate this information, which could lead to conflicts if this project is ever migrated.

View File

@@ -0,0 +1,86 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Resources/TranslateExtension.cs
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T13:38:43.337295+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5a446a4aa0389800"
---
# Documentation: DTS.Viewer.PSDReportSettings.Resources
## 1. Purpose
This module provides localization infrastructure for the PSD Report Settings UI within the DTS Viewer application. It bridges strongly-typed resource management with WPF XAML data binding. The `StringResources` class auto-generates access to localized strings (defaulting to English values such as "Envelope" and "Butterworth") for signal processing and export settings, while the `TranslateExtension` class exposes these resources directly in XAML markup.
## 2. Public Interface
### `TranslateExtension` (Class)
**Namespace:** `DTS.Viewer.PSDReportSettings`
**Inheritance:** `System.Windows.Markup.MarkupExtension`
This class allows XAML bindings to retrieve localized strings dynamically.
* **`TranslateExtension(string key)`** (Constructor)
* Initializes the extension with a specific resource key to look up.
* **`ProvideValue(IServiceProvider serviceProvider)`** (Method)
* Returns `object` (specifically a `string`).
* Looks up the string value using `StringResources.ResourceManager.GetString(_key)`.
* Returns the localized string if found.
* Returns `#stringnotfound#` if the key is null or empty.
* Returns `#stringnotfound# [key]` (appending the key name) if the lookup fails (returns null).
### `StringResources` (Class)
**Namespace:** `DTS.Viewer.PSDReportSettings.Resources`
**Visibility:** `internal`
This is a strongly-typed resource class generated by Visual Studio. It provides static properties to access localized strings.
* **`ResourceManager`** (Property)
* Returns the cached `global::System.Resources.ResourceManager` instance for this assembly.
* **`Culture`** (Property)
* Gets or sets the `global::System.Globalization.CultureInfo` used for resource lookups.
* **Resource String Properties** (Static, read-only)
* `EnvelopeHeader`: "Envelope"
* `ExportPSDHeader`: "Export"
* `ExportPSDtoCSV`: "Export PSD to CSV"
* `ExportPSDtoPDF`: "Export PSD to PDF"
* `FilterCenterFrequency`: "Center frequency"
* `FilterOrder`: "Filter order"
* `FilterSettingsHeader`: "Filters"
* `FilterType`: "Filter type"
* `FilterType_Bessel`: "Bessel"
* `FilterType_Butterworth`: "Butterworth"
* `FilterType_LinkwitzRiley`: "Linkwitz-Riley"
* `HighPassFilter`: "High pass filter"
* `Hz`: "Hz"
* `LowPassFilter`: "Low pass filter"
* `PSDSettingsHeader`: "PSD settings"
* `ShowEnvelope`: "Show Envelope"
* `WindowAveragingType`: "Averaging type"
* `WindowOverlappingPercent`: "Overlapping %"
* `WindowSettingsHeader`: "Window"
* `WindowType`: "Window type"
* `WindowWidth`: "Window width"
## 3. Invariants
* **Return Type:** `TranslateExtension.ProvideValue` is decorated with `[MarkupExtensionReturnType(typeof(string))]`, guaranteeing the return object is a string.
* **Null Safety:** `TranslateExtension.ProvideValue` will never return null. It guarantees a string return, defaulting to specific error constants if the key is missing.
* **Key Requirement:** `TranslateExtension` requires a non-null, non-empty `key` argument in its constructor to function correctly.
* **Singleton Manager:** `StringResources.ResourceManager` uses a lazy-initialization pattern to ensure only one instance of the resource manager exists.
## 4. Dependencies
* **Internal Dependencies:**
* `TranslateExtension` depends entirely on `StringResources.ResourceManager` to perform lookups.
* **External Frameworks:**
* `System.Windows.Markup`: Required for `MarkupExtension` and `IServiceProvider` (WPF).
* `System.Resources`: Required for `ResourceManager`.
* `System.Globalization`: Required for `CultureInfo`.
* **Build Dependencies:**
* `StringResources.Designer.cs` is auto-generated. It depends on a corresponding `.resx` file (likely `StringResources.resx`) existing in the project directory.
## 5. Gotchas
* **Error String Format:** If a resource key is passed to `TranslateExtension` but not found in the `.resx` file, the UI will display `#stringnotfound# [key]`. This differs from the behavior when the key argument itself is null/empty (which returns just `#stringnotfound#`).
* **Auto-Generated Code:** `StringResources.Designer.cs` contains a header warning that manual changes will be lost. Developers must edit the underlying `.resx` file to add or modify strings; editing this C# file directly is futile.
* **Visibility Mismatch:** `StringResources` is `internal`, while `TranslateExtension` is `public`. Code outside the `DTS.Viewer.PSDReportSettings` assembly cannot access the resource strings directly via the class properties, but they can access them via the XAML extension.
* **Namespace Split:** `TranslateExtension` resides in `DTS.Viewer.PSDReportSettings`, while the resources reside in `DTS.Viewer.PSDReportSettings.Resources`. This requires the `using` directive present in the source file.

View File

@@ -0,0 +1,57 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/View/PSDReportSettingsView.xaml.cs
generated_at: "2026-04-16T13:39:00.678252+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5b2351e33ed49693"
---
# Documentation: PSDReportSettingsView
## 1. Purpose
`PSDReportSettingsView` is a WPF view component providing the user interface logic for configuring PSD (Power Spectral Density) report settings. It implements `IPSDReportSettingsView` and serves as the code-behind for a XAML view, exposing configuration options for report parameters such as window widths used in spectral analysis.
## 2. Public Interface
### `PSDReportSettingsView()` (Constructor)
**Signature:** `public PSDReportSettingsView()`
Initializes the view component by calling `InitializeComponent()`, which loads the associated XAML layout.
---
### `AvailableWindowWidths`
**Signature:** `public List<int> AvailableWindowWidths { get; }`
Returns a new `List<int>` containing five predefined window width values: `{ 512, 1024, 2048, 4096, 8192 }`. These values represent FFT window sizes available for selection in the PSD report configuration.
**Note:** Creates a new list instance on every property access.
## 3. Invariants
- The class always implements the `IPSDReportSettingsView` interface.
- `AvailableWindowWidths` always returns exactly five integer values in ascending order: 512, 1024, 2048, 4096, 8192.
- The view requires `InitializeComponent()` to be called (via constructor) before the XAML elements are accessible.
## 4. Dependencies
### This module depends on:
- `DTS.Common.Interface` — provides `IPSDReportSettingsView` interface
- `System.Collections.Generic` — provides `List<T>`
- `Xceed.Wpf.Toolkit.PropertyGrid.Attributes` — imported but not visibly used in this file (likely referenced in XAML)
### What depends on this module:
- Cannot be determined from source alone (no consumers visible in this file).
## 5. Gotchas
1. **New list instance per access:** `AvailableWindowWidths` creates a new `List<int>` on every property getter call. If called frequently, this could cause unnecessary allocations. Consider caching if performance becomes a concern.
2. **Commented-out code:** Three properties (`AvailablePassFilterTypes`, `AvailableWindowAveragingTypes`, `AvailableWindowTypes`) are commented out, suggesting either:
- Features were moved elsewhere or removed
- Implementation is incomplete
- These may be defined in the XAML or a separate partial class
3. **Unused import:** `Xceed.Wpf.Toolkit.PropertyGrid.Attributes` is imported but no attributes from this namespace are used in the visible code. This may indicate usage in XAML or remnants of refactored code.

View File

@@ -0,0 +1,104 @@
---
source_files:
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/ViewModel/PSDReportSettingsViewModel.cs
generated_at: "2026-04-16T13:37:48.788166+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9dcac2937b5c346b"
---
# Documentation: PSDReportSettingsViewModel
## 1. Purpose
`PSDReportSettingsViewModel` is a Prism-based ViewModel responsible for managing Power Spectral Density (PSD) report settings within the DTS Viewer application. It serves as a mediator between graph visualization components and report settings, responding to user interactions such as channel selection and axis changes, and publishing those changes to other system components via the event aggregator. The class extends `BaseViewModel<IPSDReportSettingsModel>` and implements `IPSDReportSettingsViewModel`.
---
## 2. Public Interface
### Properties
| Property | Type | Description |
|----------|------|-------------|
| `View` | `IBaseView` | Gets or sets the associated view instance. |
| `Parent` | `IBaseViewModel` | Gets or sets the parent ViewModel reference. |
| `Model` | `IPSDReportSettingsModel` | Gets or sets the model instance. Uses `new` keyword to hide base class property. Raises `OnPropertyChanged("Model")` on set. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for displaying notifications to the user. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for displaying confirmation dialogs. Uses `new` keyword to hide base class property. |
### Constructor
```csharp
public PSDReportSettingsViewModel(
IPSDReportSettingsView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Creates a new instance, initializes the view's DataContext, and creates interaction request objects.
### Methods
```csharp
public override void Initialize()
```
Empty override. No initialization logic performed.
```csharp
public override void Initialize(object parameter)
```
Initializes the ViewModel with a parent reference (cast to `IBaseViewModel`), subscribes to events, resolves the `IPSDReportSettingsModel` from the Unity container, and sets the model's `Parent` property.
```csharp
public void PublishChanges()
```
Publishes a `PSDReportSettingsChangedEvent` with a `PSDReportSettingsChangedEventArg` containing the current `Model` and `ParentVM` reference.
---
## 3. Invariants
- **Parent Filtering**: Event handlers (`OnChartAxisChanged`, `OnGraphSelectedChannelsChanged`) ignore events where `arg.ParentVM` does not match `Parent`.
- **Publish Guard**: When handling X-axis changes, `Model.CanPublishChanges` is set to `false` before modifying `DataStart`/`DataEnd`, then restored to `true` before calling `PublishChanges()`. This prevents potential recursive event propagation.
- **Model Resolution**: The `Model` is resolved from the Unity container during `Initialize(object parameter)`, not in the constructor.
---
## 4. Dependencies
### This Module Depends On
| Namespace/Module | Usage |
|------------------|-------|
| `DTS.Common.Base` | `BaseViewModel<T>` base class |
| `DTS.Common.Events` | Event types: `GraphSelectedChannelsNotification`, `GraphClearNotification`, `ChartAxisChangedEvent`, `PSDReportSettingsChangedEvent` and their argument types |
| `DTS.Common.Interactivity` | `InteractionRequest<T>`, `Notification`, `Confirmation` |
| `DTS.Common.Interface` | `IBaseView`, `IBaseViewModel`, `IPSDReportSettingsModel`, `IPSDReportSettingsView`, `IPSDReportSettingsViewModel` |
| `Prism.Events` | `IEventAggregator` |
| `Prism.Regions` | `IRegionManager` |
| `Unity` | `IUnityContainer` for dependency resolution |
### What Depends On This Module
- **Unclear from source alone**: The module publishes `PSDReportSettingsChangedEvent`, indicating subscribers elsewhere in the system consume this ViewModel's output, but specific consumers are not visible in this file.
---
## 5. Gotchas
1. **Property Hiding**: Both `Model` and `ConfirmationRequest` use the `new` keyword to hide base class members. This can lead to unexpected behavior if the ViewModel is accessed via a base class reference.
2. **Commented-Out Code**: Several features appear incomplete or disabled:
- `Standalone` property is commented out
- Y-axis handling in `OnChartAxisChanged` is commented out
- `PublishChanges()` call in `OnGraphSelectedChannelsChanged` is commented out
- `CursorsAlailableChangedEvent` subscription is commented out
- `View.DataContext = Model` assignment in `Initialize(object parameter)` is commented out
3. **Empty `Initialize()` Override**: The parameterless `Initialize()` method is empty. All initialization logic resides in the overloaded version.
4. **Unused `OnRaiseNotification` Method**: This private method exists but is never called within the visible source. It may be wired via event subscription not shown in this file.
5. **Async Pattern Absent**: Despite importing `System.Threading.Tasks`, no async operations are performed in this class.