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

View File

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

View File

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

View File

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

View File

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