Files
2026-04-17 14:55:32 -04:00

79 lines
4.2 KiB
Markdown

---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/View/TestSummaryView.xaml.cs
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.TestSummaryList/View/TestSummaryListView.xaml.cs
generated_at: "2026-04-16T11:17:15.115446+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a0b85470cc6f6727"
---
# Documentation: DTS.Viewer.TestSummaryList Views
## 1. Purpose
This module provides WPF view components for displaying and interacting with test summaries in the DTS Viewer application. It contains two partial views—`TestSummaryView` and `TestSummaryListView`—both implementing `ITestSummaryListView`. The `TestSummaryListView` specifically adds keyboard interaction support for toggling test selection via the Space key. These views serve as the presentation layer for test summary data within a larger modular viewer architecture.
---
## 2. Public Interface
### `TestSummaryView` (class)
**Namespace:** `DTS.Viewer.TestSummaryList`
**Implements:** `ITestSummaryListView`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TestSummaryView()` | Initializes the view component by calling `InitializeComponent()`. |
---
### `TestSummaryListView` (class)
**Namespace:** `DTS.Viewer.TestSummaryList`
**Implements:** `ITestSummaryListView`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TestSummaryListView()` | Initializes the view component by calling `InitializeComponent()`. |
| `TestSummary_KeyUp` | `private void TestSummary_KeyUp(object sender, KeyEventArgs e)` | Event handler that toggles the `IsSelected` property on a `TestSummary` object when the Space key is released, provided the `sender` is a `ListView` with a `TestSummary` as its `SelectedItem`. |
---
## 3. Invariants
- Both view classes implement `ITestSummaryListView` from `DTS.Common.Interface`.
- `TestSummaryListView.TestSummary_KeyUp` will only modify `IsSelected` if:
- The `sender` can be cast to a `ListView`.
- The `ListView.SelectedItem` can be cast to a `TestSummary` type.
- The pressed key is `Key.Space`.
- If any of the above conditions fail, `e.Handled` is set to `false`; otherwise, it is set to `true`.
- The `TestSummary` class (from `DTS.Common.Classes.Viewer.TestMetadata`) must have a public `IsSelected` property that is boolean-settable.
---
## 4. Dependencies
### This module depends on:
| Dependency | Usage |
|------------|-------|
| `System.Windows` | WPF framework (`FrameworkElement` base class via partial class) |
| `System.Windows.Controls` | `ListView` control used in `TestSummary_KeyUp` |
| `System.Windows.Input` | `Key` enum and `KeyEventArgs` for keyboard handling |
| `DTS.Common.Interface` | `ITestSummaryListView` interface contract |
| `DTS.Common.Classes.Viewer.TestMetadata` | `TestSummary` data class |
| `DTS.Common.Interface.TestDefinition` | Imported in `TestSummaryListView.xaml.cs` but **not visibly used** in the code-behind |
### What depends on this module:
- **Unclear from source alone.** Consumers would be modules that reference `ITestSummaryListView` or instantiate these views directly (likely via dependency injection or XAML composition in a parent view).
---
## 5. Gotchas
1. **Misleading XML comment in `TestSummaryView.xaml.cs`:** The documentation comment states "Interaction logic for TestListView.xaml" but the class is named `TestSummaryView`. This appears to be a copy-paste error from another view.
2. **Unused import:** `DTS.Common.Interface.TestDefinition` is imported in `TestSummaryListView.xaml.cs` but not referenced in the code-behind. It may be used in the XAML file (not provided) or is dead code.
3. **Namespace directive:** The `// ReSharper disable CheckNamespace` directive in `TestSummaryListView.xaml.cs` suggests the file location may not match the declared namespace, or ReSharper was producing warnings. The actual namespace discrepancy is not apparent from the source alone.
4. **Two classes implementing the same interface:** Both `TestSummaryView` and `TestSummaryListView` implement `ITestSummaryListView`. The relationship between these two views (inheritance, alternative implementations, or deprecated code) is unclear from the source alone.