Files

66 lines
6.8 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/View/LevelTriggerView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/HardwareScanView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/TOMChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/AnalogChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/ReadFileView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/DigitalInputChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/DigitalOutputChannelsView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/SummaryView.xaml.cs
- DataPRO/Modules/TestSetups/Imports/TTS/View/EditFileView.xaml.cs
generated_at: "2026-04-16T04:50:32.534964+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e6043d62e08504ef"
---
# `TTSImport` View Layer Documentation
## 1. Purpose
This module provides WPF user interface views for the TTS (Test Tool Suite) import workflow within the DataPRO test setup system. Each view implements a corresponding interface from the `DTS.Common.Interface` hierarchy and serves as the presentation layer for specific configuration steps—such as hardware scanning, channel selection (analog, digital input/output, TOM), level triggering, file editing/reading, and summary display. These views are lightweight containers that delegate logic to associated view models via data binding and explicit method calls, following a standard MVVM pattern adapted for the existing codebase.
## 2. Public Interface
All classes are `public partial` and inherit from WPF `UserControl` (implied by `InitializeComponent()` usage), implementing interfaces defined in `DTS.Common.Interface` and sub-namespaces.
| Class | Interface | Signature | Behavior |
|-------|-----------|-----------|----------|
| `LevelTriggerView` | `ILevelTriggerView` | `public LevelTriggerView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `HardwareScanView` | `IHardwareScanView` | `public HardwareScanView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `TOMChannelsView` | `ITOMChannelsView` | `public TOMChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `AnalogChannelsView` | `IAnalogChannelsView` | `public AnalogChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `ReadFileView` | `IReadFileView` | `public ReadFileView()`<br>`public void Connect(int connectionId, object target)` | Constructor initializes XAML UI. `Connect()` is a no-op stub (empty body). |
| `DigitalInputChannelsView` | `IDigitalInputChannelsView` | `public DigitalInputChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `DigitalOutputChannelsView` | `IDigitalOutputChannelsView` | `public DigitalOutputChannelsView()` | Constructor initializes XAML UI via `InitializeComponent()`. No additional logic. |
| `SummaryView` | `ISummaryView` | `public SummaryView()`<br>`public void UpdateTestIds(string[] serializedValues)`<br>`public void SetTestName(string testName)`<br>`public string GetTestId()` | Constructor initializes XAML UI. `UpdateTestIds()` delegates to `ctrlTestId.PopulateAllTestIdPrefixSuffixValues()`. `SetTestName()` sets `TestName` and `TestSetupLabel` on `ctrlTestId`. `GetTestId()` returns result of `ctrlTestId.GetTestId()`. |
| `EditFileView` | `IEditFileView` | `public EditFileView()`<br>`private void TextBox_TextChanged(object sender, TextChangedEventArgs e)` | Constructor initializes XAML UI. `TextBox_TextChanged` event handler extracts text from the changed `TextBox`, casts `DataContext` to `IEditFileViewModel`, and invokes `Search(text)` on it. |
> **Note**: All views reference a control named `ctrlTestId` (in `SummaryView.xaml.cs`) and `TextBox` controls (in `EditFileView.xaml.cs`). Their exact types and interfaces (`PopulateAllTestIdPrefixSuffixValues`, `GetTestId`, etc.) are not defined in this module and must be inferred from `DTS.Common.Interface` or related XAML definitions.
## 3. Invariants
- All views are instantiated with parameterless constructors only (no dependency injection via constructor).
- Each views `InitializeComponent()` must be called first in the constructor (standard WPF practice).
- `EditFileView.TextBox_TextChanged` assumes its `DataContext` is assignable to `IEditFileViewModel`; failure to satisfy this will cause a runtime `InvalidCastException`.
- `ReadFileView.Connect()` is present but has no effect—its parameters (`connectionId`, `target`) are unused.
- All views belong to the `TTSImport` namespace, and their interfaces reside under `DTS.Common.Interface` (with sub-namespaces for digital channels and TTS-specific interfaces).
## 4. Dependencies
### Dependencies *of* this module:
- `DTS.Common.Interface` (core interfaces: `ILevelTriggerView`, `IHardwareScanView`, `IReadFileView`, `ISummaryView`)
- `DTS.Common.Interface.TestSetups.Imports.TTS` (interfaces: `ITOMChannelsView`, `IEditFileView`, `IAnalogChannelsView`)
- `DTS.Common.Interface.TestSetups.Imports.TTS.DIChannels` (`IDigitalInputChannelsView`)
- `DTS.Common.Interface.TestSetups.Imports.TTS.DOChannels` (`IDigitalOutputChannelsView`)
- WPF framework types: `System.Windows.Controls.TextBox`, `System.Windows.Controls.UserControl`, `System.Windows.RoutedEventArgs` (via `TextChangedEventArgs`)
### Dependencies *on* this module:
- Unknown from source alone. These views are likely consumed by a view model layer or a navigation/controller module (e.g., `TTSImport` modules view models or a parent test setup wizard).
## 5. Gotchas
- **Namespace mismatch**: All view classes are in the `TTSImport` namespace, but their XML documentation comments incorrectly reference `HardwareScanView.xaml` for *all* views (including `ReadFileView`, `SummaryView`, etc.). This may indicate copy-paste errors in comments or incorrect XAML file names.
- **Unused `Connect` method**: `ReadFileView.Connect()` is declared but empty—likely a placeholder for future connection logic or legacy code.
- **Assumed control names**: `SummaryView` relies on a control named `ctrlTestId`, and `EditFileView` on a `TextBox` named `sender`. If XAML names differ, runtime errors will occur.
- **No validation in `EditFileView`**: The `TextBox_TextChanged` handler blindly casts `DataContext` to `IEditFileViewModel`. If the view is reused or bound to a non-conforming view model, it will crash.
- **Missing interface definitions**: The interfaces (e.g., `ISummaryView`, `IEditFileView`) are referenced but not defined here; their exact contracts (e.g., whether `UpdateTestIds` or `Search` are required) must be verified in `DTS.Common.Interface`.
- **No error handling**: None of the views include try/catch blocks or logging—failures in `InitializeComponent()` or casting will propagate unhandled exceptions.