init
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
---
|
||||
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-16T10:59:56.665208+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 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`**
|
||||
```csharp
|
||||
public PSDReportModule(IUnityContainer unityContainer)
|
||||
```
|
||||
Constructor accepting an `IUnityContainer` dependency injection.
|
||||
|
||||
```csharp
|
||||
public void Initialize()
|
||||
```
|
||||
Registers `IPSDReportModule` to `PSDReportModule` with `ContainerControlledLifetimeManager` (singleton lifetime).
|
||||
|
||||
```csharp
|
||||
public void StartSession()
|
||||
```
|
||||
Resolves `IEventAggregator`, publishes a `LoadViewModulEvent` with `LoadViewModulArg`, and sets `SessionStarted` to `true`.
|
||||
|
||||
```csharp
|
||||
public void RegisterTypes(IContainerRegistry containerRegistry)
|
||||
```
|
||||
Prism module lifecycle method; calls `Initialize()`.
|
||||
|
||||
```csharp
|
||||
public void OnInitialized(IContainerProvider containerProvider)
|
||||
```
|
||||
Prism module lifecycle method; currently empty implementation.
|
||||
|
||||
**Property: `SessionStarted`** (read-only)
|
||||
```csharp
|
||||
public bool SessionStarted { get; private set; }
|
||||
```
|
||||
Indicates whether `StartSession()` has been called.
|
||||
|
||||
---
|
||||
|
||||
**Class: `PSDReportModuleNameAttribute`** (extends `TextAttribute`)
|
||||
```csharp
|
||||
public PSDReportModuleNameAttribute()
|
||||
public PSDReportModuleNameAttribute(string s)
|
||||
```
|
||||
Assembly-level attribute returning `AssemblyNames.PSDReport.ToString()` for `AssemblyName`.
|
||||
|
||||
```csharp
|
||||
public override Type GetAttributeType()
|
||||
public override string GetAssemblyName()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Class: `PSDReportModuleImageAttribute`** (extends `ImageAttribute`)
|
||||
```csharp
|
||||
public PSDReportModuleImageAttribute()
|
||||
public PSDReportModuleImageAttribute(string s)
|
||||
```
|
||||
Assembly-level attribute providing image, name, group, and region metadata.
|
||||
|
||||
```csharp
|
||||
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`**
|
||||
```csharp
|
||||
public PSDReportSession()
|
||||
```
|
||||
Default (empty) constructor.
|
||||
|
||||
```csharp
|
||||
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.
|
||||
|
||||
```csharp
|
||||
public void Terminate()
|
||||
```
|
||||
Empty implementation; intended for shutdown scenarios.
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
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`)
|
||||
```csharp
|
||||
public Bootstrapper(bool standalone, string customConfigPath = "")
|
||||
```
|
||||
Constructor accepting standalone mode flag and optional custom config path.
|
||||
|
||||
```csharp
|
||||
protected override void ConfigureContainer()
|
||||
```
|
||||
Registers `IPSDReportMainViewGrid` to `PSDReportMainViewGrid` and `IPSDReportMainViewModel` to `PSDReportMainViewModel` (singleton). Calls `base.ConfigureContainer()`.
|
||||
|
||||
```csharp
|
||||
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.
|
||||
|
||||
```csharp
|
||||
protected override DependencyObject CreateShell()
|
||||
```
|
||||
Creates the shell by resolving `IPSDReportMainViewModel`, registering regions dynamically, setting DataContext, and initializing the view model. Returns `null` on exception.
|
||||
|
||||
```csharp
|
||||
protected override IModuleCatalog CreateModuleCatalog()
|
||||
```
|
||||
Returns resolved `IModuleCatalog` or creates new `AggregateModuleCatalog`.
|
||||
|
||||
```csharp
|
||||
protected override void ConfigureModuleCatalog()
|
||||
```
|
||||
For standalone mode only: reads plugin folder paths from configuration section `DTS.Common.Core.PluginLib.Config` and creates a `DirectoryModuleCatalog`.
|
||||
|
||||
```csharp
|
||||
protected override void InitializeModules()
|
||||
```
|
||||
For standalone mode only: registers `IDTSViewRegionManager` to `DTSViewRegionManager` (singleton) and calls `base.InitializeModules()`.
|
||||
|
||||
**Properties:**
|
||||
```csharp
|
||||
public bool Standalone { get; set; }
|
||||
public string CustomConfigPath { get; set; }
|
||||
public IServiceLocator _ServiceLocator { get; private set; }
|
||||
public IEventAggregator _EventAggregator { get; private set; }
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Singleton Registration**: `IPSDReportModule` is registered with `ContainerControlledLifetimeManager`, ensuring a single instance per container.
|
||||
|
||||
2. **Session State**: `SessionStarted` is `false` until `StartSession()` is called; it cannot be reset to `false` through the public interface.
|
||||
|
||||
3. **Bootstrapper Creation**: `CreateBootstrapper()` will not create a new bootstrapper if `_bootstrapper` is already non-null.
|
||||
|
||||
4. **Standalone Mode Behavior**:
|
||||
- `ConfigureModuleCatalog()` only adds directory catalog when `Standalone` is `true`.
|
||||
- `InitializeModules()` only registers `IDTSViewRegionManager` when `Standalone` is `true`.
|
||||
- `StackPanel` region adapter is only registered when `Standalone` is `true`.
|
||||
|
||||
5. **Region Registration**: In `CreateShell()`, regions are only added if they don't already exist (`ContainsRegionWithName` check).
|
||||
|
||||
6. **Assembly Attributes**: Both `PSDReportModuleNameAttribute` and `PSDReportModuleImageAttribute` are decorated with `AllowMultiple = false`.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
|
||||
**Prism Framework:**
|
||||
- `Prism.Ioc` - `IContainerRegistry`, `IContainerProvider`
|
||||
- `Prism.Modularity` - `IModule`, `ModuleAttribute`, `IModuleCatalog`
|
||||
- `Prism.Events` - `IEventAggregator`
|
||||
- `Microsoft.Practices.Prism.Events` - `IEventAggregator` (legacy)
|
||||
- `Microsoft.Practices.Prism.Modularity` - `IModuleCatalog`, `UnityBootstrapper`
|
||||
- `Microsoft.Practices.Prism.Regions` - `IRegionManager`, `RegionAdapterMappings`, `Region`, `RegionManager`
|
||||
- `Microsoft.Practices.Prism.UnityExtensions` - `UnityBootstrapper`
|
||||
|
||||
**Unity DI:**
|
||||
- `Unity` - `IUnityContainer`
|
||||
- `Unity.Lifetime` - `ContainerControlledLifetimeManager`
|
||||
- `Microsoft.Practices.Unity` - `IUnityContainer`, `InjectionMember`
|
||||
|
||||
**DTS Common Libraries:**
|
||||
- `DTS.Common` - `AssemblyNames`, `AssemblyInfo`, `eAssemblyGroups`, `eAssemblyRegion`
|
||||
- `DTS.Common.Events` - `LoadViewModulEvent`, `LoadViewModulArg`, `AssemblyListNotificationViewer`, `AssemblyListInfo`
|
||||
- `DTS.Common.Interface` - `IPSDReportModule`, `IPSDReportMainViewGrid`, `IPSDReportMainViewModel`, `IShellViewModel`, `IDTSViewRegionManager`
|
||||
- `DTS.Common.Base` - `TextAttribute`, `ImageAttribute`
|
||||
- `DTS.Common.Core.PluginLib` - `PluginManager`, `PluginConfigSectionHandler`, `FilterHashElement`, `DTSViewRegionManager`
|
||||
|
||||
**WPF/.NET:**
|
||||
- `System.Windows` - `DependencyObject`, `DependencyProperty`
|
||||
- `System.Windows.Controls` - `ItemsControl`, `ContentControl`, `StackPanel`
|
||||
- `System.Windows.Media.Imaging` - `BitmapImage`
|
||||
- `System.Configuration` - `ConfigurationManager`
|
||||
- `System.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
|
||||
|
||||
1. **Dual EventAggregator Imports**: The code imports `IEventAggregator` from both `Prism.Events` (modern) and `Microsoft.Practices.Prism.Events` (legacy). `PSDReportModule` uses the modern namespace while `PSDReportSession` uses the legacy namespace. This could cause runtime issues if they resolve to different instances.
|
||||
|
||||
2. **Empty Constructor Comment**: `PSDReportSession` has a comment `// ReSharper disable EmptyConstructor` suggesting the empty constructor may be intentional but non-obvious.
|
||||
|
||||
3. **Bootstrapper Memory Footprint**: The comment in `PSDReportSession` notes: *"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.
|
||||
|
||||
4. **Silent Failure in CreateShell**: `CreateShell()` catches all exceptions, stores the message in a local variable `s` that is never used, and returns `null`. This silently swallows errors.
|
||||
|
||||
5. **Region Adapter Registration Swallows Errors**: `ConfigureRegionAdapterMappings()` wraps each registration in try/catch with empty catch blocks, silently ignoring duplicate mapping exceptions.
|
||||
|
||||
6. **Commented-Out Code in ConfigureContainer**: There is commented-out code for conditional registration based on `Standalone` mode, suggesting the registration strategy changed but the old code was preserved.
|
||||
|
||||
7. **TODO Comment**: `PSDReportSession.CreateSession()` contains `//TODO: review publishPlugins vs base.InitializeModules();` indicating incomplete design review.
|
||||
|
||||
8. **Inconsistent Naming Convention**: Some private fields use underscore prefix (`_unityContainer`, `_eventAggregator`) while others don't (`Container`). Public properties mix conventions (`_serviceLocator` is public with underscore prefix).
|
||||
|
||||
9. **Unused Imports**: `System.Runtime.InteropServices.ComTypes` is imported in `Bootstrapper.cs` but the `IStream` type is not used.
|
||||
|
||||
10. **Module Self-Registration**: `PSDReportModule.Initialize()` registers its own type (`IPSDReportModule` → `PSDReportModule`), which is unusual since the module instance already exists when `Initialize()` is called.
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T11:03:45.800273+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "d475bf20384ac0ba"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.PSDReport Assembly Configuration
|
||||
|
||||
## 1. Purpose
|
||||
This source file defines the assembly metadata and versioning information for the `DTS.Viewer.PSDReport` library. As a standard .NET `AssemblyInfo.cs` file, it configures the manifest embedded within the compiled DLL, specifying the assembly title, version, copyright, and COM visibility settings. It serves as the build configuration entry point for this specific reporting module within the larger DTS Viewer application.
|
||||
|
||||
## 2. Public Interface
|
||||
This file does not contain executable classes or methods. It applies assembly-level attributes that affect the compiled output's metadata.
|
||||
|
||||
* **`AssemblyTitle("DTS.Viewer.PSDReport")`**: Sets the friendly name for the assembly.
|
||||
* **`AssemblyProduct("DTS.Viewer.PSDReport")`**: Specifies the product name associated with the assembly.
|
||||
* **`AssemblyCopyright("Copyright © 2021")`**: Defines the copyright information.
|
||||
* **`ComVisible(false)`**: Indicates that types within this assembly are not visible to COM components.
|
||||
* **`Guid("3d57ca12-a637-4cdb-b673-d9a5ff0cf062")`**: Specifies a unique identifier for the assembly, used if the project is exposed to COM.
|
||||
* **`AssemblyVersion("1.0.0.0")`**: Sets the assembly version number (Major.Minor.Build.Revision).
|
||||
* **`AssemblyFileVersion("1.0.0.0")`**: Sets the file version number displayed in the file properties.
|
||||
|
||||
## 3. Invariants
|
||||
* **COM Visibility:** All types within this assembly are explicitly hidden from COM components (`ComVisible(false)`).
|
||||
* **Versioning:** The assembly version and file version are currently fixed at `1.0.0.0`. They are not configured to auto-increment (the wildcard syntax `1.0.*` is commented out).
|
||||
* **Identity:** The `Guid` `3d57ca12-a637-4cdb-b673-d9a5ff0cf062` uniquely identifies this specific assembly globally.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies:**
|
||||
* `System.Reflection`: Required for the assembly attribute definitions.
|
||||
* `System.Runtime.CompilerServices`: Included by default in the template; not actively used for `InternalsVisibleTo` in this snippet.
|
||||
* `System.Runtime.InteropServices`: Required for the `ComVisible` and `Guid` attributes.
|
||||
* **External Dependencies:** None identified in this file. The project likely references other DTS modules, but those relationships are defined in the project file (`.csproj`), not here.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Static Versioning:** The version is hardcoded to `1.0.0.0`. If the build process does not externally override these values (e.g., via CI/CD pipeline parameters), all builds will report as version 1.0.0.0, making version tracking difficult.
|
||||
* **Empty Metadata:** The `AssemblyDescription`, `AssemblyConfiguration`, `AssemblyCompany`, and `AssemblyTrademark` fields are empty strings. This may trigger default behavior or result in missing metadata in the compiled DLL properties.
|
||||
* **Legacy Format:** The existence of an explicit `AssemblyInfo.cs` suggests this project may be using the older .NET Framework SDK style project format. Newer SDK-style projects typically auto-generate this information, which can lead to conflicts (CS0579) if the project file is later upgraded without removing this file.
|
||||
@@ -0,0 +1,72 @@
|
||||
---
|
||||
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-16T11:03:12.267125+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 WPF XAML markup extension (`TranslateExtension`) that allows UI elements to bind directly to localized strings using a key. The module ensures that the report module can present user-facing text in different languages without hardcoding strings in the UI logic.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `TranslateExtension`
|
||||
**Namespace:** `DTS.Viewer.PSDReport`
|
||||
**Inheritance:** `System.Windows.Markup.MarkupExtension`
|
||||
|
||||
This class allows XAML bindings to retrieve localized strings declaratively.
|
||||
|
||||
* **Constructor: `TranslateExtension(string key)`**
|
||||
* Initializes the extension with the resource key to be looked up.
|
||||
* **Method: `ProvideValue(IServiceProvider serviceProvider)`**
|
||||
* **Return Type:** `object` (attributed to return `string`)
|
||||
* **Behavior:** Looks up the provided `_key` via `StringResources.ResourceManager`. Returns the localized string if found. If the key is null or empty, it returns the constant `"#stringnotfound#"`. If the lookup fails (returns null), it returns `"#stringnotfound# "` appended with the missing key name.
|
||||
|
||||
### Class: `StringResources`
|
||||
**Namespace:** `DTS.Viewer.PSDReport.Resources`
|
||||
**Accessibility:** `internal`
|
||||
|
||||
This is a strongly-typed, auto-generated resource class for looking up culture-specific strings.
|
||||
|
||||
* **Property: `ResourceManager`** (static, `System.Resources.ResourceManager`)
|
||||
* Returns the cached `ResourceManager` instance for this assembly. It is lazily initialized upon first access.
|
||||
* **Property: `Culture`** (static, `System.Globalization.CultureInfo`)
|
||||
* Gets or sets the current UI culture used for resource lookups. This overrides the current thread's `CurrentUICulture` for resource lookups via this class.
|
||||
* **Resource Accessors** (static, `string`)
|
||||
* The following properties return localized strings corresponding to their keys:
|
||||
* `DataHeader` ("Data")
|
||||
* `DataSelectionHeader` ("Data selection")
|
||||
* `GraphsDefaultTitle` ("Graphs ")
|
||||
* `ModificationsHeader` ("Modify")
|
||||
* `PSDHeader` ("PSD")
|
||||
* `PSDResultsHeader` ("Results")
|
||||
* `PSDSettingsHeader` ("PSD Settings")
|
||||
* `SettingsTitle` ("Settings")
|
||||
* `TestsDefaultTitle` ("Tests ")
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
* **Fallback Behavior:** `TranslateExtension.ProvideValue` will never return `null`. It guarantees a string return, defaulting to the literal `"#stringnotfound#"` (with optional key suffix) for missing or invalid keys.
|
||||
* **Auto-generation:** `StringResources` is auto-generated. Manual modifications to `StringResources.Designer.cs` will be lost upon regeneration. The source of truth is the corresponding `.resx` file.
|
||||
* **Internal Visibility:** `StringResources` is marked `internal`, restricting access to within the `DTS.Viewer.PSDReport` assembly.
|
||||
* **Thread Safety:** The `ResourceManager` property in `StringResources` uses a standard lazy initialization check (`object.ReferenceEquals(resourceMan, null)`). While standard for generated code, it is not strictly thread-safe in a race condition scenario (though usually harmless for resource managers).
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
* **Internal Dependencies:**
|
||||
* `TranslateExtension` depends on `StringResources` (specifically `StringResources.ResourceManager`) to perform lookups.
|
||||
* **External Framework Dependencies:**
|
||||
* `System.Windows.Markup`: Required for `MarkupExtension` and `MarkupExtensionReturnTypeAttribute` (implies a dependency on WPF/WindowsBase).
|
||||
* `System.Resources`: Required for `ResourceManager`.
|
||||
* `System.Globalization`: Required for `CultureInfo`.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
* **Dynamic vs. Strongly-typed Access:** `TranslateExtension` uses `ResourceManager.GetString` (dynamic lookup by string) rather than the strongly-typed properties (e.g., `StringResources.DataHeader`). This means typos in XAML keys will not cause compile-time errors but will result in the `"#stringnotfound#"` fallback string appearing in the UI at runtime.
|
||||
* **Missing Source File:** The actual translation values (key-value pairs) reside in a `.resx` file (e.g., `StringResources.resx`) which is not included in the provided source. The default English values shown in the XML comments (e.g., "Data", "Graphs ") are the only insight into the actual content.
|
||||
* **Trailing Spaces:** The default values for `GraphsDefaultTitle` ("Graphs ") and `TestsDefaultTitle` ("Tests ") appear to contain trailing spaces in the auto-generated comments. It is unclear if this is intentional or a data artifact without seeing the `.resx` file.
|
||||
@@ -0,0 +1,83 @@
|
||||
---
|
||||
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-16T11:03:50.028977+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 (Power Spectral Density) Report feature within the DTS Viewer application. It contains two partial classes that serve as code-behind for XAML views: `PSDReportMainView` acts as a minimal container view, while `PSDReportMainViewGrid` manages tab focus behavior in response to graph loading events via Prism's event aggregation system.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `PSDReportMainView` (class)
|
||||
**Implements:** `IPSDReportMainView`
|
||||
|
||||
**Location:** `DTS.Viewer.PSDReport` namespace
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public PSDReportMainView()` | Initializes the XAML component. Contains commented-out code for AvalonDock layout serialization. |
|
||||
|
||||
---
|
||||
|
||||
### `PSDReportMainViewGrid` (class)
|
||||
**Implements:** `IPSDReportMainViewGrid`
|
||||
|
||||
**Location:** `DTS.Viewer.PSDReport` namespace
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public PSDReportMainViewGrid()` | Initializes the XAML component and attaches a `Loaded` event handler. |
|
||||
| `_eventAggregator` | `private IEventAggregator` | Backing field for the Prism event aggregator, resolved at runtime. |
|
||||
| `SetFocus` | `private void SetFocus()` | Selects and focuses the `chartResultsTab` element. |
|
||||
| `PSDReportMainViewGrid_Loaded` | `private void PSDReportMainViewGrid_Loaded(object sender, RoutedEventArgs e)` | Resolves `IEventAggregator` from the container and subscribes to `GraphLoadedCountNotification` events. |
|
||||
| `OnGraphLoadedCountNotification` | `private void OnGraphLoadedCountNotification(GraphLoadedCountNotificationArg arg)` | Event handler that waits 3 seconds then sets focus to the chart results tab via `Dispatcher.BeginInvoke`. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Container Availability:** `PSDReportMainViewGrid` requires `ContainerLocator.Container` to be properly initialized before the `Loaded` event fires, otherwise `_eventAggregator` will be null.
|
||||
- **DataContext Type:** The `DataContext` of `PSDReportMainViewGrid` must be castable to `IBaseViewModel` for the event filtering logic in `OnGraphLoadedCountNotification` to function correctly.
|
||||
- **XAML Element Existence:** The `chartResultsTab` element (referenced in `SetFocus()`) must be defined in the associated XAML file.
|
||||
- **Event Matching:** The `OnGraphLoadedCountNotification` handler only executes its focus logic when `arg.ParentVM` matches the view's `DataContext` (after casting to `IBaseViewModel`).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Interface` — Provides `IPSDReportMainView`, `IPSDReportMainViewGrid`, and `IBaseViewModel`
|
||||
- `DTS.Common.Base` — Referenced but specific types not visible in code-behind
|
||||
- `DTS.Common.Events` — Provides `GraphLoadedCountNotification` event and `GraphLoadedCountNotificationArg`
|
||||
- `Prism.Ioc` — Provides `ContainerLocator` for service resolution
|
||||
- `Prism.Events` — Provides `IEventAggregator` for pub/sub messaging
|
||||
- `System` — `Action` delegate
|
||||
- `System.Threading` — `Thread.Sleep`
|
||||
- `System.Threading.Tasks` — `Task.Run`
|
||||
|
||||
### What depends on this module:
|
||||
- Not determinable from the provided source files alone. Consumers would be modules that instantiate `IPSDReportMainView` or `IPSDReportMainViewGrid` (likely via dependency injection or navigation).
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Hardcoded 3-Second Delay:** The `OnGraphLoadedCountNotification` method uses `Thread.Sleep(TimeSpan.FromSeconds(3))` before setting focus. This is a magic number with no configuration or explanation—likely a workaround for timing issues with graph rendering completion.
|
||||
|
||||
2. **Commented-Out AvalonDock Code:** `PSDReportMainView` contains significant commented-out code for layout serialization using `XmlLayoutSerializer` and a file path `.\DataProViewerAvalonDock.config`. This suggests dock panel persistence was previously implemented but intentionally disabled.
|
||||
|
||||
3. **Late Event Subscription:** Per the comment "FB 14797", the event subscription occurs in the `Loaded` event handler rather than the constructor. This means any `GraphLoadedCountNotification` events fired before the view is fully loaded will be missed.
|
||||
|
||||
4. **Silent Failure on Container Resolution:** The `_eventAggregator?.GetEvent<...>()` call uses a null-conditional operator. If `ContainerLocator.Container.Resolve<IEventAggregator>()` returns null, the subscription silently fails with no logging or error handling.
|
||||
|
||||
5. **Dispatcher Threading:** The focus operation is marshaled to the UI thread via `Dispatcher.BeginInvoke`, but the 3-second sleep runs on a background thread via `Task.Run`. This is intentional but could be a source of race conditions if the view is unloaded during the wait period.
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReport/ViewModel/PSDReportMainViewModel.cs
|
||||
generated_at: "2026-04-16T11:03:20.289994+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "280cd655454826b4"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportMainViewModel
|
||||
|
||||
## 1. Purpose
|
||||
The `PSDReportMainViewModel` class serves as the primary view model for the PSD Report module within the DTS Viewer application. It acts as a central coordinator, managing the lifecycle and composition of various child views (graphs, tests, settings, navigation) via Prism's RegionManager and Unity dependency injection. This module handles user interactions related to data selection, calibration settings, and channel view modes, while maintaining state for loaded and selected tests/graphs and communicating changes to other components via an `IEventAggregator`.
|
||||
|
||||
## 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`), and sets the DataContext.
|
||||
|
||||
### Properties
|
||||
* `IBaseView View { get; set; }`: Gets or sets the associated view instance.
|
||||
* `InteractionRequest<Notification> NotificationRequest { get; }`: Request object for triggering notifications.
|
||||
* `InteractionRequest<Confirmation> ConfirmationRequest { get; }`: Request object for triggering confirmation dialogs.
|
||||
* **Region Context Properties**:
|
||||
* `object ContextNavigationRegion`: Content for the Navigation region.
|
||||
* `object ContextGraphsRegion`: Content for the GraphList region. **Note:** Getter/Setter references `GraphListRegion`.
|
||||
* `object ContextGraphListRegion`: Content for the GraphList region. **Note:** Identical to `ContextGraphsRegion`.
|
||||
* `object ContextTestsRegion`: Content for the Tests region.
|
||||
* `object ContextLegendRegion`: Content for the Legend region.
|
||||
* `object ContextPropertyRegion`: Auto-property; does not appear to interact with the View.
|
||||
* `object ContextChartOptionsRegion`: Content for the ChartOptions region.
|
||||
* `object ContextViewerSettingsRegion`: Content for the Settings region.
|
||||
* `object ContextReportDataSelectRegion`: Content for the DataSelect region.
|
||||
* `object ContextGraphRegion`: Content for the Graph region.
|
||||
* `object ContextReportChartOptionsRegion`: Content for the ReportChartOptions region.
|
||||
* `object ContextReportResultsRegion`: Content for the ReportResults region.
|
||||
* `string ConfigPath { get; set; }`: Throws `NotImplementedException`.
|
||||
* `string TitleTests { get; set; }`: Title for the Tests section, updated based on selection counts.
|
||||
* `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.
|
||||
* `int TotalLoadedGraphs { get; set; }`: Count of loaded graphs.
|
||||
* `string SelectedDataFolder { get; set; }`: Sets the data folder and publishes `DataFolderChangedEvent`. Ignores null/empty values.
|
||||
* `string SelectedDataFile { get; set; }`: Sets the data file and publishes `DataFolderChangedEvent`. Ignores null/empty values.
|
||||
* `IsoViewMode ChannelCodeViewMode { get; set; }`: Gets or sets the channel view mode; publishes `ChannelCodesViewChangedEvent`.
|
||||
* `CalibrationBehaviors CalibrationBehaviorSetting { get; set; }`: Gets or sets calibration behavior; publishes `CalibrationBehaviorSettingChangedEvent`.
|
||||
* `bool CalibrationBehaviorSettableInViewer { get; set; }`: Determines if calibration is settable; publishes `CalibrationBehaviorSettableInViewerChangedEvent` and manipulates View tab selection directly.
|
||||
* `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; }`: Flag for menu inclusion.
|
||||
* `bool IsNavigationIncluded { get; set; }`: Flag for navigation inclusion.
|
||||
* `bool IsDirty`: 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, updates parent properties, and subscribes to events.
|
||||
* `void LeftKeyPress()`: Throws `NotImplementedException`.
|
||||
* `void RightKeyPress()`: Throws `NotImplementedException`.
|
||||
* `void ZoomReset()`: Publishes `ResetZoomChangedEvent`.
|
||||
* `void SelectAndIncludeDataFile(string value)`: Sets the selected file and publishes a `DataFolderChangedEvent` with `SetSelected` flag.
|
||||
* `event PropertyChangedEventHandler PropertyChanged`: Event for property change notifications (hides base event).
|
||||
|
||||
## 3. Invariants
|
||||
* **View Resolution**: The `View` property is expected to be an instance of `PSDReportMainViewGrid` (resolved via `IPSDReportMainViewGrid`). All region properties cast `View` to this concrete type, implying the interface `IPSDReportMainViewGrid` is not used for region access, or the concrete type is strictly required for UI element access.
|
||||
* **Event Aggregator**: The class relies heavily on `_eventAggregator` being non-null for almost all property setters and initialization logic.
|
||||
* **Parent Type**: In `Initialize(object parameter)`, the `parameter` must be castable to `IBaseWindowModel`.
|
||||
* **Busy Counter**: The private `reads` integer is used to track nested "busy" states during graph channel reading; it assumes a balanced start/stop notification pattern.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### External Dependencies (Inferred from usings)
|
||||
* **Prism**: `IEventAggregator`, `IRegionManager`, `InteractionRequest`, `Notification`, `Confirmation`.
|
||||
* **Unity**: `IUnityContainer`.
|
||||
* **System.Windows**: `FrameworkElement`, `Visibility`.
|
||||
|
||||
### Internal Dependencies (DTS Namespace)
|
||||
* **Common**: `BaseViewModel`, `IBaseView`, `IBaseWindowModel`, `IBaseViewModel`, `Utils`.
|
||||
* **Enums**: `IsoViewMode`, `CalibrationBehaviors`.
|
||||
* **Events**: `DataFolderChangedEvent`, `ChannelCodesViewChangedEvent`, `CalibrationBehaviorSettingChangedEvent`, `LoadViewModulEvent`, `TestLoadedCountNotification`, etc.
|
||||
* **Views/ViewModels (Resolved via Unity)**:
|
||||
* `IPSDReportMainViewGrid`
|
||||
* `INavigationView` / `INavigationViewModel`
|
||||
* `IPSDReportResultsView` / `IPSDReportResultsViewModel`
|
||||
* `IPSDReportSettingsView` / `IPSDReportSettingsViewModel`
|
||||
* `IChartOptionsView` / `IChartOptionsViewModel`
|
||||
* `IGraphView` / `IGraphViewModel`
|
||||
* `IGraphMainView` / `IGraphMainViewModel`
|
||||
* `IViewerSettingsView` / `IViewerSettingsViewModel`
|
||||
* `ITestSummaryListView` / `ITestSummaryListViewModel`
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
* **Not Implemented Members**: Several members throw `NotImplementedException` (`ConfigPath`, `IsDirty`, `LeftKeyPress`, `RightKeyPress`). These are likely interface requirements that have not been fulfilled.
|
||||
* **Duplicate Region Properties**: `ContextGraphsRegion` and `ContextGraphListRegion` are functionally identical; both access `((PSDReportMainViewGrid)View).GraphListRegion.Content`. This may be a copy-paste error or redundant API surface.
|
||||
* **MVVM Violation (View Coupling)**: The `CalibrationBehaviorSettableInViewer` setter directly manipulates View UI elements (`graphsTab`, `testsTab`, `chartResultsTab`) by casting `View` to `PSDReportMainViewGrid`. This breaks the separation of concerns typically enforced in MVVM and creates a hard dependency on the concrete View type.
|
||||
* **Member Hiding**: The `new` keyword is used to hide inherited members (`IsBusy`, `IsBusyMessage`, `IsMenuIncluded`, `IsNavigationIncluded`, `PropertyChanged`, `OnPropertyChanged`). This suggests a mismatch between the base class implementation and the requirements of this specific view model, which could lead to confusion if the object is referenced via a base type pointer.
|
||||
* **Unused Property**: `ContextPropertyRegion` is defined as an auto-property but is never assigned or used within the class logic, unlike other region properties.
|
||||
* **Magic Strings**: Region names (e.g., "Graph", "DataSelect") and property names in `OnPropertyChanged` are passed as string literals.
|
||||
@@ -0,0 +1,96 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/PSDReportResultsModule.cs
|
||||
generated_at: "2026-04-16T10:59:25.221294+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1cb458d29a5aed08"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportResultsModule
|
||||
|
||||
## 1. Purpose
|
||||
This module serves as the entry point for the "PSD Report Results" component within the DTS Viewer application. It is a Prism Module (`PSDReportResultsModule`) responsible for registering its associated View and ViewModel implementations with the Unity dependency injection container. Additionally, it defines assembly-level attributes to expose metadata (name, image, group, and region) to the broader application, likely for dynamic UI generation or navigation purposes.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `PSDReportResultsModule`
|
||||
Implements `Prism.Modularity.IModule`.
|
||||
|
||||
* **`PSDReportResultsModule(IUnityContainer unityContainer)`**
|
||||
* Constructor that accepts an `IUnityContainer` instance and stores it in a readonly field `_unityContainer`.
|
||||
|
||||
* **`void Initialize()`**
|
||||
* Registers types with the Unity container.
|
||||
* Maps `IPSDReportResultsViewModel` to `PSDReportResultsViewModel`.
|
||||
* Maps `IPSDReportResultsView` to `PSDReportResultsView`.
|
||||
|
||||
* **`void OnInitialized(IContainerProvider containerProvider)`**
|
||||
* Implementation of `IModule.OnInitialized`. Currently has an empty body (no logic executed).
|
||||
|
||||
* **`void RegisterTypes(IContainerRegistry containerRegistry)`**
|
||||
* Implementation of `IModule.RegisterTypes`. Invokes the `Initialize()` method to perform dependency registration.
|
||||
|
||||
### Class: `PSDReportResultsModuleNameAttribute`
|
||||
Inherits from `DTS.Common.Interface.TextAttribute`.
|
||||
|
||||
* **`PSDReportResultsModuleNameAttribute()`**
|
||||
* Default constructor.
|
||||
* **`PSDReportResultsModuleNameAttribute(string s)`**
|
||||
* Constructor accepting a string argument `s` (which is unused in the body).
|
||||
* **`override string AssemblyName { get; }`**
|
||||
* Returns the string representation of `DTS.Common.AssemblyNames.PSDReportResults`.
|
||||
* **`override Type GetAttributeType()`**
|
||||
* Returns `typeof(TextAttribute)`.
|
||||
* **`override string GetAssemblyName()`**
|
||||
* Returns the `AssemblyName` property value.
|
||||
|
||||
### Class: `PSDReportResultsModuleImageAttribute`
|
||||
Inherits from `DTS.Common.Interface.ImageAttribute`.
|
||||
|
||||
* **`PSDReportResultsModuleImageAttribute()`**
|
||||
* Default constructor.
|
||||
* **`PSDReportResultsModuleImageAttribute(string s)`**
|
||||
* Constructor accepting a string argument `s`. Initializes the private `_img` field via `AssemblyInfo.GetImage`.
|
||||
* **`override BitmapImage AssemblyImage { get; }`**
|
||||
* Getter initializes (if null) and returns a `BitmapImage` retrieved via `AssemblyInfo.GetImage`.
|
||||
* **`override string AssemblyName { get; }`**
|
||||
* Returns the string representation of `DTS.Common.AssemblyNames.PSDReportResults`.
|
||||
* **`override string AssemblyGroup { get; }`**
|
||||
* Returns the string representation of `DTS.Common.eAssemblyGroups.Viewer`.
|
||||
* **`override eAssemblyRegion AssemblyRegion { get; }`**
|
||||
* Returns `DTS.Common.eAssemblyRegion.PSDReportResultsRegion`.
|
||||
* **`override Type GetAttributeType()`**
|
||||
* Returns `typeof(ImageAttribute)`.
|
||||
* **`override BitmapImage GetAssemblyImage()`**
|
||||
* Returns the `AssemblyImage` property.
|
||||
* **`override string GetAssemblyName()`**
|
||||
* Returns the `AssemblyName` property.
|
||||
* **`override string GetAssemblyGroup()`**
|
||||
* Returns the `AssemblyGroup` property.
|
||||
* **`override eAssemblyRegion GetAssemblyRegion()`**
|
||||
* Returns the `AssemblyRegion` property.
|
||||
|
||||
## 3. Invariants
|
||||
* **Module Name:** The Prism module name is fixed as `"PSDReportResults"` via the `[Module]` attribute.
|
||||
* **Assembly Group:** The module always identifies itself as part of the `Viewer` group via `eAssemblyGroups.Viewer`.
|
||||
* **Assembly Region:** The module is always associated with `eAssemblyRegion.PSDReportResultsRegion`.
|
||||
* **Type Registration:** The `IPSDReportResultsView` and `IPSDReportResultsViewModel` interfaces are strictly mapped to their concrete implementations `PSDReportResultsView` and `PSDReportResultsViewModel` respectively.
|
||||
|
||||
## 4. Dependencies
|
||||
**Internal Dependencies (referenced types):**
|
||||
* `DTS.Common`: Uses `AssemblyNames` enum.
|
||||
* `DTS.Common.Interface`: Uses `TextAttribute`, `ImageAttribute`, `AssemblyInfo`, `eAssemblyGroups`, and `eAssemblyRegion`.
|
||||
* `DTS.Viewer.PSDReportResults`: Contains the concrete `PSDReportResultsView` and `PSDReportResultsViewModel` (inferred from registration calls, though the namespace matches the file).
|
||||
|
||||
**External Frameworks:**
|
||||
* `Prism.Ioc`: Uses `IContainerProvider`.
|
||||
* `Prism.Modularity`: Uses `IModule`, `ModuleAttribute`.
|
||||
* `Unity`: Uses `IUnityContainer`.
|
||||
* `System.Windows.Media.Imaging`: Uses `BitmapImage`.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Redundant Initialization Logic:** The `RegisterTypes` method calls `Initialize()`. This is unusual; typically, `RegisterTypes` uses the passed `IContainerRegistry` argument for registration, while `Initialize` uses the injected `IUnityContainer`. Here, the module ignores the `IContainerRegistry` argument and relies on the injected `_unityContainer` inside `Initialize`. This mixes Prism's modular initialization lifecycle with direct Unity container usage.
|
||||
* **Unused Constructor Parameters:** Both attribute classes (`PSDReportResultsModuleNameAttribute` and `PSDReportResultsModuleImageAttribute`) have constructors accepting a `string s` parameter. In both cases, this parameter is completely ignored in the implementation.
|
||||
* **Property Side Effects:** The getter for `PSDReportResultsModuleImageAttribute.AssemblyImage` has a side effect: it assigns a value to the private `_img` field if accessed. While the constructor also attempts to set this, the property getter logic `_img = ...; return _img;` will re-fetch the image every time if `_img` is null, or overwrite it if called repeatedly (though the logic implies it just returns it after assignment).
|
||||
* **Empty Lifecycle Hook:** `OnInitialized` is explicitly empty. If initialization logic were required to run after container registration, it would need to be added here, but currently, it does nothing.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T11:02:08.508418+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "a578e8bbaedafe8e"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.PSDReportResults Assembly Configuration
|
||||
|
||||
## 1. Purpose
|
||||
This source file provides assembly-level metadata and configuration attributes for the `DTS.Viewer.PSDReportResults` library. It defines the assembly's identity, version information, and COM visibility settings within the larger "DTS Viewer" application ecosystem. It exists to embed standard .NET assembly information into the compiled DLL.
|
||||
|
||||
## 2. Public Interface
|
||||
This file does not contain public classes, methods, or functions. It strictly defines assembly-level attributes using C# attribute syntax.
|
||||
|
||||
**Defined Attributes:**
|
||||
|
||||
* **`AssemblyTitle`**: Set to `"DTS.Viewer.PSDReportResults"`.
|
||||
* **`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.
|
||||
* **`ComVisible`**: Set to `false`. Prevents types in this assembly from being visible to COM components.
|
||||
* **`Guid`**: Set to `"486af003-0dec-4b05-a7a5-39e6ca9ec629"`. Acts as the ID for the type library if the project is exposed to COM.
|
||||
* **`AssemblyVersion`**: Set to `"1.0.0.0"`.
|
||||
* **`AssemblyFileVersion`**: Set to `"1.0.0.0"`.
|
||||
|
||||
## 3. Invariants
|
||||
* **COM Visibility:** The `ComVisible(false)` attribute ensures that all types within this assembly are not exposed to COM by default. To expose a specific type, that type must be explicitly marked with `ComVisible(true)`.
|
||||
* **Versioning:** Both the assembly version and file version are currently fixed at `1.0.0.0`.
|
||||
* **Identity:** The `Guid` attribute provides a unique identifier for this specific assembly, which remains constant regardless of version changes.
|
||||
|
||||
## 4. Dependencies
|
||||
**Internal Dependencies (Imports):**
|
||||
* `System.Reflection`: Required for the assembly attribute classes (e.g., `AssemblyTitleAttribute`, `AssemblyVersionAttribute`).
|
||||
* `System.Runtime.CompilerServices`: Imported by default in standard AssemblyInfo templates, though no specific attributes from this namespace are used in this file.
|
||||
* `System.Runtime.InteropServices`: Required for the `ComVisible` and `Guid` attributes.
|
||||
|
||||
**External Dependencies:**
|
||||
* None identified from this source file alone. The specific runtime or logic dependencies of the `DTS.Viewer.PSDReportResults` assembly are not defined here.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Missing Metadata:** The `AssemblyDescription`, `AssemblyConfiguration`, and `AssemblyCompany` attributes are explicitly set to empty strings. This may result in missing metadata in the compiled DLL properties, which can be problematic for internal tooling or inventory management.
|
||||
* **Hardcoded Versions:** The `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `"1.0.0.0"`. If the project uses Continuous Integration (CI) for automatic versioning, this file may need to be ignored or modified during the build process; otherwise, every build will report as version 1.0.0.0.
|
||||
* **Legacy Structure:** The presence of an explicit `AssemblyInfo.cs` suggests this project may be using the older .NET Framework SDK style project format. Newer SDK-style projects typically auto-generate this information in the `.csproj` file, though this file can still be used if the project is configured to not auto-generate assembly info.
|
||||
@@ -0,0 +1,92 @@
|
||||
---
|
||||
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-16T11:02:06.405832+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 component. 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 within XAML markup.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TranslateExtension`
|
||||
**Location:** `DTS.Viewer.PSDReportResults.Resources.TranslateExtension`
|
||||
**Inheritance:** `System.Windows.Markup.MarkupExtension`
|
||||
|
||||
A XAML markup extension used to resolve localized strings at runtime.
|
||||
|
||||
* **Constructor**
|
||||
```csharp
|
||||
public TranslateExtension(string key)
|
||||
```
|
||||
Initializes the extension with the resource key to be looked up. The key is stored in a private readonly field `_key`.
|
||||
|
||||
* **Method: ProvideValue**
|
||||
```csharp
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
```
|
||||
Resolves the localized string for the key provided in the constructor.
|
||||
* Returns `NotFound` ("#stringnotfound#") if the `_key` is null or empty.
|
||||
* Retrieves the string using `StringResources.ResourceManager.GetString(_key)`.
|
||||
* Returns `NotFound + " " + _key` if the resource lookup returns null (key not found in resources).
|
||||
|
||||
### `StringResources`
|
||||
**Location:** `DTS.Viewer.PSDReportResults.Resources.StringResources`
|
||||
**Visibility:** `internal`
|
||||
|
||||
A strongly-typed resource class auto-generated by Visual Studio/ResGen. It provides access to localized strings defined in the associated `.resx` file.
|
||||
|
||||
* **Property: ResourceManager**
|
||||
```csharp
|
||||
internal static global::System.Resources.ResourceManager ResourceManager { get; }
|
||||
```
|
||||
Returns the cached `ResourceManager` instance for this assembly. It looks up resources named `"DTS.Viewer.PSDReportResults.Resources.StringResources"`.
|
||||
|
||||
* **Property: Culture**
|
||||
```csharp
|
||||
internal static global::System.Globalization.CultureInfo Culture { get; set; }
|
||||
```
|
||||
Gets or sets the current `CultureInfo` for resource lookups. Overrides the current thread's `CurrentUICulture` for this specific resource class.
|
||||
|
||||
* **Resource Properties (Static Strings)**
|
||||
The following static properties return localized strings:
|
||||
* `ChannelName` (Lookup key: "ChannelName")
|
||||
* `ExportPSDHeader` (Lookup key: "ExportPSDHeader")
|
||||
* `ExportPSDtoCSV` (Lookup key: "ExportPSDtoCSV")
|
||||
* `ExportPSDtoPDF` (Lookup key: "ExportPSDtoPDF")
|
||||
* `GRMS` (Lookup key: "GRMS")
|
||||
* `PSDResultsHeader` (Lookup key: "PSDResultsHeader")
|
||||
* `SampleRate` (Lookup key: "SampleRate")
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
* **Auto-generation:** The `StringResources` class is auto-generated. Manual modifications to `StringResources.Designer.cs` will be lost upon regeneration. Changes must be made to the underlying `.resx` file.
|
||||
* **Return Types:** `TranslateExtension` is decorated with `[MarkupExtensionReturnType(typeof(string))]`, guaranteeing that `ProvideValue` returns a string (or the fallback error string).
|
||||
* **Fallback Behavior:** `TranslateExtension` will never return `null`. It guarantees a string return, either the localized value or a specific error constant.
|
||||
* **Visibility:** `StringResources` is `internal`, restricting access to the `DTS.Viewer.PSDReportResults` assembly.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
* **Internal Dependencies:**
|
||||
* `TranslateExtension` depends entirely on `StringResources.ResourceManager` to perform lookups.
|
||||
* **External Dependencies (Framework):**
|
||||
* `System`
|
||||
* `System.Windows.Markup` (for `MarkupExtension` and `IServiceProvider`)
|
||||
* `System.Resources` (for `ResourceManager`)
|
||||
* `System.Globalization` (for `CultureInfo`)
|
||||
* `System.CodeDom.Compiler` (Attributes on `StringResources`)
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
* **Error String Variations:** The `TranslateExtension` returns different error strings depending on the failure mode.
|
||||
* If the input `_key` is null/empty, it returns exactly `"#stringnotfound#"`.
|
||||
* If the lookup fails (key is valid but missing in resources), it returns `"#stringnotfound# " + _key` (note the space and the appended key).
|
||||
* Developers parsing or validating these strings must account for this difference.
|
||||
* **Designer File Edits:** As noted in the auto-generated header, editing `StringResources.Designer.cs` directly is unsafe. The specific resource strings listed (e.g., `ChannelName`, `GRMS`) are the only ones currently defined; adding new ones requires regenerating this file.
|
||||
* **Culture Management:** `StringResources.Culture` is a static property. Setting it changes the culture for all subsequent lookups within this resource manager, potentially affecting threading behavior if not managed carefully.
|
||||
@@ -0,0 +1,90 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/View/PSDReportResultsView.xaml.cs
|
||||
generated_at: "2026-04-16T11:02:24.723243+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7dcd71bef7b7c279"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportResultsView
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`PSDReportResultsView` is a WPF view component responsible for displaying PSD (likely Power Spectral Density) report results in the DTS Viewer application. It serves as the code-behind for a XAML view and implements the `IPSDReportResultsView` interface, indicating it follows an interface-based architecture pattern—likely for MVP (Model-View-Presenter) or MVVM (Model-View-ViewModel) separation. This module exists to render report data and handle user interactions with the grid view, such as column header clicks and search functionality.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `PSDReportResultsView`
|
||||
|
||||
**Inheritance/Implementation:**
|
||||
- Implements: `IPSDReportResultsView` (from `DTS.Common.Interface`)
|
||||
|
||||
**Constructor:**
|
||||
|
||||
```csharp
|
||||
public PSDReportResultsView()
|
||||
```
|
||||
Initializes a new instance of the view and calls `InitializeComponent()` to load the associated XAML layout.
|
||||
|
||||
---
|
||||
|
||||
### Methods
|
||||
|
||||
#### `GridViewColumnHeader_OnClick`
|
||||
|
||||
```csharp
|
||||
private void GridViewColumnHeader_OnClick(object sender, System.Windows.RoutedEventArgs e)
|
||||
```
|
||||
Event handler for column header click events in a GridView. Currently contains no implementation (empty body).
|
||||
|
||||
**Parameters:**
|
||||
- `sender` - The object that raised the event
|
||||
- `e` - `System.Windows.RoutedEventArgs` containing event data
|
||||
|
||||
---
|
||||
|
||||
#### `GridViewColumnHeaderSearchable_OnSearch`
|
||||
|
||||
```csharp
|
||||
private void GridViewColumnHeaderSearchable_OnSearch(object sender, System.Windows.RoutedEventArgs e)
|
||||
```
|
||||
Event handler for search operations on searchable column headers. Currently contains no implementation (empty body).
|
||||
|
||||
**Parameters:**
|
||||
- `sender` - The object that raised the event
|
||||
- `e` - `System.Windows.RoutedEventArgs` containing event data
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- The class must implement `IPSDReportResultsView` interface contract (specific members not visible in this source).
|
||||
- `InitializeComponent()` must be called in the constructor for the XAML-defined UI to be instantiated.
|
||||
- Both event handlers are `private`, indicating they are wired to XAML events and not intended for external invocation.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `DTS.Common.Interface` — specifically `IPSDReportResultsView` interface
|
||||
- `System.Windows` (implied by `RoutedEventArgs` usage)
|
||||
|
||||
### What depends on this module:
|
||||
- **Cannot be determined from source alone.** The `IPSDReportResultsView` interface suggests a presenter or controller component likely holds a reference to this view, but no consumers are visible in this file.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Empty event handlers:** Both `GridViewColumnHeader_OnClick` and `GridViewColumnHeaderSearchable_OnSearch` have empty implementations. This may indicate:
|
||||
- Incomplete functionality (tech debt)
|
||||
- Placeholder methods for future implementation
|
||||
- Dead code that should be removed if unused in XAML
|
||||
|
||||
- **Interface contract unknown:** The specific members required by `IPSDReportResultsView` are not visible in this source. It is unclear whether the class fully satisfies the interface or if required members are defined elsewhere (e.g., in the XAML partial or another partial class file).
|
||||
|
||||
- **XAML file not provided:** The associated `PSDReportResultsView.xaml` file is not included, so the actual UI structure, data bindings, and event wirings cannot be verified.
|
||||
@@ -0,0 +1,85 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportResults/ViewModel/PSDReportResultsViewModel.cs
|
||||
generated_at: "2026-04-16T11:01:33.528546+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "7cb2cb6c499c73c1"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportResultsViewModel
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`PSDReportResultsViewModel` is a Prism-based view model responsible for displaying PSD (Power Spectral Density) report results, specifically GRMS (Root Mean Square) summary data for channels. It serves as a subscriber to report update events and provides user-initiated export functionality to PDF and CSV formats. The view model participates in a parent-child relationship with another view model (passed during initialization) and filters incoming events to ensure it only processes data intended for its specific context.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Properties
|
||||
|
||||
| Name | Type | Description |
|
||||
|------|------|-------------|
|
||||
| `View` | `IBaseView` | Gets or sets the associated view instance. Assigned in constructor. |
|
||||
| `Parent` | `IBaseViewModel` | Gets or sets the parent view model. Used to filter event subscriptions. Set during `Initialize`. |
|
||||
| `Results` | `ObservableCollection<IChannelGRMSSummary>` | Collection of GRMS summary results displayed to the user. Cleared and repopulated on `PSDReportGRMSValuesUpdatedEvent`. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | Interaction request for showing notifications to the user. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Interaction request for showing confirmation dialogs. Declared with `new` keyword (hides base member). |
|
||||
| `ExportToPDFCommand` | `DelegateCommand` | Command that triggers PDF export by publishing `SaveReportToPDFRequestedEvent`. Lazily instantiated. |
|
||||
| `ExportToCSVCommand` | `DelegateCommand` | Command that triggers CSV export by publishing `SaveReportToCSVRequestedEvent`. Lazily instantiated. |
|
||||
|
||||
### Methods
|
||||
|
||||
| Signature | Description |
|
||||
|-----------|-------------|
|
||||
| `PSDReportResultsViewModel(IPSDReportSettingsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)` | Constructor. Accepts an `IPSDReportSettingsView` (note: not `IPSDReportResultsView`), assigns it to `View`, sets `DataContext` to itself, and initializes interaction requests and service references. |
|
||||
| `override void Initialize(object parameter)` | Initializes the view model. Expects `parameter` to be castable to `IBaseViewModel` (assigned to `Parent`). Creates empty `Results` collection and subscribes to events. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Parent-based event filtering**: Both `OnGRMSValuesUpdated` and `OnGraphSelectedChannelsChanged` check `if (Parent != arg.ParentVM) return;` — events are ignored if the sender's parent view model does not match this instance's parent.
|
||||
|
||||
2. **Results collection lifecycle**: `Results` is instantiated as an empty `ObservableCollection<IChannelGRMSSummary>` in `Initialize`, not in the constructor. It is cleared before repopulation in `OnGRMSValuesUpdated`.
|
||||
|
||||
3. **Directory derivation**: The private `Directory` property is derived from the first selected channel's `BinaryFilePath` with `"Binary"` replaced by `"Reports"` via `ReplaceLast`. If no channels are selected, `Directory` is set to `string.Empty`.
|
||||
|
||||
4. **Lazy command instantiation**: Both `ExportToPDFCommand` and `ExportToCSVCommand` use lazy initialization via null-coalescing pattern.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- **DTS.Common.Base** — `BaseViewModel<T>`
|
||||
- **DTS.Common.Events** — `PSDReportGRMSValuesUpdatedEvent`, `PSDReportGRMSValuesUpdatedEventArg`, `GraphSelectedChannelsNotification`, `GraphSelectedChannelsNotificationArg`, `SaveReportToPDFRequestedEvent`, `SaveReportToPDFRequestedEventArgs`, `SaveReportToCSVRequestedEvent`, `SaveReportToCSVRequestedEventArgs`
|
||||
- **DTS.Common.Interactivity** — `InteractionRequest<T>`, `Notification`, `Confirmation`
|
||||
- **DTS.Common.Interface** — `IBaseView`, `IBaseViewModel`, `IPSDReportResultsViewModel`, `IChannelGRMSSummary`, `ITestChannel`, `IPSDReportSettingsView`
|
||||
- **DTS.Common.Utils** — `ReplaceLast` extension method (inferred from usage on string)
|
||||
- **Prism.Delegates** — `DelegateCommand`
|
||||
- **Prism.Events** — `IEventAggregator`, `ThreadOption`
|
||||
- **Prism.Regions** — `IRegionManager`
|
||||
- **Unity** — `IUnityContainer`
|
||||
- **System.Collections.ObjectModel** — `ObservableCollection<T>`
|
||||
|
||||
### What depends on this module:
|
||||
- Not determinable from this source file alone. Consumers would implement `IPSDReportResultsView` and resolve `IPSDReportResultsViewModel` via the container.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Constructor parameter type mismatch**: The constructor accepts `IPSDReportSettingsView` but the class implements `IPSDReportResultsViewModel`. This appears inconsistent — the view type name suggests "settings" while the view model is for "results". This may be intentional coupling or a copy-paste error.
|
||||
|
||||
2. **Member hiding with `new` keyword**:
|
||||
- `_regionManager` is declared with `new`, hiding the base class's `_regionManager`.
|
||||
- `ConfirmationRequest` is declared with `new`, hiding a base class member.
|
||||
- This suggests the base class `BaseViewModel<T>` already defines these members, and the derived class is overriding them shadow-style rather than using proper override/virtual patterns.
|
||||
|
||||
3. **Unused service references**: `_eventAggregator`, `_unityContainer`, and `_regionManager` are stored as private fields despite the base class constructor already receiving them. The `new` keyword on `_regionManager` indicates potential confusion about inheritance.
|
||||
|
||||
4. **Null-conditional handling inconsistency**: `OnGraphSelectedChannelsChanged` uses null-conditional operators (`arg?.ParentVM`, `arg?.SelectedChannels`) while `OnGRMSValuesUpdated` does not. This suggests different assumptions about event argument nullability.
|
||||
|
||||
5. **Unused imports**: `System.Threading.Tasks` is imported but no async/await or Task usage is present in the file.
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/PSDReportSettingsModule.cs
|
||||
generated_at: "2026-04-16T10:59:04.135002+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 associated View, ViewModel, and Model dependencies with the Unity dependency injection container. Additionally, it defines assembly-level attributes to expose metadata (name, image, grouping, and region) to the main application shell, allowing the module to be discovered and displayed in the UI as an available component.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Classes
|
||||
|
||||
**`PSDReportSettingsModule`**
|
||||
Inherits from: `IModule`
|
||||
* `PSDReportSettingsModule(IUnityContainer unityContainer)`: Constructor that accepts a `IUnityContainer` instance and stores it in a readonly field.
|
||||
* `void RegisterTypes(IContainerRegistry containerRegistry)`: Implements `IModule.RegisterTypes`. Executes the `Initialize()` method to register types with the container.
|
||||
* `void OnInitialized(IContainerProvider containerProvider)`: Implements `IModule.OnInitialized`. Currently contains no implementation logic.
|
||||
* `void Initialize()`: Registers the following interface-to-concrete-type mappings using the injected `_unityContainer`:
|
||||
* `IPSDReportSettingsViewModel` → `PSDReportSettingsViewModel`
|
||||
* `IPSDReportSettingsModel` → `PSDReportSettingsModel`
|
||||
* `IPSDReportSettingsView` → `PSDReportSettingsView`
|
||||
|
||||
**`PSDReportSettingsModuleNameAttribute`**
|
||||
Inherits from: `TextAttribute`
|
||||
* `[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]`
|
||||
* `PSDReportSettingsModuleNameAttribute()`: Default constructor.
|
||||
* `PSDReportSettingsModuleNameAttribute(string s)`: Overloaded constructor (parameter `s` is unused).
|
||||
* `string AssemblyName { get; }`: Overrides the base property. Returns the string representation of `AssemblyNames.PSDReportSettings`.
|
||||
* `Type GetAttributeType()`: Returns `typeof(TextAttribute)`.
|
||||
* `string GetAssemblyName()`: Returns the value of the `AssemblyName` property.
|
||||
|
||||
**`PSDReportSettingsModuleImageAttribute`**
|
||||
Inherits from: `ImageAttribute`
|
||||
* `[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]`
|
||||
* `PSDReportSettingsModuleImageAttribute()`: Default constructor.
|
||||
* `PSDReportSettingsModuleImageAttribute(string s)`: Overloaded constructor (parameter `s` is unused).
|
||||
* `BitmapImage AssemblyImage { get; }`: Returns a `BitmapImage` retrieved via `AssemblyInfo.GetImage(AssemblyNames.PSDReportSettings.ToString())`.
|
||||
* `string AssemblyName { get; }`: Returns the string representation of `AssemblyNames.PSDReportSettings`.
|
||||
* `string AssemblyGroup { get; }`: Returns `eAssemblyGroups.Viewer.ToString()`.
|
||||
* `eAssemblyRegion AssemblyRegion { get; }`: Returns `eAssemblyRegion.PSDReportSettingsRegion`.
|
||||
* `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 module is identified by the string `"PSDReportSettings"` in the `[Module]` attribute.
|
||||
* **Assembly Group:** The module belongs to the `Viewer` assembly group (defined by `eAssemblyGroups.Viewer`).
|
||||
* **Region:** The module is associated with the `PSDReportSettingsRegion` (defined by `eAssemblyRegion.PSDReportSettingsRegion`).
|
||||
* **Registration:** The types `IPSDReportSettingsViewModel`, `IPSDReportSettingsModel`, and `IPSDReportSettingsView` are registered with the Unity container as transient types (default `RegisterType` behavior) upon module initialization.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**Internal Dependencies (referenced types):**
|
||||
* `DTS.Common`: Uses `AssemblyNames` enum.
|
||||
* `DTS.Common.Interface`: Uses `TextAttribute`, `ImageAttribute`, `eAssemblyGroups`, `eAssemblyRegion`. Also implies the existence of `IPSDReportSettingsViewModel`, `IPSDReportSettingsModel`, and `IPSDReportSettingsView` interfaces.
|
||||
* `DTS.Viewer.PSDReportSettings`: Uses `PSDReportSettingsViewModel`, `PSDReportSettingsModel`, `PSDReportSettingsView` concrete classes and `AssemblyInfo` static class.
|
||||
|
||||
**External Frameworks:**
|
||||
* `Prism.Ioc`: Uses `IContainerProvider`, `IContainerRegistry`.
|
||||
* `Prism.Modularity`: Uses `IModule`, `ModuleAttribute`.
|
||||
* `Unity`: Uses `IUnityContainer`.
|
||||
* `System.Windows.Media.Imaging`: Uses `BitmapImage`.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Ignored Constructor Parameters:** Both `PSDReportSettingsModuleNameAttribute` and `PSDReportSettingsModuleImageAttribute` have constructors that accept a `string s` parameter, but this parameter is completely ignored in the logic. It is unclear why this parameter exists.
|
||||
* **Mixed Container Usage:** The `RegisterTypes` method receives an `IContainerRegistry` (Prism abstraction) but the actual registration logic inside `Initialize()` uses the injected `IUnityContainer` (Unity specific). This bypasses the Prism abstraction layer, which could cause issues if the container implementation details differ or if the container wrapper is expected to manage lifestyle scopes.
|
||||
* **Property Getter Side Effects:** In `PSDReportSettingsModuleImageAttribute`, the `AssemblyImage` property getter performs a method call `AssemblyInfo.GetImage(...)` and assigns it to the private field `_img` every time the getter is accessed. This is not a pure getter; it causes a new image lookup (and potentially a new object allocation) on every read access, rather than returning a cached value.
|
||||
* **Empty OnInitialized:** The `OnInitialized` method is empty. If the module requires runtime initialization logic (like starting services or registering region views), it is not present here. The module currently only performs type registration.
|
||||
@@ -0,0 +1,99 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Model/PSDReportSettingsModel.cs
|
||||
generated_at: "2026-04-16T11:01:19.271156+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "b9213b8d6a0e210e"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportSettingsModel
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`PSDReportSettingsModel` is a model class that stores and manages configuration settings for Power Spectral Density (PSD) report generation within the DTS Viewer application. It encapsulates filter parameters (low-pass and high-pass), windowing configuration (width, type, averaging, overlapping), and data range boundaries. The class implements `INotifyPropertyChanged` via `BasePropertyChanged` and coordinates with a parent view model through the `IPSDReportSettingsModel` interface, automatically notifying the parent of changes when `CanPublishChanges` is enabled.
|
||||
|
||||
---
|
||||
|
||||
## 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 updates. |
|
||||
| `CanPublishChanges` | `bool` | `true` | Controls whether property changes trigger `Parent.PublishChanges()` notification. |
|
||||
| `LowPassFilterEnabled` | `bool` | `false` | Enables/disables low-pass filter. Sets `ReadData = true` on change. |
|
||||
| `LowPassFilterFrequency` | `double` | `2000` | Low-pass filter cutoff frequency. Sets `ReadData = true` on change. |
|
||||
| `LowPassFilterType` | `PassFilterType` | `PassFilterType.Butterworth` | Low-pass filter algorithm type. Sets `ReadData = true` on change. |
|
||||
| `LowPassFilterOrder` | `int` | `8` | Low-pass filter order. Sets `ReadData = true` on change. |
|
||||
| `HighPassFilterEnabled` | `bool` | `false` | Enables/disables high-pass filter. Sets `ReadData = true` on change. |
|
||||
| `HighPassFilterFrequency` | `double` | `5` | High-pass filter cutoff frequency. Sets `ReadData = true` on change. |
|
||||
| `HighPassFilterType` | `PassFilterType` | `PassFilterType.Butterworth` | High-pass filter algorithm type. Sets `ReadData = true` on change. |
|
||||
| `HighPassFilterOrder` | `int` | `8` | High-pass filter order. Sets `ReadData = true` on change. |
|
||||
| `WindowWidth` | `WindowWidth` | `WindowWidth.FortyNinetySix` | Window width for spectral analysis. Sets `ReadData = true` on change. |
|
||||
| `WindowType` | `WindowType` | `WindowType.Hanning` | Window function type. Sets `ReadData = true` on change. |
|
||||
| `WindowAveragingType` | `WindowAveragingType` | `WindowAveragingType.Averaging` | Averaging method for windows. Sets `ReadData = true` on change. |
|
||||
| `WindowOverlappingPercent` | `double` | `50` | Window overlap percentage. Sets `ReadData = true` on change. |
|
||||
| `ShowEnvelope` | `bool` | `false` | Controls envelope display. Sets `ReadData = true` on change. |
|
||||
| `IsSaved` | `bool` | *(not visible)* | Read-only property indicating save state. No setter visible in source. |
|
||||
| `ReadData` | `bool` | `false` | Flag indicating whether data should be re-read. |
|
||||
| `DataStart` | `double` | `0D` | Start boundary for data range. Sets `ReadData = true` on change. |
|
||||
| `DataEnd` | `double` | `0D` | End boundary for data range. Sets `ReadData = true` on change. |
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `OnPropertyChanged` | `void OnPropertyChanged(string propertyName)` | Override that 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. **ReadData Side Effect**: The following properties always set `ReadData = true` when modified:
|
||||
- `LowPassFilterEnabled`, `LowPassFilterFrequency`, `LowPassFilterType`, `LowPassFilterOrder`
|
||||
- `HighPassFilterEnabled`, `HighPassFilterFrequency`, `HighPassFilterType`, `HighPassFilterOrder`
|
||||
- `WindowWidth`, `WindowType`, `WindowAveragingType`, `WindowOverlappingPercent`, `ShowEnvelope`
|
||||
- `DataStart`, `DataEnd`
|
||||
|
||||
2. **Publishing Exclusion**: Changes to `CanPublishChanges`, `Parent`, or `ReadData` do **not** trigger `Parent.PublishChanges()`.
|
||||
|
||||
3. **Publishing Gate**: `Parent?.PublishChanges()` is only invoked when `CanPublishChanges == true`.
|
||||
|
||||
4. **Parent Equality Check**: The `Parent` property setter checks `_parent != null && _parent.Equals(value)` before updating, preventing redundant property change notifications.
|
||||
|
||||
5. **IsSaved Immutability**: `IsSaved` has no setter visible in the source; its value is determined externally (possibly via constructor or reflection).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This Module Depends On:
|
||||
- `DTS.Common.Enums.Viewer.Reports` — Provides `PassFilterType`, `WindowWidth`, `WindowType`, `WindowAveragingType` enums
|
||||
- `DTS.Common.Interface` — Provides `IPSDReportSettingsViewModel` interface
|
||||
- `Common.Base.BasePropertyChanged` — Base class providing `SetProperty` method and `INotifyPropertyChanged` infrastructure
|
||||
|
||||
### Consumers (Inferred):
|
||||
- Any module implementing `IPSDReportSettingsViewModel` (the parent view model)
|
||||
- Any code referencing `IPSDReportSettingsModel` interface
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **ReadData Never Auto-Resets**: Setting `ReadData = true` via property changes never automatically resets it back to `false`. The consuming code must manage this flag's lifecycle.
|
||||
|
||||
2. **IsSaved Has No Setter**: The `IsSaved` property is read-only with no initialization visible in this file. Its value must be set through a mechanism not shown in the source (possibly constructor injection, reflection, or partial class extension).
|
||||
|
||||
3. **Parent Can Be Null**: The `Parent` property is not validated for null before use in `OnPropertyChanged`. While `Parent?.PublishChanges()` uses null-conditional operator, if `Parent` is null during other operations, behavior is undefined.
|
||||
|
||||
4. **Inconsistent Setter Patterns**: The `Parent` setter uses manual equality checking and `OnPropertyChanged("Parent")`, while most other properties use `SetProperty()`. The `CanPublishChanges` setter uses direct field assignment with `OnPropertyChanged("CanPublishChanges")`. This inconsistency may lead to subtle behavioral differences.
|
||||
|
||||
5. **No Validation on Numeric Inputs**: Properties like `LowPassFilterFrequency`, `HighPassFilterFrequency`, `WindowOverlappingPercent`, `DataStart`, and `DataEnd` accept any `double` value without bounds checking. Invalid values (e.g., negative frequencies, overlapping > 100) are not prevented at the model level.
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/Properties/AssemblyInfo.cs
|
||||
generated_at: "2026-04-16T11:00:33.367677+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 and configuration for the `DTS.Viewer.PSDReportSettings` component within the DTS Viewer application. It defines the assembly's identity, version information, and COM visibility settings using .NET attributes. As a standard `AssemblyInfo.cs` file, it serves as the manifest entry point for the compiled DLL, ensuring the module is correctly identified by the .NET runtime and host application.
|
||||
|
||||
## 2. Public Interface
|
||||
This file does not contain executable classes or methods. It exposes the following assembly-level attributes as its public interface:
|
||||
|
||||
* **`AssemblyTitle("DTS.Viewer.PSDReportSettings")`**: Specifies the display name for the assembly.
|
||||
* **`AssemblyProduct("DTS.Viewer.PSDReportSettings")`**: Specifies the product name associated with this assembly.
|
||||
* **`AssemblyVersion("1.0.0.0")`**: Specifies the version number of the assembly used by the common language runtime.
|
||||
* **`AssemblyFileVersion("1.0.0.0")`**: Specifies the Win32 file version resource; typically mirrors the assembly version.
|
||||
* **`ComVisible(false)`**: Indicates that types within this assembly are not visible to COM components by default.
|
||||
* **`Guid("82faae11-3be9-4223-beb8-8a53643866f8")`**: Specifies a unique identifier for the assembly if it is exposed to COM.
|
||||
|
||||
## 3. Invariants
|
||||
* **COM Visibility:** The attribute `[assembly: ComVisible(false)]` ensures that no types within this assembly are exposed to COM unless a specific type is explicitly marked as visible.
|
||||
* **Versioning:** Both the logical assembly version and the physical file version are currently fixed at `1.0.0.0`.
|
||||
* **Identity:** The assembly is identified by the title `DTS.Viewer.PSDReportSettings` and the GUID `82faae11-3be9-4223-beb8-8a53643866f8`.
|
||||
|
||||
## 4. Dependencies
|
||||
* **Internal Dependencies:**
|
||||
* `System.Reflection`: Required for the assembly attribute definitions.
|
||||
* `System.Runtime.CompilerServices`: Required for assembly attribute support.
|
||||
* `System.Runtime.InteropServices`: Required for the `ComVisible` and `Guid` attributes.
|
||||
* **External Dependencies:** None identified from this source file alone. The module name suggests it is a plugin or sub-module of the larger `DTS Viewer` system.
|
||||
|
||||
## 5. Gotchas
|
||||
* **Hardcoded Versions:** The `AssemblyVersion` and `AssemblyFileVersion` are hardcoded to `1.0.0.0`. If the project uses Continuous Integration (CI) to auto-increment versions, this file may override those settings or require manual updating during releases.
|
||||
* **SDK-Style Projects:** If this project is migrated to the modern SDK-style `.csproj` format, the attributes defined here may conflict with auto-generated attributes, resulting in compiler warnings (CS0579) regarding duplicate attributes.
|
||||
* **Missing Metadata:** The `AssemblyDescription`, `AssemblyConfiguration`, `AssemblyCompany`, and `AssemblyTrademark` attributes are initialized as empty strings, which may result in missing metadata in the compiled DLL properties.
|
||||
@@ -0,0 +1,118 @@
|
||||
---
|
||||
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-16T11:00:37.156668+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5a446a4aa0389800"
|
||||
---
|
||||
|
||||
# Documentation: DTS.Viewer.PSDReportSettings.Resources
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides localization/translation infrastructure for the PSD (Power Spectral Density) Report Settings UI within the DTS Viewer application. It consists of a WPF XAML markup extension (`TranslateExtension`) that enables declarative resource binding in XAML, and a strongly-typed auto-generated resource accessor class (`StringResources`) containing localized strings for filter configurations, window settings, envelope display options, and export functionality.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### `TranslateExtension` (class)
|
||||
**Namespace:** `DTS.Viewer.PSDReportSettings`
|
||||
**Inheritance:** `MarkupExtension`
|
||||
**Attribute:** `[MarkupExtensionReturnType(typeof(string))]`
|
||||
|
||||
A WPF markup extension that resolves localization keys to localized strings at XAML parse time.
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `TranslateExtension(string key)` | Initializes the extension with the resource key to look up. The key is stored in a readonly field `_key`. |
|
||||
| Method | `object ProvideValue(IServiceProvider serviceProvider)` | Returns the localized string for `_key` from `StringResources.ResourceManager`. Returns `#stringnotfound#` if `_key` is null or empty. Returns `#stringnotfound# <key>` if the key does not exist in the resource file. |
|
||||
|
||||
---
|
||||
|
||||
### `StringResources` (class)
|
||||
**Namespace:** `DTS.Viewer.PSDReportSettings.Resources`
|
||||
**Access:** `internal`
|
||||
**Attribute:** `[GeneratedCode]`, `[DebuggerNonUserCode]`, `[CompilerGenerated]`
|
||||
|
||||
An auto-generated strongly-typed resource accessor class. **Not publicly accessible outside the assembly.**
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Property | `static ResourceManager ResourceManager` | Lazily-initialized cached ResourceManager instance for the `DTS.Viewer.PSDReportSettings.Resources.StringResources` resource bundle. |
|
||||
| Property | `static CultureInfo Culture` | Gets or sets the current UI culture for resource lookups. Overrides `Thread.CurrentUICulture` for this resource class. |
|
||||
|
||||
**Localized String Properties (all `internal static string`):**
|
||||
|
||||
| Property Name | Default Value (English) | Context |
|
||||
|---------------|------------------------|---------|
|
||||
| `EnvelopeHeader` | "Envelope" | UI header |
|
||||
| `ExportPSDHeader` | "Export" | UI header |
|
||||
| `ExportPSDtoCSV` | "Export PSD to CSV" | Export action |
|
||||
| `ExportPSDtoPDF` | "Export PSD to PDF" | Export action |
|
||||
| `FilterCenterFrequency` | "Center frequency" | Filter setting label |
|
||||
| `FilterOrder` | "Filter order" | Filter setting label |
|
||||
| `FilterSettingsHeader` | "Filters" | UI header |
|
||||
| `FilterType` | "Filter type" | Filter setting label |
|
||||
| `FilterType_Bessel` | "Bessel" | Filter type enum value |
|
||||
| `FilterType_Butterworth` | "Butterworth" | Filter type enum value |
|
||||
| `FilterType_LinkwitzRiley` | "Linkwitz-Riley" | Filter type enum value |
|
||||
| `HighPassFilter` | "High pass filter" | Filter type |
|
||||
| `Hz` | "Hz" | Unit label |
|
||||
| `LowPassFilter` | "Low pass filter" | Filter type |
|
||||
| `PSDSettingsHeader` | "PSD settings" | UI header |
|
||||
| `ShowEnvelope` | "Show Envelope" | Checkbox/toggle label |
|
||||
| `WindowAveragingType` | "Averaging type" | Window setting label |
|
||||
| `WindowOverlappingPercent` | "Overlapping %" | Window setting label |
|
||||
| `WindowSettingsHeader` | "Window" | UI header |
|
||||
| `WindowType` | "Window type" | Window setting label |
|
||||
| `WindowWidth` | "Window width" | Window setting label |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Key immutability:** The `_key` field in `TranslateExtension` is `readonly` and set only at construction time.
|
||||
|
||||
2. **Fallback behavior:** `ProvideValue` will never return `null`. It returns the constant `"#stringnotfound#"` for null/empty keys, or `"#stringnotfound# <key>"` for missing resource entries.
|
||||
|
||||
3. **ResourceManager singleton:** The `ResourceManager` property uses lazy initialization with a null-check pattern; once initialized, the same instance is returned for all subsequent calls.
|
||||
|
||||
4. **Thread-safety of ResourceManager:** The lazy initialization in `StringResources.ResourceManager` is **not thread-safe** (uses simple null check without locking). Concurrent access during first initialization could potentially create multiple ResourceManager instances.
|
||||
|
||||
5. **Internal visibility:** `StringResources` is marked `internal`, restricting access to within the `DTS.Viewer.PSDReportSettings` assembly.
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### This module depends on:
|
||||
- `System` (core types)
|
||||
- `System.Windows.Markup` (`MarkupExtension`, `MarkupExtensionReturnTypeAttribute`)
|
||||
- `System.Resources` (`ResourceManager`)
|
||||
- `System.Globalization` (`CultureInfo`)
|
||||
- `System.CodeDom.Compiler` (`GeneratedCodeAttribute`)
|
||||
- `System.Diagnostics` (`DebuggerNonUserCodeAttribute`)
|
||||
- `System.Runtime.CompilerServices` (`CompilerGeneratedAttribute`)
|
||||
|
||||
### External resource dependency:
|
||||
- A `.resx` file (not shown in source) named `StringResources.resx` must exist in the `DTS.Viewer.PSDReportSettings.Resources` namespace to provide the actual localized values.
|
||||
|
||||
### What depends on this module:
|
||||
- **Unclear from source alone.** The `TranslateExtension` is designed for XAML consumption within the PSD Report Settings UI, but the specific XAML files or controls using it are not present in the provided source.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Auto-generated code warning:** `StringResources.Designer.cs` is tool-generated. Manual edits will be overwritten when the resource file is regenerated. The source explicitly warns: "Changes to this file may cause incorrect behavior and will be lost if the code is regenerated."
|
||||
|
||||
2. **Missing key visibility:** Missing localization keys result in visible error strings (`#stringnotfound#`) appearing in the UI rather than silent failures or exceptions. This is intentional for debugging but could leak into production if resource files are incomplete.
|
||||
|
||||
3. **Thread-safety gap:** The `ResourceManager` property getter performs a non-atomic check-then-assign pattern (`if (object.ReferenceEquals(resourceMan, null))`). Under concurrent access, multiple `ResourceManager` instances could be created, though the functional impact is likely minimal.
|
||||
|
||||
4. **Culture must be set explicitly:** The `StringResources.Culture` property allows overriding the current thread's UI culture, but it must be set manually. If never set, `resourceCulture` remains `null` and `ResourceManager.GetString` uses `Thread.CurrentUICulture`.
|
||||
|
||||
5. **No design-time validation:** The `TranslateExtension` constructor accepts any string key without validation. Typos in XAML will only manifest as `#stringnotfound#` at runtime.
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/View/PSDReportSettingsView.xaml.cs
|
||||
generated_at: "2026-04-16T11:00:59.568454+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "5b2351e33ed49693"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportSettingsView
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
`PSDReportSettingsView` is a WPF view component that provides the user interface for configuring Power Spectral Density (PSD) report settings within the DTS Viewer application. It implements `IPSDReportSettingsView` and serves as the presentation layer for report configuration, exposing selectable options for spectral analysis parameters such as FFT window widths.
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
| Member | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| Constructor | `public PSDReportSettingsView()` | Initializes the view by calling `InitializeComponent()`, which loads the associated XAML layout. |
|
||||
| Property | `public List<int> AvailableWindowWidths` | Returns a new list containing valid FFT window size options: `{ 512, 1024, 2048, 4096, 8192 }`. Each access creates a new list instance. |
|
||||
|
||||
**Implemented Interface:**
|
||||
- `IPSDReportSettingsView` (from `DTS.Common.Interface`)
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
- **Window width values are fixed**: The `AvailableWindowWidths` property always returns the same five integer values (512, 1024, 2048, 4096, 8192), representing power-of-two FFT sizes.
|
||||
- **New instance per access**: `AvailableWindowWidths` creates and returns a new `List<int>` on every property getter invocation; it does not cache the collection.
|
||||
- **XAML initialization required**: The constructor must call `InitializeComponent()` before the view can be used, as this is a code-behind for a XAML file.
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
**This module depends on:**
|
||||
- `DTS.Common.Interface` — Provides the `IPSDReportSettingsView` interface that this class implements.
|
||||
- `System.Collections.Generic` — Provides `List<T>` for the window widths collection.
|
||||
- `Xceed.Wpf.Toolkit.PropertyGrid.Attributes` — Imported but **not used** in the visible source code.
|
||||
- The corresponding XAML file (`PSDReportSettingsView.xaml`) — Paired via WPF partial class mechanism.
|
||||
|
||||
**What depends on this module:**
|
||||
- Unclear from source alone. Consumers would reference this view through the `IPSDReportSettingsView` interface, likely a presenter or view model following a MVP/MVVM pattern.
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
- **Unused import**: The `Xceed.Wpf.Toolkit.PropertyGrid.Attributes` namespace is imported but no attributes or types from it are used in the visible code. This may be dead code or intended for future use.
|
||||
|
||||
- **Commented-out members**: Three properties (`AvailablePassFilterTypes`, `AvailableWindowAveragingTypes`, `AvailableWindowTypes`) and their backing fields are fully commented out. These referenced `IItemsSource` and enum item source classes from `DTS.Common.Enums.Viewer.Reports`. This suggests either:
|
||||
- Incomplete refactoring
|
||||
- Features moved elsewhere
|
||||
- Work-in-progress that was disabled
|
||||
|
||||
- **Allocation on every access**: The `AvailableWindowWidths` property allocates a new `List<int>` on every call. If accessed frequently (e.g., in UI binding update loops), this could cause unnecessary garbage collection pressure. Consider caching if performance becomes an issue.
|
||||
|
||||
- **Interface contract unclear**: The `IPSDReportSettingsView` interface definition is not provided, so the expected contract beyond what's implemented here is unknown.
|
||||
@@ -0,0 +1,102 @@
|
||||
---
|
||||
source_files:
|
||||
- DTS Viewer/DTS.Viewer.Reports/DTS.Viewer.PSDReportSettings/ViewModel/PSDReportSettingsViewModel.cs
|
||||
generated_at: "2026-04-16T11:00:01.546105+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "9dcac2937b5c346b"
|
||||
---
|
||||
|
||||
# Documentation: PSDReportSettingsViewModel.cs
|
||||
|
||||
## 1. Purpose
|
||||
|
||||
This module provides a ViewModel for configuring PSD (Power Spectral Density) report settings within the DTS Viewer application. It acts as a mediator between the view layer and the data model, responding to graph-related events (channel selection, axis changes, graph clearing) and publishing setting changes to other system components via an event aggregator. The class follows the MVVM pattern using Prism framework conventions.
|
||||
|
||||
---
|
||||
|
||||
## 2. Public Interface
|
||||
|
||||
### Class: `PSDReportSettingsViewModel`
|
||||
**Namespace:** `DTS.Viewer.PSDReportSettings`
|
||||
**Inherits from:** `BaseViewModel<IPSDReportSettingsModel>`
|
||||
**Implements:** `IPSDReportSettingsViewModel`
|
||||
|
||||
#### Properties
|
||||
|
||||
| Property | Type | Access | Description |
|
||||
|----------|------|--------|-------------|
|
||||
| `View` | `IBaseView` | get/set | Reference to the associated view; DataContext is set to `this` in constructor. |
|
||||
| `Parent` | `IBaseViewModel` | get/set | Parent ViewModel reference, passed during initialization. |
|
||||
| `Model` | `IPSDReportSettingsModel` | get/set | Hides base `Model` property. Backed by private `_model` field; raises `OnPropertyChanged("Model")` on set. |
|
||||
| `NotificationRequest` | `InteractionRequest<Notification>` | get | Used to raise notification dialogs. |
|
||||
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | get | Hides base property. Used to raise confirmation dialogs. |
|
||||
|
||||
#### Constructor
|
||||
|
||||
```csharp
|
||||
public PSDReportSettingsViewModel(
|
||||
IPSDReportSettingsView view,
|
||||
IRegionManager regionManager,
|
||||
IEventAggregator eventAggregator,
|
||||
IUnityContainer unityContainer)
|
||||
```
|
||||
Initializes the ViewModel, sets the View's DataContext, creates interaction requests, and stores references to the event aggregator and Unity container.
|
||||
|
||||
#### Methods
|
||||
|
||||
| Method | Signature | Description |
|
||||
|--------|-----------|-------------|
|
||||
| `Initialize` | `override void Initialize()` | Empty override. No initialization logic. |
|
||||
| `Initialize` | `override void Initialize(object parameter)` | Sets `Parent` from parameter, calls `Subscribe()`, resolves `IPSDReportSettingsModel` from container, and sets `Model.Parent = this`. |
|
||||
| `PublishChanges` | `void PublishChanges()` | Publishes a `PSDReportSettingsChangedEvent` with a `PSDReportSettingsChangedEventArg` containing the current `Model` and `Parent`. |
|
||||
|
||||
---
|
||||
|
||||
## 3. Invariants
|
||||
|
||||
1. **Parent-Child Relationship:** The `Parent` property must be an `IBaseViewModel` type; it is cast directly from the `object parameter` in `Initialize(object parameter)` without null checking.
|
||||
|
||||
2. **Event Filtering:** Event handlers (`OnChartAxisChanged`, `OnGraphSelectedChannelsChanged`) filter events by checking `arg?.ParentVM != Parent`. Events not matching the parent are ignored.
|
||||
|
||||
3. **Model Resolution:** The `Model` is resolved from the Unity container during `Initialize(object parameter)`, not injected via constructor.
|
||||
|
||||
4. **Publish Control:** During X-axis changes in `OnChartAxisChanged`, `Model.CanPublishChanges` is set to `false` before modifying `DataStart`/`DataEnd`, then restored to `true` before calling `PublishChanges()`.
|
||||
|
||||
5. **DataContext Assignment:** The View's DataContext is assigned to `this` (the ViewModel) in the constructor, not to the Model (a commented line suggests this was previously different).
|
||||
|
||||
---
|
||||
|
||||
## 4. Dependencies
|
||||
|
||||
### Imports (this module depends on):
|
||||
- `DTS.Common.Base` - Provides `BaseViewModel<T>`
|
||||
- `DTS.Common.Events` - Provides event args: `ChartAxisChangedEventArg`, `GraphClearNotificationArg`, `GraphSelectedChannelsNotificationArg`, `PSDReportSettingsChangedEvent`, `PSDReportSettingsChangedEventArg`
|
||||
- `DTS.Common.Interactivity` - Provides `InteractionRequest<T>`, `Notification`, `Confirmation`
|
||||
- `DTS.Common.Interface` - Provides interfaces: `IBaseView`, `IBaseViewModel`, `IPSDReportSettingsModel`, `IPSDReportSettingsView`, `IPSDReportSettingsViewModel`
|
||||
- `Prism.Events` - Provides `IEventAggregator`
|
||||
- `Prism.Regions` - Provides `IRegionManager`
|
||||
- `Unity` - Provides `IUnityContainer`
|
||||
|
||||
### Consumers (what depends on this module):
|
||||
- Not determinable from this source file alone. Likely consumed by View classes and/or registered in a module initialization or DI container configuration.
|
||||
|
||||
---
|
||||
|
||||
## 5. Gotchas
|
||||
|
||||
1. **Member Hiding:** Both `Model` and `ConfirmationRequest` properties use the `new` keyword, hiding inherited members from `BaseViewModel<T>`. This could lead to unexpected behavior if the base class is accessed polymorphically.
|
||||
|
||||
2. **Commented-Out Code:** Several code blocks are commented out, including:
|
||||
- A `Standalone` property
|
||||
- Y-axis handling in `OnChartAxisChanged` (lines setting `MinFixedY`/`MaxFixedY`)
|
||||
- `PublishChanges()` call in `OnGraphSelectedChannelsChanged`
|
||||
- A subscription to `CursorsAlailableChangedEvent` in `Subscribe()`
|
||||
|
||||
This suggests incomplete features or work-in-progress that may cause confusion.
|
||||
|
||||
3. **Empty `Initialize()` Override:** The parameterless `Initialize()` method is empty. If base class calls this method, no initialization occurs.
|
||||
|
||||
4. **Direct Cast Without Validation:** In `Initialize(object parameter)`, the parameter is cast directly to `IBaseViewModel` without null or type checking, which could throw `InvalidCastException` or result in null.
|
||||
|
||||
5. **Unused `OnRaiseNotification` Method:** The `OnRaiseNotification` method is private with no apparent callers within this class. It may be dead code or intended for future use.
|
||||
Reference in New Issue
Block a user