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,99 @@
---
source_files:
- DataPRO/CanFDApiProxy/Protocol.cs
- DataPRO/CanFDApiProxy/CanApiException.cs
- DataPRO/CanFDApiProxy/HttpClientFactory.cs
- DataPRO/CanFDApiProxy/CommandName.cs
- DataPRO/CanFDApiProxy/RESTWrapper.cs
- DataPRO/CanFDApiProxy/CANFD.cs
generated_at: "2026-04-17T15:51:33.293330+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "149776114a3cb89f"
---
# Documentation: CANFDApiProxy Module
## 1. Purpose
The `CANFDApiProxy` module serves as a client-side SDK for interacting with a CAN-FD hardware device's REST API. It abstracts the underlying HTTP communication, serialization, and endpoint management into a singleton service (`CANFD`). The module allows developers to query device state (battery, serial, CAN bus statistics), configure hardware settings (LEDs, network, clocks), and perform file operations (upload/download logs) via strongly typed C# methods.
## 2. Public Interface
### Class: `CANFDApiProxy.CANFD`
A `sealed` class implementing the singleton pattern to provide access to the API.
* **Property**: `public static CANFD API`
* Returns the singleton instance of the `CANFD` client.
* **Constructor**: `private CANFD()`
* Private constructor to enforce singleton access via the `API` property.
#### Device Information & Status Methods
* `Task<UsbTreeMessage> GetUsbTree(string deviceHost, CancellationToken cancellationToken)`
* `Task<BatteryMessage> GetBattery(string deviceHost, CancellationToken cancellationToken)`
* `Task<DiagnosticMessageRow[]> GetBIST(string deviceHost, CancellationToken cancellationToken)`
* Retrieves Built-In Self-Test results. Parses CSV response into an array of `DiagnosticMessageRow`.
* `Task<CalibrationMessage> GetCalibrationDate(string deviceHost, CancellationToken cancellationToken)`
* `Task<SerialMessage> GetSerial(string deviceHost, CancellationToken cancellationToken)`
* `Task<LEDsMessage> GetLEDs(string deviceHost, CancellationToken cancellationToken)`
* `Task<DeviceInfoMessage> GetDeviceInfo(string deviceHost, CancellationToken cancellationToken)`
* `Task<NtpMessage> GetNtp(string deviceHost, CancellationToken cancellationToken)`
* `Task<PowerMessage> GetPower(string deviceHost, CancellationToken cancellationToken)`
* `Task<ServicesMessage> GetServices(string deviceHost, CancellationToken cancellationToken)`
* `Task<NetworkMessage> GetNetwork(string deviceHost, CancellationToken cancellationToken)`
* `Task<ClocksMessage> GetClocks(string deviceHost, CancellationToken cancellationToken)`
* `Task<EventPinMessage> GetEventPin(string deviceHost, CancellationToken cancellationToken)`
* `Task<RecordingMessage> GetRecording(string deviceHost, CancellationToken cancellationToken)`
* `Task<UsbStatsMessage> GetUsbStats(string deviceHost, CancellationToken cancellationToken)`
#### CAN Bus Methods
* `Task<CANInfoMessage> GetCANInfo(string deviceHost, CancellationToken cancellationToken)`
* `Task<CANStateMessage> GetCANState(string deviceHost, CancellationToken cancellationToken)`
* `Task<CANStatsMessage> GetCANStats(string deviceHost, CancellationToken cancellationToken)`
* `Task<CANConfigMessage> GetCANConfig(string deviceHost, CancellationToken cancellationToken)`
#### Control/Setter Methods
* `Task<SerialMessage> SetSerial(string deviceHost, SerialRequest serialRequest, CancellationToken cancellationToken)`
* `Task<PowerMessage> SetPowerOff(string deviceHost, CancellationToken cancellationToken)`
* `Task<PowerMessage> SetPowerReboot(string deviceHost, CancellationToken cancellationToken)`
* `Task<CANConfigMessage> SetCANConfig(string deviceHost, CANConfigRequest canConfigRequest, CancellationToken cancellationToken)`
* `Task<LEDsPostMessage> SetLEDs(string deviceHost, LedName led, LedCmd cmd, LedColor color, CancellationToken cancellationToken)`
* `Task<ClocksMessage> SetClocks(string deviceHost, DateTime dateTime, CancellationToken cancellationToken)`
* `Task<ClocksMessage> SyncClocks(string deviceHost, CancellationToken cancellationToken)`
* `Task<RecordingMessage> SetRecordingStart(string deviceHost, CancellationToken cancellationToken)`
* `Task<RecordingMessage> SetRecordingTriggerCheck_Quick(string deviceHost, CancellationToken cancellationToken)`
* `Task<RecordingMessage> SetRecordingStop(string deviceHost, CancellationToken cancellationToken)`
* `Task<NetworkMessage> SetNetwork(string deviceHost, NetworkRequest networkRequest, CancellationToken cancellationToken)`
* `Task<EventPinMessage> SetEventPinArm(string deviceHost, CancellationToken cancellationToken)`
* `Task<EventPinMessage> SetEventPinDisarm(string deviceHost, CancellationToken cancellationToken)`
#### File Operations
* `Task<StatusMessage> Delete(string deviceHost, string usbPath, CancellationToken cancellationToken)`
* Deletes a file or directory on the device.
* `Task Download(string deviceHost, string usbPath, string destinationDirectory, TimeSpan timeOut, CancellationToken cancellationToken)`
* Downloads a file or directory (zipped) from the device to a local directory.
* `Task<StatusMessage> Upload(string deviceHost, string uploadUsbPath, string sourcefile, TimeSpan timeOut, CancellationToken cancellationToken)`
* Uploads a local file to the device.
### Class: `CANFDApiProxy.CanApiException`
Custom exception for API errors.
* **Property**: `public int? StatusCode { get; set; }`
* **Constructors**:
* `public CanApiException(string message, Exception inner)`
* `public CanApiException(string message, int statusCode)`
### Class: `CANFDApiProxy.HttpClientFactory`
Static factory for creating HTTP clients.
* `public static HttpClient CreateHttpClient()`
* Creates a client configured to accept JSON.
### Enum: `CANFDApiProxy.Protocol`
* `http`
* `https`
## 3. Invariants
* **Singleton Pattern**: The `CANFD` class is sealed and has a private constructor. It must be accessed via the static property `CANFD.API`.
*

View File

@@ -0,0 +1,68 @@
---
source_files:
- DataPRO/CanFDApiProxy/Interfaces/ICANFDApi.cs
generated_at: "2026-04-17T16:30:03.655597+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b24ad9d8b14edfc6"
---
# Interfaces
### Purpose
This module defines the `ICANFDApi` interface, which abstracts communication with CAN-FD (Controller Area Network with Flexible Data-rate) devices. It provides a comprehensive contract for retrieving device status, configuring hardware settings, and managing file operations on remote CAN-FD devices identified by a device host string.
### Public Interface
**Interface: `ICANFDApi`**
**Read Operations (all async, return `Task<T>`):**
- `Task<UsbTreeMessage> GetUsbTree(string deviceHost, CancellationToken cancellationToken)` - Retrieves USB tree structure.
- `Task<UsbStatsMessage> GetUsbStats(string deviceHost, CancellationToken cancellationToken)` - Retrieves USB statistics.
- `Task<SerialMessage> GetSerial(string deviceHost, CancellationToken cancellationToken)` - Retrieves serial information.
- `Task<LEDsMessage> GetLEDs(string deviceHost, CancellationToken cancellationToken)` - Retrieves LED status.
- `Task<ClocksMessage> GetClocks(string deviceHost, CancellationToken cancellationToken)` - Retrieves clock information.
- `Task<EventPinMessage> GetEventPin(string deviceHost, CancellationToken cancellationToken)` - Retrieves event pin status.
- `Task<CANConfigMessage> GetCANConfig(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN configuration.
- `Task<CANInfoMessage> GetCANInfo(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN information.
- `Task<CANStateMessage> GetCANState(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN state.
- `Task<CANStatsMessage> GetCANStats(string deviceHost, CancellationToken cancellationToken)` - Retrieves CAN statistics.
- `Task<BatteryMessage> GetBattery(string deviceHost, CancellationToken cancellationToken)` - Retrieves battery status.
- `Task<ServicesMessage> GetServices(string deviceHost, CancellationToken cancellationToken)` - Retrieves services information.
- `Task<NtpMessage> GetNtp(string deviceHost, CancellationToken cancellationToken)` - Retrieves NTP configuration.
- `Task<PowerMessage> GetPower(string deviceHost, CancellationToken cancellationToken)` - Retrieves power status.
- `Task<DeviceInfoMessage> GetDeviceInfo(string deviceHost, CancellationToken cancellationToken)` - Retrieves device information.
- `Task<RecordingMessage> GetRecording(string deviceHost, CancellationToken cancellationToken)` - Retrieves recording status.
- `Task<NetworkMessage> GetNetwork(string deviceHost, CancellationToken cancellationToken)` - Retrieves network configuration.
**Write Operations (all async):**
- `Task<SerialMessage> SetSerial(string deviceHost, SerialRequest serialRequest, CancellationToken cancellationToken)` - Sets serial configuration.
- `Task<LEDsPostMessage> SetLEDs(string deviceHost, LedName led, LedCmd cmd, LedColor color, CancellationToken cancellationToken)` - Controls LED state.
- `Task<ClocksMessage> SetClocks(string deviceHost, DateTime dateTime, CancellationToken cancellationToken)` - Sets device clock.
- `Task<EventPinMessage> SetEventPinArm(string deviceHost, CancellationToken cancellationToken)` - Arms the event pin.
- `Task<EventPinMessage> SetEventPinDisarm(string deviceHost, CancellationToken cancellationToken)` - Disarms the event pin.
- `Task<ClocksMessage> SyncClocks(string deviceHost, CancellationToken cancellationToken)` - Synchronizes clocks.
- `Task<CANConfigMessage> SetCANConfig(string deviceHost, CANConfigRequest canConfigRequest, CancellationToken cancellationToken)` - Sets CAN configuration.
- `Task<PowerMessage> SetPowerOff(string deviceHost, CancellationToken cancellationToken)` - Powers off the device.
- `Task<PowerMessage> SetPowerReboot(string deviceHost, CancellationToken cancellationToken)` - Reboots the device.
- `Task<RecordingMessage> SetRecordingStart(string deviceHost, CancellationToken cancellationToken)` - Starts recording.
- `Task<RecordingMessage> SetRecordingStop(string deviceHost, CancellationToken cancellationToken)` - Stops recording.
- `Task<NetworkMessage> SetNetwork(string deviceHost, NetworkRequest networkRequest, CancellationToken cancellationToken)` - Sets network configuration.
**File Operations:**
- `Task Download(string deviceHost, string usbPath, string destinationDirectory, TimeSpan timeOut, CancellationToken cancellationToken)` - Downloads a file from device.
- `Task<StatusMessage> Upload(string deviceHost, string uploadUsbPath, string sourcefile, TimeSpan timeOut, CancellationToken cancellationToken)` - Uploads a file to device.
- `Task<StatusMessage> Delete(string deviceHost, string usbPath, CancellationToken cancellationToken)` - Deletes a file on device.
### Invariants
- All interface methods require a non-null `deviceHost` string (not enforced at interface level, but implied by design).
- All operations are cancellable via `CancellationToken`.
- All operations are asynchronous and return `Task` or `Task<T>`.
### Dependencies
**Depends on:**
- `CANFDApiProxy.Messages` - Message types for responses (UsbTreeMessage, SerialMessage, etc.)
- `CANFDApiProxy.Requests` - Request types for write operations (SerialRequest, CANConfigRequest, NetworkRequest)
- `System`, `System.Threading`, `System.Threading.Tasks` - BCL types
**Depended on by:** Implementations of this interface (not present

View File

@@ -0,0 +1,77 @@
---
source_files:
- DataPRO/CanFDApiProxy/Messages/StatusMessage.cs
- DataPRO/CanFDApiProxy/Messages/ErrorMessage.cs
- DataPRO/CanFDApiProxy/Messages/NtpMessage.cs
- DataPRO/CanFDApiProxy/Messages/LEDsPostMessage.cs
- DataPRO/CanFDApiProxy/Messages/DiagnosticsMessage.cs
- DataPRO/CanFDApiProxy/Messages/ClocksMessage.cs
- DataPRO/CanFDApiProxy/Messages/DeviceInfoMessage.cs
- DataPRO/CanFDApiProxy/Messages/SerialMessage.cs
- DataPRO/CanFDApiProxy/Messages/ServicesMessage.cs
- DataPRO/CanFDApiProxy/Messages/NetworkMessage.cs
- DataPRO/CanFDApiProxy/Messages/CalibrationMessage.cs
- DataPRO/CanFDApiProxy/Messages/CANInfoMessage.cs
- DataPRO/CanFDApiProxy/Messages/UsbTreeMessage.cs
- DataPRO/CanFDApiProxy/Messages/BatteryMessage.cs
- DataPRO/CanFDApiProxy/Messages/RecordingMessage.cs
- DataPRO/CanFDApiProxy/Messages/PowerMessage.cs
- DataPRO/CanFDApiProxy/Messages/EventPinMessage.cs
- DataPRO/CanFDApiProxy/Messages/CANStateMessage.cs
- DataPRO/CanFDApiProxy/Messages/LEDsMessage.cs
- DataPRO/CanFDApiProxy/Messages/CANStatsMessage.cs
- DataPRO/CanFDApiProxy/Messages/CANConfigMessage.cs
- DataPRO/CanFDApiProxy/Messages/UsbStatsMessage.cs
- DataPRO/CanFDApiProxy/Messages/CANInfoInternal.cs
generated_at: "2026-04-17T15:45:02.925780+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2dc83337f53d0fe1"
---
# CANFDApiProxy.Messages Documentation
## 1. Purpose
This module defines Data Transfer Objects (DTOs) for serializing and deserializing messages exchanged with a CAN-FD (Controller Area Network Flexible Data-rate) device API. It provides strongly-typed representations of device state, configuration, diagnostics, and control messages for hardware components including CAN bus interfaces, battery systems, USB storage, LEDs, network interfaces, and system services. The module serves as the message contract layer between the API proxy and downstream consumers.
---
## 2. Public Interface
### Simple Message Classes
| Class | Properties | Notes |
|-------|------------|-------|
| `StatusMessage` | `status` (string) | Generic status response |
| `ErrorMessage` | `Error` (string) | Error response container |
| `NtpMessage` | `Ntp` (string), `Fallback` (string) | NTP server configuration |
| `LEDsPostMessage` | `status` (string), `reply` (string) | LED POST operation response |
| `DiagnosticsMessageRequest` | `format` (string) | Overrides `ToString()` |
| `ClocksMessage` | `Rtc_present` (bool?), `Rtc_setup` (bool?), `System` (string), `Status` (string) | Real-time clock status |
| `DeviceInfoMessage` | `Kernel_version`, `Os_release`, `Serial_number`, `Version_number` (all string) | Device identification |
| `SerialMessage` | `Serial` (string), `Status` (string) | Overrides `ToString()` |
| `NetworkMessage` | `Current_address`, `Interface`, `Mac_address`, `Set_address`, `Ok` (string); `Dhcp` (bool) | Network configuration |
| `CalibrationMessage` | `Calibration_date` (int), `Calibration_date_string` (string) | Overrides `ToString()` |
| `RecordingMessage` | `Recording`, `Recording_dir`, `Ok`, `Reply` (string); `Autoarm` (bool) | Overrides `ToString()` |
| `PowerMessage` | `Battery_enable`, `Nvin_pin`, `On_pin`, `Power_fault` (bool); `Status` (string) | Overrides `ToString()` |
| `EventPinMessage` | `Armed`, `Event`, `Event_pin` (bool?); `File_name`, `Ok`, `Reply` (string) | Overrides `ToString()` |
| `BatteryMessage` | `LoadV`, `Current`, `Power`, `Percent` (decimal); `Enable` (bool) | Overrides `ToString()` |
### Collection-Based Message Classes
**`ServicesMessage`**
- `services` (Service[])
- Nested class `Service`: `Enabled` (bool), `Name` (string), `Status` (string)
**`CANInfoMessage`**
- `CANInfoList` (List\<CANInfo\>)
- Nested class `CANInfo`: Constructor `(string name, string info)`, read-only properties `Name`, `Info`
**`CANStateMessage`**
- `CANStateList` (List\<CANState\>)
- Nested class `CANState`: Constructor `(string name, string state, float last_updated)`, `Name` (read-only), `State`, `Last_updated` (settable)
**`CANStatsMessage`**
- `CANStatsList` (List\<CANStats\>)
- Nested class `CANStats`: Constructor with parameters `(string name, int std_data, int std_remote, int ext_data, int ext_remote, int err_frame, float bus

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/CanFDApiProxy/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:13:47.324171+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f4a4a1f2e3e78604"
---
# Properties
### Purpose
This module contains assembly metadata for the TDASCommands assembly. It is a standard .NET Framework assembly information file that defines versioning, copyright, and COM visibility settings for the TDASCommands component, which appears to be a commands library dating from 2010.
### Public Interface
No public types are defined in this module. It consists solely of assembly-level attributes:
- `AssemblyTitle("TDASCommands")` - Sets the assembly title
- `AssemblyProduct("TDASCommands")` - Sets the product name
- `AssemblyCopyright("Copyright © 2010")` - Sets copyright information
- `ComVisible(false)` - Disables COM visibility for all types
- `Guid("58258526-9c64-480c-8758-99cb200c3277")` - COM type library identifier
- `AssemblyVersion("1.06.0081")` - Assembly version
- `AssemblyFileVersion("1.06.0081")` - File version
### Invariants
- `ComVisible` is always `false` for the entire assembly.
- `AssemblyVersion` and `AssemblyFileVersion` are synchronized at "1.06.0081".
### Dependencies
**Depends on:**
- `System.Reflection`
- `System.Runtime.CompilerServices`
- `System.Runtime.InteropServices`
**Depended on by:** Unclear from source alone (this is a leaf metadata module

View File

@@ -0,0 +1,64 @@
---
source_files:
- DataPRO/CanFDApiProxy/Requests/SerialRequest.cs
- DataPRO/CanFDApiProxy/Requests/CanPostRequest.cs
- DataPRO/CanFDApiProxy/Requests/FileRequest.cs
- DataPRO/CanFDApiProxy/Requests/ClocksRequest.cs
- DataPRO/CanFDApiProxy/Requests/NetworkRequest.cs
- DataPRO/CanFDApiProxy/Requests/LEDsRequest.cs
- DataPRO/CanFDApiProxy/Requests/CANConfigRequest.cs
- DataPRO/CanFDApiProxy/Requests/CanConfigItem.cs
generated_at: "2026-04-17T16:44:05.151206+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8f8c1bcb2ea885e5"
---
# CANFDApiProxy.Requests Namespace Documentation
## 1. Purpose
This module defines Data Transfer Objects (DTOs) for request payloads in the CANFDApiProxy system. It provides strongly-typed models for serializing requests to a CAN FD (Flexible Data-rate) API proxy, covering operations such as CAN bus configuration, LED control, network settings, serial number handling, file operations, and clock synchronization. These request models serve as the input contracts for API calls to the underlying CAN FD hardware abstraction layer.
---
## 2. Public Interface
### Public Classes
#### `SerialRequest`
```csharp
public class SerialRequest
{
public string serial { get; set; }
}
```
A request model for serial number operations. Contains a single `serial` property for transmitting or querying serial number data.
---
#### `NetworkRequest`
```csharp
public class NetworkRequest
{
public bool dhcp { get; set; }
public string set_address { get; set; }
}
```
A request model for network configuration. The `dhcp` flag enables/disables DHCP mode; `set_address` specifies a static IP address when DHCP is disabled.
---
#### `LEDsRequest`
```csharp
public class LEDsRequest
{
public string led { get; set; }
public string cmd { get; set; }
public string color { get; set; }
}
```
A request model for controlling LEDs on the CAN FD device. All properties are strings, though corresponding enums exist for type-safe usage.
**Associated Enums:**
- `LedColor

View File

@@ -0,0 +1,65 @@
---
source_files:
- DataPRO/CustomWindow/WindowMaximizeButton.cs
- DataPRO/CustomWindow/WindowRestoreButton.cs
- DataPRO/CustomWindow/WindowCloseButton.cs
- DataPRO/CustomWindow/WindowMinimizeButton.cs
- DataPRO/CustomWindow/Others.cs
- DataPRO/CustomWindow/WindowButton.xaml.cs
generated_at: "2026-04-17T16:28:39.453177+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "855cc573ec161a3c"
---
# CustomWindow
### Purpose
This module provides custom window chrome controls for WPF applications, specifically styled window title bar buttons (minimize, maximize, restore, close). It implements a custom `WindowButton` base class with dependency properties for managing button content states and corner radius styling, enabling consistent custom window styling across the application.
### Public Interface
**WindowButton** : `Button`
- `WindowButton()` - Constructor that calls `InitializeComponent()` and attaches an `IsEnabledChanged` handler to call `RefreshContent()`.
- `Content` (DependencyProperty) - The button content when enabled. Hides base `Button.Content`.
- `ContentDisabled` (DependencyProperty) - The button content when disabled.
- `CornerRadius` (DependencyProperty) - Corner radius for button styling.
- `ActiveContent` (DependencyProperty) - The currently active content based on enabled state.
- `RefreshContent()` - Sets `ActiveContent` to `Content` if enabled, otherwise `ContentDisabled`.
- `BackgroundDefaultValue` (virtual property) - Returns `DefaultBackgroundBrush` from resources.
**WindowMaximizeButton** : `WindowButton`
- `WindowMaximizeButton()` - Loads `WindowButtonMaximizeIcon` and `WindowButtonMaximizeIconDisabled` from `ButtonIcons.xaml`.
**WindowRestoreButton** : `WindowButton`
- `WindowRestoreButton()` - Loads `WindowButtonRestoreIcon` and `WindowButtonRestoreIconDisabled` from `ButtonIcons.xaml`.
**WindowCloseButton** : `WindowButton`
- `WindowCloseButton()` - Loads `WindowButtonCloseIcon` and `WindowButtonCloseIconDisabled` from `ButtonIcons.xaml`.
**WindowMinimizeButton** : `WindowButton`
- `WindowMinimizeButton()` - Loads `WindowButtonMinimizeIcon` and `WindowButtonMinimizeIconDisabled` from `ButtonIcons.xaml`.
**WindowButtonState** (enum)
- Values: `Normal`, `Disabled`, `None`
**TypeConverterStringToUIElement** : `TypeConverter`
- `CanConvertFrom(ITypeDescriptorContext, Type)` - Returns `true` if source type is `string`.
- `ConvertFrom(ITypeDescriptorContext, CultureInfo, object)` - Converts string to a `TextBlock` with vertical centering and left margin of 3.
### Invariants
- `ButtonIcons.xaml` must exist in the assembly at the pack URI `pack://application:,,,/CustomWindow;component/ButtonIcons.xaml`.
- The resource dictionary must contain the icon keys: `WindowButtonMaximizeIcon`, `WindowButtonMaximizeIconDisabled`, `WindowButtonRestoreIcon`, `WindowButtonRestoreIconDisabled`, `WindowButtonCloseIcon`, `WindowButtonCloseIconDisabled`, `WindowButtonMinimizeIcon`, `WindowButtonMinimizeIconDisabled`.
- `DefaultBackgroundBrush` must be defined in resources for `BackgroundDefaultValue` to function.
### Dependencies
- **Depends on**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Markup`, `System.Windows.Media`, `System.ComponentModel`.
- **Depended on by**: Not determinable from source alone; likely used by custom window templates or shell views.
### Gotchas
- **Runtime resource loading**: Each button constructor loads `ButtonIcons.xaml` via `XamlReader.Load()` at instantiation time. This has performance implications if many buttons are created.
- **No error handling**: The resource loading will throw if `ButtonIcons.xaml` is missing or if expected resource keys are absent.
- **Shadowed Content property**: The `new` keyword hides the base `Button.Content` property. Setting `Content` on a `WindowButton` will not behave like a standard button.
- **Commented-out code**: `WindowCloseButton` and `WindowMinimizeButton` contain commented-out `CornerRadius` assignments, suggesting incomplete refactoring.
---

View File

@@ -0,0 +1,24 @@
---
source_files:
- DataPRO/CustomWindow/Properties/Settings.Designer.cs
- DataPRO/CustomWindow/Properties/AssemblyInfo.cs
- DataPRO/CustomWindow/Properties/Resources.Designer.cs
generated_at: "2026-04-17T16:11:56.450653+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "96192b54df29bba6"
---
# Properties
### Purpose
This module contains the assembly-level configuration and auto-generated code for the `DbAPIUI` project. It defines standard .NET assembly metadata, version information, and strongly-typed wrappers for application settings and resources.
### Public Interface
**Class: `Settings` (internal sealed)**
* `static Settings Default { get; }`: Provides access to the singleton instance of application settings.
* `string DBFolder { get; set; }`: A user-scoped application setting representing a database folder path, defaulting to an empty string.
**Class: `Resources` (internal)**
* `static ResourceManager ResourceManager { get; }`: Returns the cached resource manager instance for looking up localized strings.
* `static CultureInfo Culture { get

View File

@@ -0,0 +1,215 @@
---
source_files:
- DataPRO/DASFactory/DASFactory.AutoDiscovery.cs
- DataPRO/DASFactory/DASFactory.WinUSB.cs
- DataPRO/DASFactory/DASFactory.CDCUSB.cs
- DataPRO/DASFactory/DASFactory.Ribeye.cs
- DataPRO/DASFactory/DASFactory.WindowsNotification.cs
- DataPRO/DASFactory/DistributorSocket.cs
- DataPRO/DASFactory/DASFactory.HID.cs
generated_at: "2026-04-17T15:46:31.124490+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "292a1a9fc11d724e"
---
# DASFactory Module Documentation
## 1. Purpose
The DASFactory module provides device discovery, connection management, and communication handling for Data Acquisition System (DAS) hardware. It implements multiple transport protocols (HID, WinUSB, CDC USB, Ethernet, Multicast/UDP) to detect, connect to, and manage various DAS devices. The module serves as the hardware abstraction layer between the application and physical devices, handling Windows device notifications, background discovery tasks, and socket-based communication for remote distributors.
---
## 2. Public Interface
### AutoDiscovery (internal class)
**Constructor:**
- `AutoDiscovery(IDASFactory dasFactory)` — Initializes with a factory instance for device discovery.
**Methods:**
- `void StartMulticastAutoDiscovery()` — Starts a background task that periodically discovers UDP/multicast devices. Idempotent; no-op if already scanning.
- `void StopMulticastAutoDiscovery()` — Stops the background discovery task via cancellation token and waits for task completion.
- `IDiscoveredDevice[] GetDiscoveredDevices()` — Returns a snapshot of all discovered devices since discovery started.
---
### WinUSBHandling (internal class, extends WindowsNotification)
**Constructor:**
- `WinUSBHandling(DASFactory _factory, UpdateFinishedEventHandler _SerialUpdateFinished, IDeviceSetup _deviceHandler, BlockingCollection<Tuple<QueueActions, DeviceHandling>> queueActionPerDevice)`
**Properties:**
- `int ConnectWinUSBTimeout { get; set; }` — Timeout in milliseconds for WinUSB device connections. Default: 60000.
**Methods:**
- `override void UpdateConnectedDevices()` — Scans for and connects to new WinUSB devices.
- `override void UpdateDisconnectedDevices()` — Handles disconnection of removed WinUSB devices.
- `override void UpdateDeviceSetups()` — Sets the handler on the device handler.
---
### CDCUSBHandling (internal class, extends WindowsNotification)
**Constructor:**
- `CDCUSBHandling(DASFactory _factory, UpdateFinishedEventHandler _SerialUpdateFinished, IDeviceSetup _deviceHandler, BlockingCollection<Tuple<QueueActions, DeviceHandling>> queueActionPerDevice)`
**Properties:**
- `int ConnectCDCUSBTimeout { get; set; }` — Timeout in milliseconds for CDC USB device connections. Default: 60000.
**Methods:**
- `override void UpdateConnectedDevices()` — Scans for and connects to new CDC USB devices.
- `override void UpdateDisconnectedDevices()` — Handles disconnection of removed CDC USB devices.
- `override void UpdateDeviceSetups()` — Sets the handler on the device handler.
---
### RibeyeHandling (internal class, implements IDeviceSetup)
**Constructor:**
- `RibeyeHandling(bool _utilMode)`
**Methods:**
- `bool QueryInformation(ConnectedDevice dev)` — Queries a Ribeye device for serial number, LED count, module configuration, and DAS info. Returns `true` on success.
- `ICommunication GetICommunication()` — Returns a new `EthernetRibeye` communication instance.
- `ICommunication GetICommunication(ConnectedDevice dev)` — Extracts communication interface from a `ConnectedEthernetRibeye`.
- `IConnectedDevice GetIConnectedDevice(ICommunication comm)` — Creates a `ConnectedEthernetRibeye` from an `EthernetRibeye` communication object.
- `bool IsCorrectType(ConnectedDevice dev)` — Returns `true` if device is a `ConnectedEthernetRibeye`.
- `DFConstantsAndEnums.DASType GetDASType()` — Returns `DFConstantsAndEnums.DASType.ETHERNET_RIBEYE`.
- `Guid GetGuid()` — Returns `Guid.Empty`.
- `int GetProductId()` — Returns 0.
- `string GetProductIdString()` — Returns empty string.
- `void SetHandler(DeviceHandling handler)` — No-op implementation.
---
### WindowsNotification (internal abstract class, extends DeviceHandling)
**Constructor:**
- `WindowsNotification(DASFactory _factory, UpdateFinishedEventHandler _SerialUpdateFinished, Guid _guid, BlockingCollection<Tuple<QueueActions, DeviceHandling>> queueActionPerDevice)` — Registers for Windows device notifications via a hidden form.
**Methods:**
- `void Dispose()` — Stops device notifications and cleans up resources.
- `virtual void NotificationWndProc(ref Message m)` — Processes Windows messages for device arrival/removal.
- `abstract void NotificationDeviceArrived(ref Message m)` — Must be implemented to handle device connection events.
- `abstract void NotificationDeviceRemoved(ref Message m)` — Must be implemented to handle device disconnection events.
---
### DistributorSocket (public class, implements IDisposable)
**Constructors:**
- `DistributorSocket(string hostName, string hostIPAddress, ref bool slicedbCanConnect, ref ManualResetEvent slicedbCanConnectEvent, string logFolder, ManualResetEvent whKillMe)` — Creates and connects a socket to a remote distributor.
- `DistributorSocket(Socket sock, string hostName, string logFolder)` — Wraps an existing connected socket.
**Methods:**
- `bool IsConnected()` — Returns `true` if socket exists and is connected.
- `void Disconnect()` — Shuts down and closes the socket.
- `bool ReadLine(ref string target, ref bool stopFlag)` — Reads a line from the socket with retry logic. Returns `false` on stop or max consecutive errors.
- `void SendAck()` — Sends "ACK" acknowledgment over the socket.
- `void SendNak()` — Sends "NAK" negative acknowledgment over the socket.
- `bool KeepAliveEnabled()` — Negotiates keep-alive parameters with remote endpoint. Returns `true` on success.
- `void Dispose()` — Cleans up socket resources.
---
### HIDHandling (internal class, extends WindowsNotification)
**Constructor:**
- `HIDHandling(DASFactory _factory, UpdateFinishedEventHandler _SerialUpdateFinished, IDeviceSetup _deviceHandler)`
**Properties:**
- `int ConnectHIDTimeout { get; set; }` — Timeout in milliseconds for HID device connections. Default: 1000.
**Methods:**
- `override void UpdateConnectedDevices()` — Handles disconnection of removed HID devices.
- `override void UpdateDisconnectedDevices()` — Scans for and connects to new HID devices.
---
## 3. Invariants
### AutoDiscovery
- `_scanTask` is either `null`, completed, or actively running—never in an indeterminate state.
- `_multicastLock` must be held for any access to `_discoveredDevices`, `_scanTask`, or `tokenSource`.
- `tokenSource` is replaced with a new instance after cancellation (no reset mechanism).
- `DiscoveryWork` clears the device list at start and runs until cancellation is requested.
### WinUSBHandling / CDCUSBHandling
- `ConnectWinUSBTimeout` / `ConnectCDCUSBTimeout` defaults to 60000ms.
- `CheckForConnectedWinUSBDups()` / `CheckForConnectedCDCUSBDups()` throw if duplicate device paths are detected.
- Device list filtering excludes null/empty paths and duplicates (case-insensitive).
### CDCUSBHandling
- Only device paths containing a key from `CDCUSBConnection.RegKeys` (case-insensitive) are considered valid.
### RibeyeHandling
- `QueryInformation` sets protocol version to 1 before querying.
- First `QueryArmAndTriggerStatus` call may fail on boot; it is silently retried once.
- If device is armed, serial number defaults to "Ribeye" and LED count to 18.
- `Samplerate2AAFilterDict` maps specific sample rates to anti-aliasing filter frequencies (rate / 5.0).
### WindowsNotification
- `NotificationWindow` is a hidden form used solely for receiving Windows messages.
- `DeviceNotifyHandle` is non-zero after successful registration.
- `NotificationWndProc` only processes `WM_DEVICECHANGE` messages with `DBT_DEVICEARRIVAL` or `DBT_DEVICEREMOVECOMPLETE` and `DBT_DEVTYP_DEVICEINTERFACE`.
### DistributorSocket
- Port is always `SLICE_DB_PORT` (8200).
- Maximum consecutive read errors before failure: `MAX_CONSECUTIVE_READ_ERRORS` (2).
- Maximum log size: `MAX_LOG_SIZE_BYTES` (1024000).
- Read/write timeout: 9000ms.
- Keep-alive parameters use `DFConstantsAndEnums.LocalKeepAliveTimeOutMS` and `DFConstantsAndEnums.LocalKeepAliveRetryIntervalMS`.
### HIDHandling
- Vendor ID is `DTS_VENDOR_ID` (value not shown in source).
- Device filtering matches both VID and PID from `deviceHandler.GetProductID()`.
- Registry keys are read from `SYSTEM\CurrentControlSet\Enum\HID\{VID}&{PID}`.
---
## 4. Dependencies
### External Dependencies (inferred from imports)
- `DTS.Common.Enums.DASFactory` — Enumeration types including `DFConstantsAndEnums.MultiCastDeviceClasses`, `DFConstantsAndEnums.DASType`, `DFConstantsAndEnums.RecordingMode`, `DFConstantsAndEnums.ModuleType`.
- `DTS.Common.Interface.DASFactory` — Interfaces including `IDASFactory`, `IDiscoveredDevice`, `IConnectedDevice`, `IDeviceSetup`, `ICommunication`, `IConnectedDAS`.
- `DTS.Common.DASResource``Strings` resource class.
- `DTS.Common.Utilities.Logging``APILogger` for logging.
- `DTS.Common.WINUSBConnection``CDCUSBConnection.RegKeys`.
- `DTS.Common.USBFramework``DeviceManagement`, `FileIODeclarations`, `DeviceManagementDeclarations`.
- `DTS.DASLib.Command.Ribeye``QueryArmAndTriggerStatus`, `QuerySerialNumber`, `QueryNumberOfLEDs`.
- `DTS.DASLib.Service``EthernetRibeye`, `ConnectedEthernetRibeye`.
- `DTS.DASLib.Connection` — Connection-related types.
- `DTS.DASLib.Communication` — Communication interfaces.
- `System.Windows.Forms` — Windows message handling and forms.
- `System.Net.Sockets` — Socket communication.
- `System.Collections.Concurrent``BlockingCollection<T>`.
### Internal Dependencies
- `WinUSBHandling` and `CDCUSBHandling` depend on `WindowsNotification` (inheritance).
- `HIDHandling` depends on `WindowsNotification` (inheritance).
- `AutoDiscovery` depends on `IDASFactory.AutoDiscoverMulticast()`.
- `RibeyeHandling` depends on `InfoResult`, `Communication_DASInfo` types (from `DTS.Common.DAS.Concepts` and `DTS.Common.ICommunication`).
---
## 5. Gotchas
### AutoDiscovery
- **Blocking Wait on Stop**: `StopMulticastAutoDiscovery()` calls `_scanTask.Wait()` outside the lock, which could deadlock if the discovery work is blocked on the same lock. However, `DiscoveryWork` only holds the lock briefly during `UpdateDevices` and `ClearDiscoveredDevices`.
- **No Device Removal**: Discovered devices are only added, never removed. The list grows until `ClearDiscoveredDevices()` is called at the start of a new discovery cycle.
### WinUSBHandling / CDCUSBHandling
- **Duplicate Device Paths**: Windows may report the same device path multiple times. The code filters duplicates, but `CheckForConnectedWinUSBDups()` / `CheckForConnectedCDCUSBDups()` will throw an exception if duplicates persist after filtering.
### RibeyeHandling
- **Silent Retry on Failure**: `QueryArmAndTriggerStatus` is retried once silently on failure. This is documented as a workaround for CRC initialization issues on first boot.
- **Fallback Values When Armed**: If the device reports as armed, serial number and LED count are hardcoded to "Ribeye" and 18 respectively, which may be inaccurate.
- **Empty GUID**: `GetGuid()` returns `Guid.Empty`, which may affect device notification registration if used elsewhere.
### WindowsNotification
- **Commented-Out Dispose Code**: The `Dispose()` method contains commented-out code for closing `NotificationWindow` that was removed due to cross-thread access issues. The form may not be properly disposed.
- **Hidden Form Required**: The implementation relies on a hidden Windows Form to receive device change messages. This requires a message pump (typically on the UI thread).
### DistributorSocket
- **Blocking Constructor**: The constructor loops until connection succeeds or `whKillMe` is signaled, potentially blocking indefinitely.
- **Keep-Alive Negotiation**: `KeepAliveEnabled()` blocks waiting for a response; if the remote end doesn't respond, this will hang.
- **Logger Disabled**: Logger initialization is commented out in both constructors; `_logger` is null and logging is skipped.
### HIDHandling
- **Registry Dependency**: Device detection depends on Windows registry keys under `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\HID\`. If registry access fails, the device list is empty.
- **Large Commented-Out Block**: A significant portion of HID update logic is commented out (approximately 100 lines), suggesting incomplete refactoring or deprecated code paths.

View File

@@ -0,0 +1,13 @@
---
source_files:
- DataPRO/DASFactory/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:58:59.731899+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c7e880859503225a"
---
# Documentation: DASFactory Assembly Configuration
## 1. Purpose
This file provides assembly-level metadata and configuration for the `DASFactory` project within the DataPRO system. It defines the assembly's identity, version information, and COM visibility settings using standard .NET attributes. As a `Properties/AssemblyInfo.cs` file, it serves as the manifest root for the

View File

@@ -0,0 +1,16 @@
---
source_files:
- DataPRO/DASFactoryDb.Tests/DbWrapperShould.cs
generated_at: "2026-04-17T16:59:44.525305+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ee76dc994a03e5d6"
---
# DASFactoryDb.Tests
*Auto-enrichment was unable to generate documentation for this module (model returned empty response after 3 attempts).*
## Source files
- `DataPRO/DASFactoryDb.Tests/DbWrapperShould.cs`

View File

@@ -0,0 +1,16 @@
---
source_files:
- DataPRO/DASFactoryDb.Tests/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:13:44.780731+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4a8853b52e30cad6"
---
# Properties
### Purpose
This module contains assembly metadata for the EquipmentExchange assembly. It is a standard .NET Framework AssemblyInfo file that defines the assembly's identity, version information, COM visibility settings, and other assembly-level attributes used by the runtime and tooling.
### Public Interface
No public types or members are defined. This module consists solely of assembly-level attributes:

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/DASFactoryDb/DbWrapper.cs
generated_at: "2026-04-17T16:45:42.084519+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "42f8132355cda838"
---
# DbWrapper Documentation
## 1. Purpose
`DbWrapper` is a singleton class that provides database access to the DASFactory database. It manages connection string construction, command creation, and basic database operations for device lookup. The class is designed with future extensibility in mind, supporting flags for centralized database deployment and authentication method switching, though currently it is hardcoded for local database access with NTLM authentication.
---
## 2. Public Interface
### Static Properties
| Property | Type | Description |
|----------|------|-------------|
| `_usingCentralizedDB` | `bool` | Configuration flag for future centralized DB support. Currently always `false`. |
| `_usingNTLMAuthentication` | `bool` | Authentication mode flag. Currently always `true` (NTLM/Windows auth). |
| `Connected` | `bool` | Passive connection status indicator. **Getter always returns `false`; setter is a no-op.** |
| `Connection` | `DbWrapper` | Singleton instance accessor with thread-safe lazy initialization. |
### Instance Properties
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `Server` | `string` | `null` | Database server address. |
| `DBName` | `string` | `null` | Database name (not currently used in connection string construction). |
| `Username` | `string` | `""` | SQL authentication username. |
| `Password` | `string` | `null` | SQL authentication password. |
### Methods
#### `public static int GetDeviceId(string serialNumber)`
Looks up a device record by serial number. Calls the stored procedure `sp_IDASCommunicationTableGetRecordId` and returns the `RecordId` if found, or `-1` if no match exists. Throws `Exception("Not connected")` if `Connected` is `false`.
#### `public void ResetLocalDASFactoryConnection()`
Clears the cached connection string and resets `_usingNTLMAuthentication` to `true`.
#### `public string GetLocalDASFactoryConnectionString()`
Builds and caches the connection string for the DASFactory database. Uses NTLM authentication (`Trusted_Connection=TRUE`) when `_usingNTLMAuthentication` is `true`, otherwise uses SQL authentication with `Username` and `Password`. Throws `Exception("Empty Server")` if `Server` is null or whitespace.
### Internal Methods
#### `internal static IDbCommand GetDASFactoryCommand()`
Creates a new `SqlCommand` with an open `SqlConnection` using the local DASFactory connection string. Caller is responsible for disposing the connection.
#### `internal static void ProcessReturn(SqlParameter errorNumber, SqlParameter

View File

@@ -0,0 +1,17 @@
---
source_files:
- DataPRO/DASFactoryDb/ARM/ARM.cs
generated_at: "2026-04-17T16:13:50.702908+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "acbb01a214cec676"
---
# ARM
### Purpose
This module manages ARM (Armed/Recording Mode) status updates for DAS devices during factory operations. It persists comprehensive device state information including arming status, trigger states, recording progress, diagnostic data, and fault information to the database for monitoring and tracking purposes.
### Public Interface
**`ARM.SetArmStatus(int iDASRecordId, bool isArmed, bool isTriggered, bool isTriggerShorted, bool isStartShorted, bool isRecording, bool isFaulted, bool isInRealtime, bool isInFlashWrite, bool isUndefined, bool isInPostTestDiagnostics, double timeRemainingSeconds, double percentComplete, ulong totalSamples, ulong currentSample, uint sampleRate, double? inputMilliVolts, double? batteryMilliVolts, int? eventNumber, int recordingMode, string faultMessage, bool isRear

View File

@@ -0,0 +1,62 @@
---
source_files:
- DataPRO/DASFactoryDb/Config/Config.cs
generated_at: "2026-04-17T16:45:55.734203+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b40972ee3c12f7cc"
---
# Documentation: `DASFactoryDb.Config.Config`
## 1. Purpose
This module provides a static utility class for persisting and managing DAS (Data Acquisition System) configuration data to a SQL Server database. It serves as a data access layer that wraps stored procedure calls for inserting DAS device information, clearing DAS records, and storing XML configuration data. The class abstracts away ADO.NET command construction, parameter handling, and connection management for consumers.
---
## 2. Public Interface
### `DASInfoInsert`
**Signature:**
```csharp
public static int DASInfoInsert(
int iDASRecordId,
string macAddress,
int owningDASId,
uint maxNumberOfModules,
ulong? maxEventStorageSpaceInBytes,
ulong? numberOfBytesPerSampleClock,
string batteryId,
DateTime? calibrationDate
)
```
**Behavior:** Inserts a new DAS information record by calling the `sp_DASInfoInsert` stored procedure. Returns the newly generated record ID as an `int`. Handles null `macAddress` by substituting an empty string. Clamps `calibrationDate` values below `SqlDateTime.MinValue` to `SqlDateTime.MinValue`. Null values for `maxEventStorageSpaceInBytes` and `numberOfBytesPerSampleClock` are converted to 0. Errors from the stored procedure are processed via `DbWrapper.ProcessReturn()`.
---
### `DASInfoClear`
**Signature:**
```csharp
public static void DASInfoClear(int iDASRecordId)
```
**Behavior:** Clears DAS information for the specified record by calling the `sp_DASInfoClear` stored procedure. **Silently returns without action** if `DbWrapper.Connected` is `false`. Errors from the stored procedure are processed via `DbWrapper.ProcessReturn()`.
---
### `SetConfiguration`
**Signature:**
```csharp
public static void SetConfiguration(
int iDASRecordId,
string xml,
int fileStore
)
```
**Behavior:** Persists configuration data by calling the `sp_ConfigDataSet` stored procedure. The `xml` string is converted to a UTF-8 byte array and stored as `Var

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/DASFactoryDb/DAS/DAS.cs
generated_at: "2026-04-17T16:13:50.698481+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "02b33d07988ee1e0"
---
# DAS
### Purpose
This module provides data access layer functionality for DAS (Data Acquisition System) communication records. It exists to insert new DAS device records into the factory database, capturing device identification (serial number), firmware version, and connection metadata through a stored procedure interface.
### Public Interface
**`DAS.InsertDASSimple(string serialNumber, string firmwareVersion, string connectString)`** → `int`
- Inserts a new record into the DAS communication table via the `sp_IDASCommunicationTableSimpleInsert` stored procedure.
- Parameters:
- `serialNumber` (string): Device serial number, passed as `NVarChar(50)`
- `firmwareVersion` (string): Firmware version string, passed as `NVarChar(50)`
- `connectString` (string): Connection string, passed as `NVarChar(255)`
- Returns the newly created record ID from the `@new_id` output parameter.
- Throws or propagates errors via `DbWrapper.ProcessReturn()` if the stored procedure sets `@errorNumber`.
### Invariants
- The stored procedure `sp_IDASCommunicationTableSimpleInsert` must exist in the target database.
- `DbWrapper.GetDASFactoryCommand()` must return a valid, executable command object with an open connection.
- The returned `new_id` will be a valid integer upon successful insertion.
### Dependencies
- **Depends on**: `DbWrapper` (static class providing `GetDASFactoryCommand()` and `ProcessReturn(SqlParameter, SqlParameter)` methods) - inferred from usage but not shown in source.
- **Depends on**: `System.Data`, `System.Data.SqlClient` for ADO.NET infrastructure.
- **Consumers**: Unknown from source alone - likely factory calibration or device registration workflows.
### Gotchas
- **Parameter naming inconsistency**: The `connectString` parameter is added as `"ConnectString"` (camelCase vs PascalCase) - this may cause issues if the stored procedure is case-sensitive.
- **Connection disposal pattern**: The `cmd.Connection.Dispose()` is called in a `finally` block, but the `using` statement wrapping `cmd` would typically handle command disposal. This suggests the connection lifecycle is managed separately from the command.
- **No null validation**: The method does not validate input parameters before passing to the stored procedure.
---

View File

@@ -0,0 +1,116 @@
---
source_files:
- DataPRO/DASFactoryDb/Diagnostics/Diagnostics.cs
generated_at: "2026-04-17T15:59:34.341673+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "82e5a9a5a5472a3a"
---
# Documentation: DASFactoryDb.Diagnostics
## 1. Purpose
This module provides a data access layer for recording and clearing diagnostic actions and results for a Data Acquisition System (DAS). It serves as the persistence mechanism for diagnostic test configurations and their outcomes across analog, digital, and squib (pyrotechnic) channels. The class abstracts database stored procedure calls into simple static methods, handling parameter construction, execution, and error reporting for factory diagnostic operations.
---
## 2. Public Interface
### `ClearDiagnosticActionsAllChannels(int idasRecordId)`
**Signature:** `public static void ClearDiagnosticActionsAllChannels(int idasRecordId)`
Clears all diagnostic actions for all channels associated with a given DAS communication record. Invokes the stored procedure `sp_DiagnosticActionsClear`, passing `null` for the channel number parameter to indicate "all channels." Silently returns without action if `DbWrapper.Connected` is false.
---
### `InsertDiagnosticAction(...)`
**Signature:**
```csharp
public static void InsertDiagnosticAction(
int dasRecordId,
int dasChannelNumber,
bool measureExcitation,
bool measureOffset,
bool checkDigitalState,
bool measureInternalOffset,
bool removeOffset,
bool measureNoise,
bool performShuntCheck,
bool squibFireCheck,
bool performVoltageInsertCheck,
bool performCalSignalCheck,
bool measureBridgeResistance
)
```
Inserts a diagnostic action configuration for a specific DAS channel. Each boolean parameter specifies whether a particular diagnostic check should be performed. Invokes `sp_DiagnosticsActionsInsert`. The stored procedure returns a `@new_id` output parameter, but this value is not exposed to callers. Silently returns without action if `DbWrapper.Connected` is false.
---
### `ClearExistingDiagnosticsAllChannels(int idasRecordId = -1)`
**Signature:** `public static void ClearExistingDiagnosticsAllChannels(int idasRecordId = -1)`
Clears all diagnostics and events results for all channels associated with a DAS record. Invokes `sp_DiagnosticsResultsClear`, passing `null` for both `@DASChannelNumber` and `@EventNumber` parameters to indicate "all." The default parameter value of `-1` is used if no argument is provided. Silently returns without action if `DbWrapper.Connected` is false.
---
### `InsertAnalogDiagnosticResult(...)`
**Signature:**
```csharp
public static void InsertAnalogDiagnosticResult(
int iDASRecordId,
int dasChannelNumber,
int eventNumber,
double scalefactorMilliVoltsPerADC,
double expectedExcitationMilliVolts,
double? measuredExcitationMilliVolts,
bool negativeExcitation,
double? measuredOffsetMilliVolts,
double? measuredInternalOffsetMilliVolts,
double? autoZeroPercentDeviation,
short? finalOffsetADC,
int? removedOffsetADC,
int? removedInternalOffsetADC,
double? noisePercentFullScale,
bool shuntDeflectionFailed,
bool calSignalCheckFailed,
double? measuredShuntDeflectionMv,
double? measuredCalSignalMv,
double? targetCalSignalMv,
double? targetGain,
double? measuredGain,
double? queriedGain,
double? targetShuntDeflectionMv,
double? bridgeResistance,
double zeroMVInADC,
double windowAverageADC
)
```
Inserts analog diagnostic measurement results for a specific channel and event. Captures excitation measurements, offset values, noise metrics, shunt check results, calibration signal data, gain measurements, and bridge resistance. Invokes `sp_DiagnosticsResultsAnalogInsert`. Silently returns without action if `DbWrapper.Connected` is false.
---
### `InsertSquibDiagnosticResult(...)`
**Signature:**
```csharp
public static void InsertSquibDiagnosticResult(
int iDASRecordId,
int dasChannelNumber,
int eventNumber,
double[] squibFireCurrentData,
double[] squibFireVoltageData,
double[] squibFireTimeAxis,
double? measuredDurationMS,
double? measuredDelayMS,
bool? squibFirePassed,
bool? squibDurationPassed,
bool? squibDelayPassed,
double squibThreshold,
double squibVoltageScaler,
double squibCurrentScaler
)
```
Inserts squib (pyrotechnic firing) diagnostic results. The `squibFireCurrentData`, `squibFireVoltageData`, and `squibFireTimeAxis` arrays are serialized to binary format (8 bytes per double using `BitConverter.GetBytes`)

View File

@@ -0,0 +1,80 @@
---
source_files:
- DataPRO/DASFactoryDb/Download/Download.cs
generated_at: "2026-04-17T15:59:45.195241+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "419e1018bcd6dde6"
---
# Documentation: `DASFactoryDb.Download.Download`
## 1. Purpose
This module provides a data access layer for managing download-related database operations in a DAS (Data Acquisition System) Factory context. It serves as an abstraction layer for persisting and clearing event metadata—including download statuses, fault flags, arm attempts, event information, download requests, and event GUIDs—via SQL Server stored procedures. The class is designed to support the lifecycle of data recorder events from initial recording through download completion.
## 2. Public Interface
### Clear Methods
| Method | Signature | Behavior |
|--------|-----------|----------|
| `ClearExistingEventDownloadStatus` | `void ClearExistingEventDownloadStatus(int idasRecordId)` | Clears all existing download status records for the specified DAS record via `sp_EventDownloadStatusClear`. |
| `ClearExistingEventArmAttempts` | `void ClearExistingEventArmAttempts(int idasRecordId)` | Clears all arm attempt records for a given data recorder via `sp_EventArmAttemptsClear`. |
| `ClearExistingFaultFlags` | `void ClearExistingFaultFlags(int idasRecordId)` | Clears event fault flag records via `sp_EventFaultFlagsClear`. |
| `ClearExistingDownloadReports` | `void ClearExistingDownloadReports(int idasRecordId)` | Clears event info/download report records via `sp_DownloadReportClear`. |
| `ClearExistingEventGuids` | `void ClearExistingEventGuids(int idasRecordId)` | Clears event GUID records via `sp_EventGuidsClear`. |
| `ClearExistingDownloadRequests` | `void ClearExistingDownloadRequests(int idasRecordId)` | Clears download request records via `sp_DownloadRequestsClear`. |
| `ClearExistingUARTDownloadRequests` | `void ClearExistingUARTDownloadRequests(int idasRecordId)` | Clears UART download request records via `sp_UARTDownloadRequestsClear`. |
### Insert Methods
| Method | Signature | Behavior |
|--------|-----------|----------|
| `InsertEventFaultFlags` | `void InsertEventFaultFlags(int iDASRecordId, ushort faultFlag)` | Inserts a fault flag record via `sp_EventFaultFlagsInsert`. The `ushort` is stored as `SmallInt`. |
| `InsertEventArmAttempts` | `void InsertEventArmAttempts(int iDASRecordId, int armAttempts)` | Inserts arm attempt count via `sp_EventArmAttemptsInsert`. The `int` is stored as `SmallInt`. |
| `InsertEventInfo` | `void InsertEventInfo(int iDASRecordId, int eventNumber, Guid testGUID, ushort faultFlags, int armAttempts, DateTime testTime, string testID, string description, bool hasBeenDownloaded, bool wasTriggered, string xml)` | Inserts comprehensive event information via `sp_EventInfoInsert`. The `xml` parameter is stored as UTF-8 encoded bytes in a `VarBinary` field named `@Modules`. |
| `InsertEventDownloadStatus` | `void InsertEventDownloadStatus(int iDASRecordId, bool downloadStatus)` | Inserts download status via `sp_EventDownloadStatusInsert`. |
| `DownloadRequestInsert` | `void DownloadRequestInsert(int iDASRecordId, ushort eventNumber, int dasChannelNumber, ulong startSample, ulong endSample, ulong samplesToSkip, double startRecordTimeStampSec, double triggerTimeStampSec, double startRecordTimeStampNanoSec, double triggerTimestampNanoSec, bool PTPMasterSync)` | Inserts a download request via `sp_DownloadRequestsInsert`. Sample values are stored as `Int`; timestamps as `Decimal`. |
| `UARTDownloadRequestInsert` | `void UARTDownloadRequestInsert(int iDASRecordId, ushort eventNumber, ulong totalByteCount, ulong triggerByteCount, ulong faultByteCount, ulong startTimestamp, ulong endTimestamp, int baudRate)` | Inserts a UART download request via `sp_UARTDownloadRequestsInsert`. Byte counts and timestamps stored as `Decimal`. |
| `EventGuidInsert` | `void EventGuidInsert(int iDASRecordId, Guid guid)` | Inserts an event GUID via `sp_EventGuidsInsert`. The GUID is converted to uppercase string. |
## 3. Invariants
- **Connection Guard**: All public methods immediately return without action if `DbWrapper.Connected` is `false`.
- **Stored Procedure Usage**: All database operations are performed via stored procedures; no inline SQL is used.
- **Error Parameter Pattern**: Every stored procedure call includes `@errorNumber` (output, `Int`) and `@errorMessage` (output, `NVarChar(255)`) parameters.
- **Connection Disposal**: All methods dispose of the database connection in a `finally` block, ensuring cleanup even on exception.
- **Command Source**: All methods obtain commands via `DbWrapper.GetDASFactoryCommand()`.
- **GUID Normalization**: GUIDs are stored as uppercase strings in `NVarChar(50)` fields.
- **DateTime Handling**: In `InsertEventInfo`, `DateTime.MinValue` is converted to `SqlDateTime.MinValue` before storage.
## 4. Dependencies
### This Module Depends On
- **`DbWrapper`** (external, not shown): Provides `Connected` property, `GetDASFactoryCommand()` factory method, and `ProcessReturn(SqlParameter, SqlParameter)` error handling.
- **`System.Data.SqlClient`**: ADO.NET SQL Server provider.
- **SQL Server Database**: Requires the following stored procedures to exist:
- `sp_EventDownloadStatusClear`, `sp_EventDownloadStatusInsert`
- `sp_EventArmAttemptsClear`, `sp_EventArmAttemptsInsert`
- `sp_EventFaultFlagsClear`, `sp_EventFaultFlagsInsert`
- `sp_DownloadReportClear`
- `sp_EventGuidsClear`, `sp_EventGuidsInsert`
- `sp_DownloadRequestsClear`, `sp_DownloadRequestsInsert`
- `sp_UARTDownloadRequestsClear`, `sp_UARTDownloadRequestsInsert`
- `sp_EventInfoInsert`
### What Depends On This Module
- **Unclear from source alone**: No consumers are visible in this file.
## 5. Gotchas
### Critical Bug: Incorrect Parameter Value in `DownloadRequestInsert`
```csharp
cmd.Parameters.Add(
new SqlParameter("@StartRecordTimestampNanoSec", SqlDbType.Decimal)
{ Value = startRecordTimeStampSec }); // BUG: Should be startRecordTimeStampNanoSec
```
The parameter `@StartRecordTimestampNanoSec` is incorrectly assigned `startRecordTimeStampSec` instead of `startRecordTimeStampNanoSec`. This will result in incorrect nanosecond timestamp data being persisted.
### Missing `@` Prefix in `

View File

@@ -0,0 +1,34 @@
---
source_files:
- DataPRO/DASFactoryDb/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:13:50.701613+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "966fd7b974b6fce8"
---
# Properties
### Purpose
This module contains assembly-level metadata for the `DASFactoryDb` assembly. It provides versioning, copyright, and COM visibility configuration for the compiled output. It contains no executable logic.
### Public Interface
None. This module contains only assembly attributes:
- `AssemblyTitle`: "DASFactoryDb"
- `AssemblyVersion`: "1.0.0.0"
- `AssemblyFileVersion`: "1.0.0.0"
- `ComVisible`: `false`
- `Guid`: "49c60032-9c8a-4ea5-9e26-2f1663555759"
### Invariants
- Assembly version is fixed at 1.0.0.0.
- COM visibility is disabled for all types in this assembly.
### Dependencies
- **Depends on**: `System.Reflection`, `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`.
- **Consumers**: Build system and any projects that reference the DASFactoryDb assembly.
### Gotchas
None identified from source alone - this is a standard AssemblyInfo file with no custom logic.
---

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/DTS.Core.DbAPIWrapper/ApiInfo.cs
- DataPRO/DTS.Core.DbAPIWrapper/DbApiWrapper.cs
generated_at: "2026-04-17T16:38:08.882749+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "cb91814bb67d2020"
---
# Documentation: DTS.Core.DbAPIWrapper
## 1. Purpose
This module provides a wrapper layer around the `DbAPI.DbAPI` database access library, abstracting connection management, user authentication, and data retrieval operations for test setups and DAS (Data Acquisition System) records. It serves as the primary interface for client code to interact with the underlying database, encapsulating connection details and user session state within a single cohesive class.
---
## 2. Public Interface
### Class: `ApiInfo`
A data container class holding authenticated session state.
| Property | Type | Description |
|----------|------|-------------|
| `UserDbRecord` | `IUserDbRecord?` | Nullable user database record representing the authenticated user. |
| `ConnectionDetails` | `IConnectionDetails?` | Nullable connection details for the active session. |
---
### Class: `DbApiWrapper`
#### Constructor
```csharp
public DbApiWrapper(string dbServer, string

View File

@@ -0,0 +1,50 @@
---
source_files:
- DataPRO/DataPRO Installer/Source Files/Driver/DPInstallWrapper2/DPInstallWrapper2.cs
generated_at: "2026-04-17T16:45:59.910732+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6d03d299d83277d2"
---
# DPInstallWrapper2 Documentation
## 1. Purpose
This module serves as a shim wrapper for executing driver installer executables (specifically `dpinst.exe`) within the DataPRO installation process. Its primary purpose is to work around a known quirk where the wrapped executable returns non-zero exit codes even on successful installations. By always returning `0` to the calling installer, it prevents false failure conditions from propagating up the installation chain.
## 2. Public Interface
### `DPInstallWrapper2.Main`
**Signature:**
```csharp
static int Main(string[] args)
```
**Behavior:**
- Entry point for the wrapper executable.
- Expects `args[0]` to be the path to the executable to run.
- Passes exactly three arguments (`args[1]`, `args[2]`, `args[3]`) to the spawned process.
- Automatically quotes any argument containing a space character by wrapping it in double quotes.
- Launches the target process synchronously, waits for completion, and always returns `0` regardless of the child process's actual exit code.
## 3. Invariants
- **Argument count requirement:** The caller must supply at least 4 arguments. If fewer than 4 arguments are provided, the code will throw an `IndexOutOfRangeException` when accessing `lArgs[1]`, `lArgs[2]`, or `lArgs[3]`.
- **Fixed argument passing:** Exactly three arguments are forwarded to the child process. Any additional arguments beyond `args[3]` are silently ignored.
- **Return value:** The method always returns `0` (success), regardless of the wrapped process's actual exit code.
## 4. Dependencies
**This module depends on:**
- `System.Collections.Generic` — for `List<string>` used to manipulate arguments
- `System.Diagnostics` — for the `Process` class used to spawn and manage the child process
**Dependents:** Not determinable from source alone; this is a standalone executable invoked by the DataPRO installer infrastructure.
## 5. Gotchas
1. **Exit code is discarded:** The wrapper captures `proc.ExitCode` into a local variable `exitCode` but never uses it. All failures of the child process are masked and reported as success. This could hide genuine installation failures.
2. **Off-by-one in quoting logic:** The loop iterates from `i = 1` to `i < args.Length`, but `lArgs[0]` (the executable path) is never quoted. This may be intentional since `FileName` property typically doesn't require quoting

View File

@@ -0,0 +1,48 @@
---
source_files:
- DataPRO/DataPRO Installer/Source Files/Driver/DPInstallWrapper2/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:13:55.382246+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1f8a3e54b48f4f09"
---
# Properties
### Purpose
This module contains assembly metadata for the `DPInstallWrapper2` assembly, which appears to be a driver installer wrapper component within the DataPRO installation system. The file configures assembly identity, version information, and COM visibility settings using standard .NET assembly attributes. It exists to provide build-time metadata for the compiled assembly.
### Public Interface
No public functions, classes, or methods are defined in this module. This file contains only assembly-level attribute declarations:
- `AssemblyTitle("DPInstallWrapper2")` - Sets the assembly title
- `AssemblyDescription("")` - Empty description
- `AssemblyConfiguration("")` - Empty configuration
- `AssemblyCompany("")` - Empty company name
- `AssemblyProduct("DPInstallWrapper2")` - Product name
- `AssemblyCopyright("Copyright © 2019")` - Copyright notice
- `AssemblyTrademark("")` - Empty trademark
- `AssemblyCulture("")` - Neutral culture
- `ComVisible(false)` - Types not visible to COM components
- `Guid("bb0e5961-d169-4dab-ac55-72e1e71c1ef9")` - COM type library identifier
- `AssemblyVersion("1.0.0.0")` - Assembly version
- `AssemblyFileVersion("1.0.0.0")` - File version
### Invariants
- The GUID `bb0e5961-d169-4dab-ac55-72e1e71c1ef9` uniquely identifies this assembly's COM type library if exposed.
- `ComVisible(false)` ensures types are not exposed to COM by default.
- Version numbers are fixed at `1.0.0.0` for both assembly and file versions.
### Dependencies
**Imports:**
- `System.Reflection`
- `System.Runtime.CompilerServices`
- `System.Runtime.InteropServices`
**Consumers:** Unknown from this file alone - would be any project referencing the DPInstallWrapper2 assembly.
### Gotchas
- The `AssemblyDescription`, `AssemblyCompany`, `AssemblyConfiguration`, and `AssemblyTrademark` attributes are all empty strings, which may indicate incomplete metadata configuration.
- The copyright year (2019) differs from other modules in the system, suggesting this component was created or updated later in the project lifecycle.
---

View File

@@ -0,0 +1,55 @@
---
source_files:
- DataPRO/DataPRO.Core/DataProConstants.cs
generated_at: "2026-04-17T16:43:42.110119+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "9a0ee15a0aa322d8"
---
# Documentation: DataProConstants.cs
## 1. Purpose
This module serves as a centralized location for constant values used throughout the DataPro system. It exists to eliminate magic strings and provide a single source of truth for configuration paths and other system-wide constants. Currently, its primary role is defining the path to the application's configuration file.
---
## 2. Public Interface
### Class: `DataProConstants`
- **Kind**: `public static class`
- **Namespace**: `DataPro.Core`
- **Description**: A static container class holding compile-time constants for the DataPro application.
### Field: `CustomConfigPath`
- **Signature**: `public const string CustomConfigPath = "DataPRO.exe.config"`
- **Type**: `string`
- **Description**: A compile-time constant containing the relative path to the application's configuration file. The value is `"DataPRO.exe.config"`.
---
## 3. Invariants
- `CustomConfigPath` is a `const` (compile-time constant), meaning its value is embedded directly into calling assemblies at compile time. Changing this value requires recompilation of all dependent code.
- The path is a relative path, not an absolute path. The actual file location resolved at runtime depends on the application's current working directory.
---
## 4. Dependencies
### This module depends on:
- None. The file has no `using` statements and relies only on built-in C# language features.
### What depends on this module:
- Unknown from source alone. Any module referencing `DataPro.Core.DataProConstants.CustomConfigPath` would depend on this file.
---
## 5. Gotchas
1. **Commented-out absolute path**: The source contains a commented-out line referencing an absolute path (`C:\Program Files\DataPro\bin\DataPro.config`). This suggests the configuration strategy was changed from an absolute installation path to a relative path. The reason for this change is not documented in the source.
2. **Misleading constant name**: The constant is named `CustomConfigPath`, but the current value (`DataPRO.exe.config`) follows the standard .NET application configuration file naming convention. It is unclear what is "custom" about this path, or whether the name is historical baggage from when it pointed to a non-standard location.
3. **Namespace/folder case discrepancy**: The namespace is declared as `DataPro.Core` (lowercase "o"), while the file path shows `DataPRO.Core` (uppercase "PRO"). This may cause confusion when navigating the codebase, though it has no runtime impact on Windows.

View File

@@ -0,0 +1,37 @@
---
source_files:
- DataPRO/DataPRO.Core/Config/DataProConfig.cs
generated_at: "2026-04-17T16:11:20.599916+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c85bf33b30f4fe33"
---
# Config
### Purpose
This module provides centralized access to a custom application configuration file, abstracting away the details of `System.Configuration`. It exists to allow the application to read settings from a non-default config file path defined by `DataProConstants.CustomConfigPath`, enabling configuration separation from the main executable.
### Public Interface
**`DataProConfig` (static class)**
- `static Configuration AltConfig { get; }` — Returns the `Configuration` object mapped to the custom config file. Useful for advanced configuration operations not covered by helper methods.
- `static string GetAppSetting(string key)` — Retrieves an application setting value by key from the `<appSettings>` section. Returns `String.Empty` if the key is not found.
- `static object GetSection(string sectionName)` — Retrieves a named configuration section from the config file. Used by plugin code to access custom sections.
### Invariants
- The static constructor runs exactly once, before any member is accessed.
- `Config` is initialized via `ConfigurationManager.OpenMappedExeConfiguration` with `ConfigurationUserLevel.None` and will never be null after static construction.
- `GetAppSetting` always returns a non-null string (empty string if key missing).
- The configuration file path is determined by `DataProConstants.CustomConfigPath` and cannot be changed at runtime.
### Dependencies
- **Depends on**: `System.Configuration`, `DataProConstants` (specifically `DataProConstants.CustomConfigPath`).
- **Depended on by**: Unknown from source alone—likely consumed by plugin code and core application components requiring configuration access.
### Gotchas
- If `DataProConstants.CustomConfigPath` points to a non-existent or malformed config file, the static constructor will throw an exception, rendering the entire class unusable for the application lifetime.
- `GetAppSetting` performs a linear search through `Config.AppSettings.Settings` using LINQ; performance may degrade with very large numbers of settings.
- The third parameter `true` passed to `OpenMappedExeConfiguration` is undocumented in the source context—it appears to be a boolean for "preload" behavior, but its exact effect is unclear from source alone.
---

View File

@@ -0,0 +1,49 @@
---
source_files:
- DataPRO/DataPRO.Core/EventManager/EventManager.cs
generated_at: "2026-04-17T16:11:20.602481+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "bb36e013f0f39c56"
---
# EventManager
### Purpose
This module implements a type-safe, loosely-coupled publish/subscribe event system. It allows components to communicate without direct references to each other, supporting filtered subscriptions and diagnostic monitoring of event flow. This decouples publishers from subscribers and centralizes event routing.
### Public Interface
**`EventManager` (static class)**
- `static void Publish<T>(T eventData) where T : class` — Publishes an event to all subscribers of type `T`. If no subscribers exist, returns immediately. Each subscriber's filter (if present) is evaluated before invoking the callback.
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Subscribes to events of type `T` without a filter.
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener, Predicate<T> eventFilter) where T : class` — Subscribes to events of type `T` with a filter predicate. The callback is only invoked when the filter returns `true`.
- `static void UnSubscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Removes all subscriptions matching the given listener delegate.
- `static void Clear()` — Removes all subscribers from all event types.
- `static void SubscribeToDiagnosticEvents(DiagnosticCallbackDelegate listener)` — Registers a callback to receive diagnostic events about the event system itself.
- `static void UnSubscribeToDiagnosticEvents(DiagnosticCallbackDelegate listener)` — Removes a diagnostic listener.
- `static void ClearDiagnosticEvents()` — Removes all diagnostic listeners.
**`SubscriberCallbackDelegate<in T>` (delegate)**
- `void SubscriberCallbackDelegate<in T>(T item) where T : class` — The signature for event callbacks.
**`DiagnosticCallbackDelegate` (delegate)**
- `void DiagnosticCallbackDelegate(EventDiagnosticType eventType, Type t, object eventData, string listener)` — The signature for diagnostic callbacks.
**`EventDiagnosticType` (enum)**
- Values: `AddListener = 0`, `AddListenerDiagnostic = 1`, `PublishEvent = 2`, `RemoveListenerDiagnostic = 3`, `RemoveListener = 4`
### Invariants
- `SubscriberList` and `DiagnosticList` are never null (initialized inline).
- `Publish<T>` silently does nothing if no subscribers exist for type `T`.
- Subscribers are stored in insertion order; callbacks are invoked in that order during `Publish`.
- `UnSubscribe<T>` removes all matching entries (not just the first).
- `EventMetaData<T>` is internal and always contains a non-null `Callback` after construction.
### Dependencies
- **Depends on**: `System`, `System.Collections.Generic`, `System.Reflection`.
- **Depended on by**: Unknown from source alone—likely used throughout the application for cross-component communication.
### Gotchas
- Subscribers hold references to callbacks. If a subscriber fails to call `UnSubscribe`, the callback (and potentially its capturing object) will not be garbage collected, causing memory leaks.
- `Publish` iterates over `listeners` directly; if a callback modifies the subscriber list (e.g., by calling `Subscribe` or `UnSubscribe`), behavior is undefined (likely an exception or skipped

View File

@@ -0,0 +1,48 @@
---
source_files:
- DataPRO/DataPRO.Core/PluginLib/PluginConfigData.cs
- DataPRO/DataPRO.Core/PluginLib/PluginConfig.cs
- DataPRO/DataPRO.Core/PluginLib/PluginConfigSectionHandler.cs
- DataPRO/DataPRO.Core/PluginLib/PluginManager.cs
generated_at: "2026-04-17T15:38:45.565653+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "4a5da7eb91c3d413"
---
# PluginLib Module Documentation
## 1. Purpose
The `PluginLib` module provides a Managed Extensibility Framework (MEF)-based plugin system for the DataPRO application. It handles discovery, loading, and retrieval of plugins from configurable directories, supporting both single and multiple plugin exports of the same type. The module implements a thread-safe singleton pattern for plugin management and integrates with the application's configuration system.
---
## 2. Public Interface
### `PluginManager` Class
The primary class for interacting with the plugin system.
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetPluginManager` | `public static PluginManager GetPluginManager()` | Returns the singleton instance of `PluginManager`. Thread-safe via lock. |
| `GetPlugin<T>` | `public static T GetPlugin<T>() where T : class` | Returns a single MEF plugin export of type `T`. Returns `null` if no export exists. |
| `GetPlugin<T>` | `public static T GetPlugin<T>(string configPluginSetting) where T : class` | Returns a specific plugin from multiple exports by matching `item.Value.ToString()` against `configPluginSetting`. |
| `GetPlugins<T>` | `public static IEnumerable<Lazy<T>> GetPlugins<T>() where T : class` | Returns all MEF plugin exports of type `T` as `Lazy<T>` instances. |
| `GetPluginList<T>` | `public List<Assembly> GetPlugin<T>() where T : class` | Returns a list of distinct assemblies from the first `DirectoryCatalog` found. Returns `null` if no directory catalog exists. |
### `PluginConfig` Class (Static)
Configuration helper for plugin settings.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DataProPlugins` | `public const string DataProPlugins = "dataProPlugins"` | Constant for the app setting key name. |
| `GetDataProPluginsSetting` | `public static string GetDataProPluginsSetting(string setting)` | Concatenates the app setting value from `DataProPlugins` key with `.` + `setting`. |
### `PluginConfigData` Class
XML-serializable configuration data class.
| Field | Type |

View File

@@ -0,0 +1,35 @@
---
source_files:
- DataPRO/DataPRO.Core/Properties/AssemblyInfo.cs
generated_at: "2026-04-17T16:28:03.040571+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "117dfebe92b0ea1c"
---
# Properties
### Purpose
This module contains assembly-level metadata configuration for the DataPro.Core assembly. It defines standard .NET assembly attributes including title, version information, COM visibility settings, and a unique GUID for type library identification. This is a standard .NET Framework assembly information file.
### Public Interface
No public types or functions are exposed. This module consists solely of assembly-level attributes:
- `AssemblyTitle`: "DataPro.Core"
- `AssemblyProduct`: "DataPro.Core"
- `AssemblyVersion`: "1.0.0.0"
- `AssemblyFileVersion`: "1.0.0.0"
- `ComVisible`: false
- `Guid`: "bdf5ad7a-51db-4ad0-8186-d1ead7405848"
### Invariants
- Assembly version is fixed at "1.0.0.0" for both assembly and file versions.
- COM visibility is disabled for all types in this assembly.
- The GUID "bdf5ad7a-51db-4ad0-8186-d1ead7405848" uniquely identifies this assembly's type library.
### Dependencies
**Depends on:**
- `System.Reflection`
- `System.Runtime.CompilerServices`
- `System.Runtime.InteropServices`
**

View File

@@ -0,0 +1,33 @@
---
source_files:
- DataPRO/DataPRO.Core/ServiceManager/IServicePublishedEvent.cs
- DataPRO/DataPRO.Core/ServiceManager/ServicePublishedEvent.cs
- DataPRO/DataPRO.Core/ServiceManager/ServiceManager.cs
generated_at: "2026-04-17T16:36:18.703341+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5cab21cff0e733cd"
---
# ServiceManager Module Documentation
## 1. Purpose
The ServiceManager module implements a service locator pattern, enabling decoupled component communication within the application. It allows components to publish implementations of singleton interfaces (services) that other components can retrieve without direct knowledge of the publisher. The module provides event-driven notification when services are published or unpublished, supporting reactive architectures where consumers need to respond to service availability changes.
---
## 2. Public Interface
### ServiceManager (Static Class)
A static service locator that manages a registry of interface-to-implementation mappings.
| Method | Signature | Description |
|--------|-----------|-------------|
| `Publish<T>` | `void Publish<T>(T item) where T : class` | Publishes a service implementation under its interface type `T`. Throws `ArgumentException` if the type is already published. |
| `Publish` | `void Publish(object item, IEnumerable<Type> interfaceList, bool skipPublishedInterfaces)` | Publishes a single object under multiple interface types. If `skipPublishedInterfaces` is `true`, silently skips already-published interfaces; otherwise throws `ArgumentException`. |
| `Exists<T>` | `bool Exists<T>() where T : class` | Returns `true` if interface type `T` has been published; otherwise `false`. |
| `Exists` | `bool Exists(Type t)` | Non-generic overload. Returns `true` if the specified type has been published; otherwise `false`. |
| `Get<T>` | `T Get<T>() where T : class` | Retrieves the published service for interface type `T`. Throws `ArgumentException` if not published. |
| `Clear<T>` | `void Clear<T>() where T : class` | Unpublishes the service for interface type `T`. Silently does nothing if the type is not

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/DataPRO.Core/Settings/SettingsChangedEventArgs.cs
- DataPRO/DataPRO.Core/Settings/SettingsCollection.cs
generated_at: "2026-04-17T15:42:20.133577+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "19770357354d5bed"
---
# Documentation: DataPRO.Core.Settings
## 1. Purpose
This module provides an observable dictionary implementation for application settings management. The `SettingsCollection<TKey, TItem>` class wraps a standard `Dictionary<TKey, TItem>` and raises events when items are added, removed, modified, or when the collection is cleared. This enables consumers to react to configuration changes in real-time without polling. The module is designed to serve as the foundation for a settings system where UI components or services need to be notified when preferences change.
---
## 2. Public Interface
### `SettingsCollection<TKey, TItem>`
A generic dictionary implementation that implements `IDictionary<TKey, TItem>` with change notification.
#### Events
| Signature | Description |
|-----------|-------------|
| `event EventHandler<SettingsChangedEventArgs<TKey, TItem>> CollectionItemPropertyChanged` | Fired after any mutation operation (add, remove, modify, clear). Event args contain the change type and optionally the key/item involved. |
#### Constructors
The class provides only the default parameterless constructor (inherited from `Object`).
#### Methods
| Signature | Description |
|-----------|-------------|
| `void Add(TKey key, TItem value)` | Adds a key-value pair to the collection. Fires `CollectionItemPropertyChanged` with `ChangeSettingType.Add`. |
| `void Add(KeyValuePair<TKey, TItem> item)` | Adds a key-value pair via `KeyValuePair`. Fires `CollectionItemPropertyChanged` with `ChangeSettingType.Add`. |
| `bool Remove(TKey key)` | Removes the item with the specified key. Returns `true` if removed; fires event with `ChangeSettingType.Remove` only on success. |
| `bool Remove(KeyValuePair<TKey, TItem> item)` | Removes by `KeyValuePair.Key` (value is ignored). Fires event with `ChangeSettingType.Remove` only on success. |
| `void Clear()` | Removes all items. Fires `CollectionItemPropertyChanged` with `ChangeSettingType.ClearAll`. |
| `bool ContainsKey(TKey key)` | Returns `true` if the key exists. |
| `bool Contains(KeyValuePair<TKey, TItem> item)` | Returns `true` if both key and value match an entry in the collection. |
| `bool TryGetValue(TKey key, out TItem value)` | Attempts to retrieve the value for the given key. Returns `false` if key not found. |
| `IEnumerator<KeyValuePair<TKey, TItem>> GetEnumerator()` | Returns an enumerator over the collection. |
| `void CopyTo(KeyValuePair<TKey, TItem>[] array, int arrayIndex)` | **Throws `NotImplementedException`**. |
#### Properties
| Signature | Description |
|-----------|-------------|
| `TItem this[TKey key]` (getter) | Returns the value associated with the key. Throws `KeyNotFoundException` if key absent.

179
docs/ai/DataPRO/DataPRO.md Normal file
View File

@@ -0,0 +1,179 @@
---
source_files:
- DataPRO/DataPRO/IActionButtonContainer.cs
- DataPRO/DataPRO/WaitCursor.cs
- DataPRO/DataPRO/IPageContent.cs
- DataPRO/DataPRO/DataProMainWindow.xaml.cs
- DataPRO/DataPRO/BoolToOppositeBoolConverter.cs
- DataPRO/DataPRO/TranslateExtension.cs
- DataPRO/DataPRO/Settings.cs
- DataPRO/DataPRO/PageActionButtonsGroup.xaml.cs
- DataPRO/DataPRO/PageContentHeaderControl.xaml.cs
- DataPRO/DataPRO/DataProSession.cs
- DataPRO/DataPRO/LicensingFooter.xaml.cs
- DataPRO/DataPRO/PageContentControl.xaml.cs
- DataPRO/DataPRO/WindowResizer.cs
- DataPRO/DataPRO/PageActionControlsRibbon.xaml.cs
- DataPRO/DataPRO/PageActionButtonsRibbon.xaml.cs
- DataPRO/DataPRO/PageSearchControl.xaml.cs
- DataPRO/DataPRO/PageNavControlsGroup.xaml.cs
- DataPRO/DataPRO/PageMainContentControl.xaml.cs
- DataPRO/DataPRO/NavGraphStep.xaml.cs
generated_at: "2026-04-17T15:44:47.349944+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d26160d5c15903dc"
---
# DataPRO UI Infrastructure Documentation
## 1. Purpose
This module provides the core WPF user interface infrastructure for the DataPRO application. It establishes the main application window, session lifecycle management via Prism/Unity, and a composite navigation system. The code defines contracts for page content (`IPageContent`), action handling (`IActionButtonContainer`), and supplies reusable controls for navigation steps, search functionality, licensing status display, and window customization.
## 2. Public Interface
### Interfaces
**`IActionButtonContainer`**
Defines a contract for components that host and respond to action controls.
- `ActionButton[] GetActionButtons()`: Returns an array of `Controls.ActionButton` instances.
- `void OnActionButtonPress(Controls.ActionButton button)`: Handler for button click events.
- `void OnActionComboBoxChange(Controls.ActionComboBox comboBox)`: Handler for combo box selection changes.
- `void OnActionComboBoxDropDownClose(Controls.ActionComboBox comboBox)`: Handler for combo box drop-down closure.
- `void OnActionRadioButtonPress(Controls.ActionRadioButton button)`: Handler for radio button clicks.
**`IPageContent`**
Defines the lifecycle and interaction contract for content displayed within the navigation system.
- `void StartSearch(string term)`: Initiates a search within the content.
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)`: Validates content state; returns `true` if valid.
- `void OnSetActive()`: Called when the content becomes active/visible.
- `void SetPermissions(User.UserPermissionLevels actualPermission, User.UserPermissionLevels requiredPermission)`: Configures UI based on user rights.
- `void UnSet(Action OnComplete = null)`: Cleans up resources when content is unloaded.
- `bool OnButtonPress(Controls.PageButton button)`: Handles page-specific button presses.
- `object GetPageContent()`: Retrieves the content object.
- `bool KeyDown(object sender, KeyEventArgs e)`: Handles keyboard input.
### Classes
**`DataProMainWindow` : Window**
The application's main entry point window.
- `DataProMainWindow()`: Constructor that initializes components and sets `contentControl.Content` to a new `LoginControl2`.
**`DataProSession`**
Manages the application session, bootstrapping, and dependency injection container.
- `IUnityContainer Container { get; }`: The Unity dependency container.
- `IEventAggregator EventAggregator { get; }`: Prism event aggregator instance.
- `IRegionManager RegionManager { get; }`: Prism region manager instance.
- `void CreateSession()`: Initializes the session with default configuration.
- `void CreateSession(string customConfigPath)`: Initializes the session with a specific configuration path.
- `void Terminate()`: Called during application shutdown.
**`WaitCursor` : IDisposable**
A utility to temporarily set the mouse cursor to `Cursors.Wait`.
- `WaitCursor()`: Constructor that saves the current cursor and sets `Mouse.OverrideCursor` to `Cursors.Wait`.
- `void Dispose()`: Restores `Mouse.OverrideCursor` to the previous value.
**`BoolToOppositeBoolConverter` : IValueConverter**
WPF value converter that inverts a boolean value.
- `object Convert(object value, Type targetType, object parameter, CultureInfo culture)`: Returns `!(bool)value`.
- `object ConvertBack(...)`: Throws `NotSupportedException`.
**`TranslateExtension` : MarkupExtension**
XAML markup extension for localization.
- `TranslateExtension(string key)`: Constructor accepting the resource key.
- `object ProvideValue(IServiceProvider serviceProvider)`: Returns the localized string from `StringResources.ResourceManager`. Returns `#stringnotfound#` if the key is missing.
**`PageContentControl` : UserControl, INotifyPropertyChanged**
A composite control hosting navigation and main content areas.
- `object MainContent { get; set; }`: The current main content; setting this triggers `OnSetActive()` on `IPageContent` implementations.
- `bool UsesNavControl { get; set; }`: Toggles visibility of the navigation control.
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)`: Delegates validation to the `NavControl` or `MainContent`.
- `void OnSetActive()`: Activates the navigation control.
- `void UnSet()`: Cleans up the navigation control.
**`PageMainContentControl` : UserControl, INotifyPropertyChanged**
Hosts the actual content within a page.
- `object MainContent { get; set; }`: The content to display.
- `ContentControl GetContentControl()`: Returns the internal content presenter.
- `static void MarkInvalid(Control tb)`: Applies error styling (red border, specific styles) to a control.
- `static void MarkValid(Control tb)`: Resets styling for a control.
- `static void MarkWarning(Control tb)`: Applies warning styling (orange border) to a control.
**`PageSearchControl` : UserControl, INotifyPropertyChanged**
Provides search UI with debouncing.
- `bool UsesSearchControl { get; set; }`: Toggles search box visibility.
- `int RaiseSearchDelay { get; set; }`: Delay in milliseconds before firing the search event.
- `event SearchDelegate OnSearch`: Event raised when a search executes.
- `void ClearSearchTerm()`: Clears the search text box.
**`NavGraphStep` : UserControl, INotifyPropertyChanged**
Represents a single step in a visual navigation graph.
- `string Title { get; }`: The display text for the step.
- `IPageContent NavStepContent { get; set; }`: The content associated with this step.
- `void SetStatus(StatusTypes status)`: Updates visual state (`Current`, `NotCurrent`).
**`WindowResizer`**
Helper class to enable borderless window resizing via Win32 API.
- `WindowResizer(Window activeW)`: Attaches to a window and hooks `WndProc`.
- `void resizeWindow(object sender)`: Initiates resize based on the clicked rectangle name (e.g., "top", "bottomLeft").
- `void displayResizeCursor(object sender)`: Updates the cursor to a resize icon based on position.
- `void resetCursor()`: Resets cursor to `Cursors.Arrow`.
- `void dragWindow()`: Initiates a window drag operation.
**`LicensingFooter` : UserControl, INotifyPropertyChanged**
Displays licensing information at the bottom of the UI.
- `void OnSetActive()`: Updates licensing state and messages.
- `string LicensedTo`, `string LicenseType`, `string DataProVersion`, `string FooterMessage`: Bindable properties for display.
**`PageNavControlsGroup` : UserControl, INotifyPropertyChanged, IUIItems**
A container for navigation controls, handling permissions and layout.
- `string UniqueId { get; set; }`: Identifier for the control.
- `int SetControls(UserControl[] controls, int startingRow)`: Populates the internal grid with controls.
- `void SetEnabled(bool bEnable)`: Sets enabled state based on permissions.
- `void SetVisible(bool bShow)`: Sets visibility based on user preferences/permissions.
**`PageActionControlsRibbon` : UserControl**
A ribbon-style container for action controls.
- `void SetGroups(PageActionControlsGroup[] groups)`: Populates the ribbon with groups.
- `ActionButton GetButton(string id)`: Retrieves a button by ID.
- `ActionComboBox GetComboBox(string id)`: Retrieves a combo box by ID.
**`PageActionButtonsRibbon` : UserControl**
A specific ribbon implementation for button groups.
- `void SetGroups(PageActionButtonsGroup[] groups)`: Populates the ribbon.
- Routed Events: `FirstGroupFirstButtonClickedEvent`, `FirstGroupSecondButtonClickedEvent`, etc.
## 3. Invariants
- **Cursor Restoration**: `WaitCursor` must be disposed to restore `Mouse.OverrideCursor`. It is designed to be used within a `using` block.
- **Converter Target Type**: `BoolToOppositeBoolConverter.Convert` requires `targetType` to be `bool`; otherwise, it throws `InvalidOperationException`.
- **Session Initialization**: `DataProSession.CreateSession` must be called before accessing `Container`, `EventAggregator`, or `RegionManager`.
- **Main Content Activation**: Setting `PageContentControl.MainContent` automatically calls `OnSetActive()` on the new content if it implements `IPageContent`, provided the application `MainWindow` is not null.
- **Re-entrancy Guard**: `PageContentControl.MainContent` setter will return immediately without action if `_bSettingMainContentActive` is `true`.
- **Search Delay Coercion**: `PageSearchControl.RaiseSearchDelay` coerces negative values to `0`.
## 4. Dependencies
**Internal Dependencies (Inferred)**
- `DataPROWin7.Controls`: Custom controls (`ActionButton`, `ActionComboBox`, `NavStep`, `PageButton`, etc.).
- `DataPROWin7.Properties`: Application settings and resources.
- `LoginControl2`: Used in `DataProMainWindow` (definition not provided).
- `DataProBootstrapper`: Used in `DataProSession` (definition not provided).
**External Dependencies**
- **Prism & Unity**: `Prism.Events`, `Prism.Regions`, `Prism.Ioc`, `Prism.Unity`, `Unity` for DI and modular architecture.
- **WPF**: `System.Windows`, `System.Windows.Controls`, `System.Windows.Input`, `System.Windows.Markup`.
- **DTS Libraries**: `DTS.Slice.Users` (User permissions), `DTS.Common.SharedResource.Strings` (Localization), `DTS.Common` (Brushes/Colors).
- **ComponentOne**: `C1.WPF` (specifically `C1NumericBox`).
- **Win32 API**: `user32.dll` for `WindowResizer`.
## 5. Gotchas
- **Dead Code**: The file `PageActionButtonsGroup.xaml.cs` contains a class definition that is **entirely commented out**. It should not be considered functional.
- **Namespace Anomaly**: `WindowResizer.cs` is defined in the **global namespace** (it lacks a `namespace` declaration), which is unusual for this codebase.
- **Event Naming Mismatch**: In `PageActionButtonsRibbon`, the `SecondGroupThirdButtonClickedEvent` is registered with the name `"ThirdGroupThirdButtonClickedEvent"`. This typo could cause issues if wiring events by name.
- **Hardcoded Strings in WindowResizer**: The `resizeWindow` and `displayResizeCursor` methods rely on `switch` statements matching the `Name` property of the sender (e.g., "top", "bottomRight"). These names must exactly match the XAML element names.
- **Localization Fallback**: `TranslateExtension` returns the string `"#stringnotfound#"` (appended with the key) rather than throwing an exception or returning `null` if a resource key is missing.
- **Validation Styling**: `PageMainContentControl.MarkInvalid` and `MarkValid` rely on specific styles (`PageContentTextBoxErrorStyle`, etc.) being defined in the application resources. They also contain specific type checks for third-party controls (e.g., `C1NumericBox`) and internal controls (`ChannelCodeBuilder`).
- **Memory Usage**: Comments in `DataProSession` warn that the bootstrapper loads ~40MB and cannot be cleanly unloaded once created.

View File

@@ -0,0 +1,257 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/PreTestDiagnostics.cs
- DataPRO/DataPRO/CollectDataSubControls/AssignSensorsSLICE.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/ListViewTemplateSelector.cs
- DataPRO/DataPRO/CollectDataSubControls/SupportClasses.cs
- DataPRO/DataPRO/CollectDataSubControls/PostTestDiagnostics.cs
- DataPRO/DataPRO/CollectDataSubControls/SensorLayout.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/SquibResistanceCheck.xaml.cs
generated_at: "2026-04-17T15:46:20.834722+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b36d85328f88f945"
---
# Documentation: DataPRO CollectDataSubControls Module
## 1. Purpose
This module provides UI components and supporting infrastructure for the data collection workflow in the DataPRO application. It handles pre-test and post-test diagnostics, sensor-to-channel assignment, squib resistance verification, and dynamic list view templating. The module serves as the user-facing layer for hardware interaction during test execution, bridging the `DataModel`, `DASLib` services, and WPF presentation layer.
---
## 2. Public Interface
### PreTestDiagnostics
**Namespace:** `DataPROWin7.SubControls`
A thin wrapper around `DiagnosticsBase` for pre-test diagnostic operations.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PreTestDiagnostics()` | Default constructor, calls base constructor. |
| Constructor | `public PreTestDiagnostics(DataPROPage page)` | Initializes with a `DataPROPage` and `DiagnosticsType.PRE`. |
---
### PostTestDiagnostics
**Namespace:** `DataPROWin7.SubControls`
Extends `DiagnosticsBase` with post-test-specific behavior, including mixed-system warnings and low-power mode transitions.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PostTestDiagnostics()` | Default constructor. |
| Constructor | `public PostTestDiagnostics(DataPROPage page)` | Initializes with `DiagnosticsType.POST`. |
| RunCurStep | `public override void RunCurStep()` | Intercepts execution to warn if mixed hardware (e.g., G5 units) cannot run post-test diagnostics. Calls `base.RunCurStep()` after warning or if no warning needed. |
| UnSet | `public override void UnSet(Action OnComplete = null)` | Transitions hardware to low-power mode when leaving post-test diagnostics (FB14214). Disables navigation, then calls `GoToLowPower`. |
**Private Methods:**
- `RunsPostTestDiagnostics(IDASCommunication das)` — Returns `false` if the DAS is a G5 unit (cannot run post-test diagnostics).
- `DoWarning()` — Displays `StringResources.PostTestDiagnosticsSomeWarn` message box, then invokes `base.RunCurStep()` on the dispatcher.
- `GoToLowPower(Action OnComplete)` — Sets `ApplicationStatusTypes.LowPowerMode`, marks app busy with name `"PostTestDiagLowPower"`, and calls `SetLowPowerMode` on the parent `RunTestBase`.
---
### AssignSensorsSLICE
**Namespace:** `DataPROWin7.SubControls`
A minimal `UserControl` for sensor assignment (SLICE-specific).
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public AssignSensorsSLICE()` | Calls `InitializeComponent()`. |
---
### ListViewTemplateSelector
**Namespace:** `DataPROWin7.SubControls`
A `DataTemplateSelector` that switches between large and small item templates based on available client space and item count. Implements `INotifyPropertyChanged`.
| Member | Signature | Description |
|--------|-----------|-------------|
| LargeItemListTemplate | `public DataTemplate { get; set; }` | Template used when `Mode` is `LargeList`. |
| SmallItemListTemplate | `public DataTemplate { get; set; }` | Template used when `Mode` is `SmallList`. |
| Mode | `public Modes { get; set; }` | Current display mode (`SmallList` or `LargeList`). |
| NumberOfItems | `public int { get; set; }` | Sets item count; triggers mode recalculation. |
| ClientSize | `public Size { get; set; }` | Client area size; triggers mode recalculation. Default is `Size(1000, 800)`. |
| SelectTemplate | `public override DataTemplate SelectTemplate(object item, DependencyObject container)` | Returns `LargeItemListTemplate` or `SmallItemListTemplate` based on `Mode`. Defaults to `SmallItemListTemplate`. |
**Nested Enum:**
- `Modes { SmallList, LargeList }`
**Constants:**
- `LargeItemHeight = 110`
- `LargeItemWidth = 600`
---
### Support Classes
**Namespace:** `DataPROWin7.SubControls`
#### Thread Data Classes
| Class | Properties | Purpose |
|-------|------------|---------|
| `RunArmThreadData` | `ManualResetEvent DoneEvent` | Thread synchronization for arm operations. |
| `BasicInfoThreadData` | `ManualResetEvent DoneEvent` | Thread synchronization for basic info. |
| `HardwareThreadData` | `ManualResetEvent DoneEvent` | Thread synchronization for hardware operations. |
| `AutoProgressionThreadData` | `DoneEvent`, `CancelEvent`, `DelayMilliSeconds` | Thread data for automatic test progression. |
| `GenericThreadData` | `DAS`, `ResetEvent`, `CancelEvent`, `MissingHardwareEvent`, `CurrentStatus`, `CtrlStatusRibbon`, `DASList`, `CheckTrigger`, `DoneAction`, `TTSImport`, `SuppressWarning` | General-purpose thread data for validation and hardware operations. |
#### TestIDFixedPrefixSuffixValues (Enum)
Values: `NOT_FIXED = -1`, `None = 0`, `TimeStamp = 1`, `TestSetupName = 2`
#### TestIDPreFixSuffix
| Member | Signature | Description |
|--------|-----------|-------------|
| FixedValue | `public TestIDFixedPrefixSuffixValues { get; }` | Returns the fixed value type. |
| Constructor | `public TestIDPreFixSuffix(TestIDFixedPrefixSuffixValues fixedPrefixSuffix)` | Creates with enum value; stores string as `"TESTID_PREFIX_SUFFIX_" + value`. |
| Constructor | `public TestIDPreFixSuffix(string dbPrefixSuffix)` | Creates with custom string. |
| ToString | `public override string ToString()` | Returns the internal string. |
#### TestIDPreFixSuffixHelper (extends `BasePropertyChanged`)
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TestIDPreFixSuffixHelper(string testIDPreFixSuffix)` | Wraps a string-based prefix/suffix. |
| Constructor | `public TestIDPreFixSuffixHelper(TestIDFixedPrefixSuffixValues testIdPreFixSuffix)` | Wraps an enum-based prefix/suffix. |
| ToString | `public override string ToString()` | Returns localized string from `StringResources.ResourceManager`, or falls back to raw string. |
| Equals | `public override bool Equals(object obj)` | Compares `FixedValue`; if `NOT_FIXED`, compares string values. |
| GetHashCode | `public override int GetHashCode()` | Returns base implementation. |
---
### SensorLayout
**Namespace:** `DataPROWin7.SubControls`
A `UserControl` for assigning sensors to hardware channels. Implements `INotifyPropertyChanged`.
| Member | Signature | Description |
|--------|-----------|-------------|
| Channels | `public DataModel.HardwareChannel[] { get; set; }` | Channels from the current `Hardware`. |
| DASType | `public string { get; }` | Returns `Hardware.HardwareType` or `"N/A"`. |
| DASSerial | `public string { get; }` | Returns `Hardware.SerialNumber` or `"N/A"`. |
| ModuleSerialNumber | `public string { get; }` | Currently returns empty string (commented-out module logic). |
| ModuleNumberText | `public string { get; }` | Currently returns empty string (commented-out module logic). |
| Hardware | `public DataModel.DASHardware { get; set; }` | The hardware device being configured. |
| TestObject | `public DataModel.TestObject { get; set; }` | The test object containing sensors and hardware. |
| Sensors | `public Sensor[] { get; set; }` | Unassigned sensors from `TestObject`. |
| AssignButtonVisibility | `public Visibility { get; set; }` | Controls visibility of assign buttons; propagates to all sensors. |
| RepopulateSensors | `public void RepopulateSensors()` | Clears cached sensor list and raises `OnPropertyChanged("Sensors")`. |
**Nested Class: Sensor (extends BasePropertyChanged)**
| Member | Signature | Description |
|--------|-----------|-------------|
| Selected | `public bool { get; set; }` | Selection state; changes `BackgroundColor`. |
| BackgroundColor | `public Color { get; }` | `Colors.Yellow` if selected, `Colors.AliceBlue` otherwise. |
| DataModelSensor | `public DTS.SensorDB.SensorData { get; }` | The underlying sensor data. |
| SerialNumber | `public string { get; }` | Sensor serial number. |
| Description | `public string { get; }` | Sensor comment. |
| EngineeringUnits | `public string { get; }` | Display unit. |
| SensorRanges | `public string { get; }` | Formatted as `"{RangeLow}/{RangeMedium}/{RangeHigh}/{Capacity}"`. |
| AssignButtonVisibility | `public Visibility { get; set; }` | Visibility for the assign button. |
**Event Handlers:**
- `HardwareChannelList_SelectionChanged` — Manages channel selection state and sensor list synchronization.
- `btnSensorAssign_Click` — Assigns selected sensor to selected channel.
- `HardwareUnassign_Click` — Unassigns sensor from a channel.
---
### SquibResistanceCheck
**Namespace:** `DataPROWin7.SubControls`
Implements `IPageContent` for performing squib resistance checks. Handles configuration, execution, bypass, and reporting.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public SquibResistanceCheck(DataPROPage page)` | Initializes with page reference, creates `SquibResistanceTable`. |
| AggregateStatusColor | `public override Color { get; set; }` | Sets both base and `ctrlStatusRibbon.AggregateStatusColor`. |
| AggregateStatusText | `public override string { get; set; }` | Sets both base and `ctrlStatusRibbon` status text. |
| StartSearch | `public void StartSearch(string term)` | Empty implementation. |
| OnSetActive | `public void OnSetActive()` | Empty implementation. |
| SetPermissions | `public void SetPermissions(User.UserPermissionLevels actualPermission, User.UserPermissionLevels requiredPermission)` | Empty implementation. |
| Validate | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` always. |
| GetPageContent | `public object GetPageContent()` | Resets state and returns `this`. |
| UnSet | `public override void UnSet(Action OnComplete = null)` | Calls base, resets `RunNow` and `_bFactoryChanged`. |
| RunCurStep | `public override void RunCurStep()` | Sets `RunNow = true` and calls `Reset()`. |
| Reset | `public void Reset()` | Prepares UI, checks for running operations, queues `WorkFunc` on thread pool. |
| Bypass | `public void Bypass(BypassCompleteDelegate bypassComplete)` | Cancels operation, sets status to `Cancelled`, turns excitation back on, invokes callback. |
| SetStatus | `public override void SetStatus(ApplicationStatusTypes status)` | Updates UI based on status (`IDLE`, `Cancelled`, `SettingConfiguration`, `Passed`, `FailedArmCheckListSetConfig`, `Failed`, `Validating`). |
| DummyArm | `protected override bool DummyArm` | Returns `true` if `CurrentTest.CheckoutMode` is set. |
**Delegate:**
- `public delegate void BypassCompleteDelegate()` — Callback for bypass completion.
**Key Private Fields:**
- `_cancelEvent`, `_doneEvent`, `_cancelConfigEvent``ManualResetEvent` for thread synchronization.
- `_squibTable` — Instance of `SquibResistanceTable`.
- `_armcheckDASErrors``List<string>` holding per-DAS exceptions.
- `_bFactoryChanged` — Flag indicating factory configuration changed during operation.
**Private Methods:**
- `PrepareForResistanceCheck()` — Sets up `ArmCheckActions`, populates squib table.
- `WorkFunc(object o)` — Main background worker; handles configuration, arm switch check, squib resistance measurement via `DiagnosticsService.PerformArmCheck`, and `ArmingService.CheckAlreadyLevelTriggered`.
- `DoneHandler(bool exception)` — Handles configuration completion.
- `DoDoneCalculations()` — Updates squib table, generates report, sets pass/fail status.
- `TurnExcitationBackOnIfNeeded` — Referenced but implementation not visible in source.
---
## 3. Invariants
1. **PostTestDiagnostics Low-Power Transition**: `UnSet` always attempts to transition to low-power mode via `GoToLowPower`, using the busy name `"PostTestDiagLowPower"`.
2. **ListViewTemplateSelector Mode Calculation**: `Mode` is set to `SmallList` whenever `NumberOfItems > maxUnits` (where `maxUnits = floor(Height/LargeItemHeight) * floor(Width/LargeItemWidth)`). Otherwise, `LargeList` is used.
3. **SensorLayout Sensor Filtering**: The `Sensors` property only returns sensors that are **not already assigned** to any channel in the `TestObject.Hardware` collection.
4. **SquibResistanceCheck Thread Safety**: `_doneEvent` must be set before `WorkFunc` exits (guaranteed in `finally` block). `_cancelEvent` must be checked periodically for cancellation requests.
5. **TestIDPreFixSuffixHelper Equality**: Two helpers are equal if their `FixedValue` matches and is not `NOT_FIXED`, or if both are `NOT_FIXED` and their string representations match.
6. **SquibResistanceCheck Factory Change**: If `_bFactoryChanged` becomes `true` during execution, the operation throws `StringResources.FactoryHasChanged` and exits without reporting errors.
---
## 4. Dependencies
### This Module Depends On:
- `DTS.Common.Base``BasePropertyChanged`
- `DTS.Common.Interface.DASFactory``IDASCommunication`
- `DTS.DASLib.Service``ArmCheckActions`, `ConfigurationService`, `DiagnosticsService`, `ArmingService`, `ServiceBase`
- `DTS.Common.SharedResource.Strings``StringResources`
- `DTS.Common.Enums``ApplicationStatusTypes`
- `DTS.Common.Utilities.Logging``APILogger`
- `DTS.Slice.Users``User.UserPermissionLevels`
- `DTS.Common``BrushesAndColors`, `ServiceCall`, `ServiceQueue`
- `DTS.SensorDB``SensorData`, `SensorModelCollection`, `SensorsCollection`
- `DTS.Reports``ReportBase`
- `DataPROWin7.DataModel``DASHardware`, `HardwareChannel`, `TestObject`
- `DataPROWin7.Controls``StatusRibbon`, `HardwareDiscoveryControl`
### What Depends On This Module:
- **Unclear from source alone** — The module appears to be consumed by the main `DataPRO` application and `RunTestBase` page orchestration, but exact consumers are not visible in these files.
---
## 5. Gotchas
1. **PostTestDiagnostics G5 Exclusion**: The `RunsPostTestDiagnostics` method explicitly excludes G5 hardware from post-test diagnostics. This is hardcoded and may need extension for future hardware types (noted in comments referencing issue #10304).
2. **SensorLayout Module Logic Disabled**: `ModuleSerialNumber` and `ModuleNumberText` properties have their implementation commented out and always return empty strings. The `Sensors` getter also has commented-out module iteration logic that could cause `NullReferenceException` if uncommented (variable `modules` is initialized to `null` then iterated).
3. **SquibResistanceCheck DAS Retry Logic**: `WorkFunc` contains multiple retry loops waiting for DAS devices (`while (das.Count == 0 && count < maxTries)`). These loops can block for up to 60 seconds in one case.
4. **ListViewTemplateSelector Default ClientSize**: The default `ClientSize` of `(1000, 800)` may not reflect actual UI dimensions if not explicitly set, potentially causing incorrect mode selection.
5. **SquibResistanceCheck Bypass Does Not Wait**: The `Bypass` method calls `TurnExcitationBackOnIfNeeded` but does not wait for completion before invoking `_onBypassComplete`.
6. **GenericThreadData.DoneAction Limited Use**: The `DoneAction` property documentation states it is "only used currently by ResolveChannels.StartAutoResolution" — suggesting incomplete integration.
7. **TestIDPreFixSuffixHelper.GetHashCode**: Returns `base.GetHashCode()`, which does not incorporate the wrapped value. This violates the standard `GetHashCode`/`Equals` contract when `Equals` is overridden.

View File

@@ -0,0 +1,191 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/ArmCheckList/EventLinesTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ArmCheckList/ClockSyncTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ArmCheckList/TemperatureTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ArmCheckList/TiltSensorTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ArmCheckList/SensorIdTable.cs
generated_at: "2026-04-17T15:51:14.959477+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "91689825662ffeca"
---
# ArmCheckList Table Controls Documentation
## 1. Purpose
This module contains five specialized WPF DataGrid table controls used in the ArmCheckList subsystem for verifying and displaying Data Acquisition System (DAS) hardware status before data collection. Each table inherits from `Controls.GenericTable2` and provides real-time visual feedback on specific hardware checks: event line continuity, clock synchronization, temperature readings, tilt sensor orientation, and sensor identification. These tables are used during the "arm" phase of data collection to ensure all hardware is properly configured and functioning.
---
## 2. Public Interface
### EventLinesTable
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateDas` | `void UpdateDas(IDASCommunication das, bool ignoreShortedStartCompletion)` | Updates the row matching the given DAS with arm check results for `EventLineShorted` and `StartLineShorted`. Sets Trigger/Start columns and Status based on results. |
| `Clear` | `void Clear()` | Resets `_bIsPassed` to `true`, clears all rows from the internal DataTable, and calls `Update()`. |
| `IsPassed` | `bool IsPassed(ref List<string> errors)` | Returns the pass/fail state. If failed, adds `StringResources.ArmCheckList_EventLines` to the errors list. |
| `AddDas` | `void AddDas(IDASCommunication das, IDictionary<string, DataModel.DASHardware> lookup)` | Adds a new row for the DAS with columns: DAS (from lookup), Start (false), Trigger (false), Status (N/A), UserData (das reference). |
| `Update` | `void Update()` | Assigns the internal `_dt` to the `DataTable` property. |
**Constructor**: `EventLinesTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)`
**Private Enum**: `ColumnIds``DAS`, `Start`, `Trigger`, `Status`, `UserData`
---
### ClockSyncTable
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateDas` | `void UpdateDas(IDASCommunication das)` | Updates the row matching the given DAS with clock sync status using `Utils.IsClockSynced()`. Sets Status to Synced/NotSynced/NA. |
| `Clear` | `void Clear()` | Resets `_bPassed` to `true`, clears all rows, and calls `Update()`. |
| `IsPassed` | `bool IsPassed(ref List<string> errors)` | Returns pass/fail state. If failed, adds `StringResources.ArmCheckList_ClockSync` to errors. |
| `AddDas` | `void AddDas(IDASCommunication das, ClockSyncProfile profile, IDictionary<string, DataModel.DASHardware> lookup)` | Adds a new row with DAS identifier, ClockProfile (localized), Status (N/A), and UserData. Stores profile in `dasProfiles` dictionary. |
| `Update` | `void Update()` | Assigns internal `_dt` to `DataTable` property. |
**Constructor**: `ClockSyncTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)`
**Private Enum**: `ColumnIds``DAS`, `ClockProfile`, `Status`, `UserData`
**Public Enum**: `PassStatus``NA`, `Pass`, `Fail`
---
### TemperatureTable
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateDas` | `void UpdateDas(IDASCommunication das)` | Updates the row matching the DAS with temperature readings from `das.ArmCheckResults.TemperaturesPre[]`. Formats as comma-separated string with channel labels. |
| `Clear` | `void Clear()` | Resets `_bPassed` to `true`, clears all rows, and calls `Update()`. |
| `IsPassed` | `bool IsPassed(ref List<string> errors)` | Returns pass/fail state. If failed, adds `StringResources.ArmCheckList_Temperature` to errors. |
| `AddDas` | `void AddDas(IDASCommunication das, IDictionary<string, DataModel.DASHardware> lookup)` | Adds a new row with DAS identifier, Temperature (N/A), Status (N/A), and UserData. |
| `Update` | `void Update()` | Assigns internal `_dt` to `DataTable` property. |
**Constructor**: `TemperatureTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)`
**Private Enum**: `ColumnIds``DAS`, `Temperature`, `Status`, `UserData`
**Public Enum**: `PassStatus``NA`, `Pass`, `Fail`
**Private Field**: `_bitToString` — Dictionary mapping `DFConstantsAndEnums.TempLogChannelBits` to localized string resources for temperature channel names.
---
### TiltSensorTable
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateDas` | `void UpdateDas(IDASCommunication das)` | Updates rows with tilt sensor data from `TiltDegrees[]` or `IndexedTiltDegrees[]` for external tilts. Sets SystemID, SystemLocation, and X/Y/Z degree columns. |
| `Clear` | `void Clear()` | Resets `_bPassed` to `true`, clears all rows, and calls `Update()`. |
| `IsPassed` | `bool IsPassed(ref List<string> errors)` | Returns pass/fail state. If failed, adds `StringResources.ArmChecklist_TiltFailure` to errors (with duplicate check). |
| `AddDas` | `void AddDas(IDASCommunication das)` | Adds one or more rows depending on `das.DASInfo.ActiveExternalTilts`. Uses format `{SerialNumber}:{TiltID}:{TiltSerial}` for external tilts. |
| `Update` | `void Update()` | Assigns internal `_dt` to `DataTable` property. |
**Constructor**: `TiltSensorTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)`
**Private Enum**: `ColumnIds``DAS`, `SystemID`, `SystemLocation`, `SensorDegreesX`, `SensorDegreesY`, `SensorDegreesZ`, `Status`
**Public Enum**: `PassStatus``NA`, `Pass`, `Fail`
---
### SensorIdTable
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateDas` | `void UpdateDas(IDASCommunication das)` | Validates sensor IDs against expected values. Parses DAS serial and channel from `DASPlusChannelNumber` column. Sets Status to Success or `SensorIdNotOnChannel`. |
| `Clear` | `void Clear()` | Clears all rows, resets `_bpassed` to `true`, and calls `Update()`. |
| `IsPassed` | `bool IsPassed(ref List<string> errors)` | Returns pass/fail state. If failed, adds `StringResources.ArmCheckList_SensorId` to errors. |
| `Add` | `void Add(DataModel.TestTemplate testSetup)` | Populates the table from test template hardware/channels. Iterates `ChannelsForGroup`, creates rows with channel info, sensor EID, serial number, and description. |
| `Update` | `void Update()` | Assigns internal `_dt` to `DataTable` property. |
**Constructor**: `SensorIdTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)`
**Private Enum**: `ColumnIds``Group`, `Channel`, `SensorSerialNumber`, `SensorDescription`, `DASSerial`, `DASPlusChannelNumber`, `HardwareChannelNumber`, `SensorId`, `Status`
---
## 3. Invariants
### All Tables
- The `UserData` column always stores the `IDASCommunication` reference for row-to-DAS correlation.
- `IsPassed()` always returns the current state of the internal `_bPassed`/`_bIsPassed` flag.
- `Clear()` always resets the pass flag to `true` before clearing rows.
- All columns are read-only (`IsReadOnly = true`) with `OneWay` binding mode.
- Selection mode is always `C1.WPF.DataGrid.DataGridSelectionMode.None`.
### EventLinesTable
- Row matching uses OR logic: `UserData.Equals(das)` OR `DAS column equals das.SerialNumber`.
- The `break` statement ensures only the first matching row is updated.
### ClockSyncTable
- `dasProfiles` dictionary must contain an entry for any DAS added via `AddDas()` before `UpdateDas()` is called.
- If `EnableClockSourceSelect` is `false`, clock sync failures are ignored (per bug fix comment referencing issue 15340).
### TemperatureTable
- Temperature values that are `float.NaN` are skipped in the output string.
- Temperature string format: `{Label}: {Value:F1}` (1 decimal place).
### TiltSensorTable
- External tilt DAS names follow format: `{SerialNumber}:{TiltID}:{TiltSerial}`.
- `SetRowStatus()` method is defined but has an empty body (appears unused).
### SensorIdTable
- `DASPlusChannelNumber` format: `{Hardware} {ChannelNumber:000}` (last 3 characters are the channel number).
- Serial number extraction handles colon-separated format (takes second token if present).
- `Add()` method skips channels where `IsBlank()`, `IsDisabled`, or `!SensorValid` or `!HardwareValid`.
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Purpose |
|-----------|---------|
| `DTS.Common.Interface.DASFactory` | `IDASCommunication` interface |
| `DTS.DASLib.Service` | DAS service types |
| `DTS.Common.SharedResource.Strings` | Localized string resources (`StringResources`) |
| `DTS.Common` | `BrushesAndColors` utility class |
| `DTS.Common.Utilities.Logging` | `APILogger` for exception logging |
| `DTS.Common.Enums.DASFactory` | `DFConstantsAndEnums.TempLogChannelBits` |
| `DTS.Common.Utils` | `Utils.IsClockSynced()` method |
| `DTS.Common.Strings.Strings` | `ResourceManager.GetString()` for enum descriptions |
| `C1.WPF.DataGrid` | Third-party ComponentOne DataGrid controls |
| `System.Data` | `DataTable`, `DataRow`, `DataColumn`, `DataRowView` |
| `System.Windows.Media` | `SolidColorBrush` |
### Base Class
- All tables inherit from `Controls.GenericTable2` (not provided in source).
### Consumers
- The tables are in namespace `DataPROWin7.SubControls` and are constructed with a `DataPROPage` parameter, suggesting they are embedded in a page-based UI framework.
---
## 5. Gotchas
### EventLinesTable
- **Dual matching logic**: Row matching checks both `UserData` object equality AND `DAS` column string equality against `das.SerialNumber`. The comment notes serial numbers may be "decorated," hence the dual check.
- **`ignoreShortedStartCompletion` parameter**: When `true`, a shorted start line does NOT set `bFailed = true`, but still sets the Start column to `true`.
### ClockSyncTable
- **Silent failure handling**: `UpdateDas()` catches all exceptions and logs them via `APILogger.Log(ex)`, then continues. The table state may be inconsistent after an exception.
- **Conditional failure logic**: Clock sync failure only sets `_bPassed = false` if `Common.SerializedSettings.EnableClockSourceSelect` is `true` (see comment for issue 15340).
### TemperatureTable
- **Silent failure handling**: Same exception catching pattern as ClockSyncTable.
### TiltSensorTable
- **Silent failure handling**: Same exception catching pattern.
- **Unused method**: `SetRowStatus(string serialNumber, PassStatus status)` has an empty body and appears to be dead code.
- **Multiple rows per DAS**: A single DAS with multiple external tilts will generate multiple rows, and `UpdateDas()` uses a counter (`externalTiltFound`) to determine when to break from the loop.
### SensorIdTable
- **String parsing fragility**: `UpdateDas()` extracts the serial number by taking `snAndCh.Length - 4` substring and then splitting on `:`. This assumes a specific format and could fail with unexpected input.
- **Channel number parsing**: Uses `int.TryParse` without checking the result; `index` remains `-1` on parse failure, which would cause `SensorIds.ContainsKey(-1)` to return false.
- **No `UpdateDas` row matching break**: Unlike other tables, this one iterates ALL rows without a `break` statement, potentially updating multiple rows for the same DAS.
- **Different `Add` signature**: `SensorIdTable.Add()` takes a `DataModel.TestTemplate` instead of `IDASCommunication`, making its population pattern different from other tables.

View File

@@ -0,0 +1,31 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/ArmSystem/ArmSystemDAS.cs
generated_at: "2026-04-17T16:29:20.555074+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8d050d024c1f4ce6"
---
# ArmSystem
### Purpose
This module provides a data model for representing Data Acquisition System (DAS) state during the arming process for test execution. It tracks DAS identification, operational status, trigger state, and various hardware health indicators. The class serves as a bridge between the DAS hardware interfaces and UI presentation logic for the arm system workflow.
### Public Interface
**`ArmSystemDAS`** (class, inherits `BasePropertyChanged`)
**Properties (all raise PropertyChanged via `SetProperty`):**
- `string BatteryVoltageStatus` - Gets/sets battery voltage status indicator.
- `string colFaults` - Gets/sets collection faults status. Note: property name uses camelCase, violating C# naming conventions.
- `string DAS` - Gets/sets the DAS identifier/display name.
- `string TestSampleRate` - Gets/sets the test sample rate value.
- `string SerialNumber` - Gets/sets the DAS serial number.
- `string InputVoltageStatus` - Gets/sets input voltage status indicator.
- `string Status` - Gets/sets the operational status string.
- `string StreamingAddress` - Gets/sets the UDP streaming address; defaults to `"---"`.
- `string TestObject` - Gets/sets the test object/group display name.
- `string TimeLeftInArm` - Gets/sets the time remaining in arm state.
- `string EventNumber` - Gets/sets the current event number.
- `

View File

@@ -0,0 +1,50 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/CheckHardware/Hardware.cs
generated_at: "2026-04-17T16:46:06.291230+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "55234ec313a9f25f"
---
# Documentation: Hardware.cs
## 1. Purpose
The `Hardware` class serves as a presentation-layer wrapper for `DASHardware` domain objects, providing property bindings and hierarchical structure for UI display (evidenced by inheritance from `BasePropertyChanged`). It exists to flatten and organize hardware relationships for a tree-view display, handling the complexity of different hardware topologies—specifically SLICE6 devices (unique IPs) versus ECM/SPS devices (shared IPs requiring serial number resolution first). This class is part of the "Check Hardware" workflow within the data collection subsystem.
---
## 2. Public Interface
### Class: `Hardware`
**Inherits from:** `BasePropertyChanged`
#### Constructor
```csharp
public Hardware(
DASHardware hardware,
Dictionary<string, DASHardware> serialNumberToHardware,
Dictionary<string, HardwareDiscoveryControl.DASHelper> connectionToDasHelper,
IDictionary<string, DASHardware> allHardwareLookup)
```
Constructs a `Hardware` wrapper instance. Resolves the appropriate `DASHelper` by checking the `connectionToDasHelper` dictionary first by serial number, then by `ConnectionUSBAware2`. If `ShowCompactHardware` setting is enabled, recursively builds `ChildrenHardware` for pseudo-rack devices using linked DAS serials.
#### Properties
| Property | Type | Description |
|----------|------|-------------|
| `SerialNumber` | `string` | Returns `_hardware.SerialNumber`. Read-only. |
| `Connection` | `string` | Returns `_hardware.Connection`. Read-only. |
| `Channels` | `string` | Returns the result of `DASHardware.GetChannelsString(_hardware)`. Read-only. |
| `ChildrenHardware` | `Hardware[]` | Array of child hardware instances. Set once during construction; read-only. |
| `DASHelper` | `HardwareDiscoveryControl.DASHelper` | Resolved DAS helper instance, or null if not found in lookup dictionaries. Read-only. |
---
## 3. Invariants
- **Null safety on `_hardware`**: The `_hardware` field is assigned unconditionally in the constructor; however, no null check is performed on the incoming `hardware` parameter. Caller must ensure non-null.
- **DASHelper resolution order**: Resolution attempts serial number key first, then `ConnectionUSBAware2` key. If neither key exists in `connectionToDasHelper`, `DASHelper` remains null.
- **Children population condition**: `ChildrenHardware` is only populated when `Properties.Settings.Default.ShowCompactHardware` is `true` AND the hardware has `LinkedDASSerials` (either pre-existing or derived via `DASHardware.GetChildrenDAS` for pseudo-racks).
- **Recursive construction**: Child `Hardware

View File

@@ -0,0 +1,296 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/CanDiagnosticResult.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/DigitalInputDiagnosticResult.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/TCDiagnosticResult.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/DiagnosticResult.cs
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/DigitalInputDiagnostics.cs
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/DiagnosticChannel.cs
- DataPRO/DataPRO/CollectDataSubControls/Diagnostics/TestObjectHelper.cs
generated_at: "2026-04-17T15:49:20.224282+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "3bf531d8609c88c8"
---
# Diagnostics Module Documentation
## 1. Purpose
This module provides UI support classes and data models for displaying diagnostic results in the DataPRO application. It encompasses views for CAN, digital input, and thermocouple diagnostics, along with helper classes that manage diagnostic state, threshold comparisons, and hardware channel visualization. The module bridges the gap between low-level hardware diagnostic data and WPF UI presentation, handling status aggregation across multiple hardware devices and channels.
---
## 2. Public Interface
### `CanDiagnosticResult` (UserControl)
**Namespace:** `DataPROWin7.CollectDataSubControls`
**File:** `CanDiagnosticResult.xaml.cs`
```csharp
public CanDiagnosticResult()
```
Default constructor that calls `InitializeComponent()`. No additional public members exposed in code-behind.
---
### `DigitalInputDiagnosticResult` (UserControl)
**Namespace:** `DataPROWin7.CollectDataSubControls`
**File:** `DigitalInputDiagnosticResult.xaml.cs`
```csharp
public DigitalInputDiagnosticResult()
```
Default constructor that calls `InitializeComponent()`. No additional public members exposed in code-behind.
---
### `TCDiagnosticResult` (UserControl)
**Namespace:** `DataPROWin7.CollectDataSubControls`
**File:** `TCDiagnosticResult.xaml.cs`
Implements `INotifyPropertyChanged`.
```csharp
public event PropertyChangedEventHandler PropertyChanged;
protected void SetField<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
```
Sets a field value and raises `PropertyChanged` if the value differs. Uses `EqualityComparer<T>.Default.Equals` for comparison.
```csharp
public TCDiagnosticResult()
```
Default constructor that calls `InitializeComponent()`.
---
### `DiagnosticResult` (Class)
**Namespace:** `DataPROWin7.CollectDataSubControls.Diagnostics`
**File:** `DiagnosticResult.cs`
Inherits from `BasePropertyChanged`.
**Read-Only Properties:**
- `string Name` — The name of the diagnostic result.
- `string LowTitle` — Title for the low threshold column.
- `string SubLine1LowTitle` — Title for the subline low threshold.
- `string ActualTitle` — Title for the actual value column.
- `string HighTitle` — Title for the high threshold column.
- `string SubLine1HighTitle` — Title for the subline high threshold.
- `string LowThresholdText` — Formatted low threshold value text.
- `string SubLine1LowThresholdText` — Formatted subline low threshold text.
- `string ActualValueText` — Formatted actual measured value text.
- `string SubLine1ActualValueText` — Formatted subline actual value text.
- `bool HasSubLine1` — Indicates whether subline data is present (default `false`).
- `string HighThresholdText` — Formatted high threshold value text.
- `string SubLine1HighThresholdText` — Formatted subline high threshold text.
**Read/Write Properties:**
```csharp
public DiagnosticStatus Status { get; set; }
public Color BackgroundColor { get; set; }
```
**Constructor:**
```csharp
public DiagnosticResult(
string name,
DiagnosticStatus status,
string lowTitle,
string actualTitle,
string highTitle,
double lowThresholdValue,
double highThresholdValue,
double actualValue,
int decimalPlaces,
string subLine1LowTitle = null,
string subLine1ActualTitle = null,
string subLine1HighTitle = null,
double subLine1LowThresholdValue = double.NaN,
double subLine1HighThresholdValue = double.NaN,
double subLine1ActualValue = double.NaN,
int subLineDecimalPlaces = 2,
string actualValueDecimalFormat = null
)
```
Constructs a diagnostic result with main line and optional subline threshold data. `HasSubLine1` is set to `true` if `subLine1ActualTitle` is not null or whitespace. Values of `double.NaN` result in empty string text representations.
---
### `DigitalInputDiagnostics` (Class)
**Namespace:** `DataPROWin7.CollectDataSubControls.Diagnostics`
**File:** `DigitalInputDiagnostics.cs`
Inherits from `BasePropertyChanged`.
**Nested Enums:**
```csharp
public enum Tags { ExpectedInitialState, ChannelMode, Status, InitialState, ChannelName, HardwareChannelName, SensorName }
public enum InputModeState { Open, Closed, Low, High }
```
**Read-Only Properties:**
- `string ChannelName` — Logical channel name or `StringResources.Table_NA`.
- `string HardwareChannelName` — Physical hardware channel string.
- `string SensorName` — Sensor/digital input setting name.
- `string ChannelMode` — Translated string for digital input mode (`CCNC`, `CCNO`, `THL`, `TLH`).
- `string Status` — Current diagnostic status string (`"Untested"` if no channel).
- `string InitialState` — Current state of digital input as determined by diagnostics.
- `string ExpectedInitialState` — Expected initial (default) state.
**Methods:**
```csharp
public void SetChannel(DiagnosticChannel channel)
```
Sets the internal `_channel` field and raises `PropertyChanged` for all `Tags` enum values.
---
### `DiagnosticChannel` (Class)
**Namespace:** `DataPROWin7.CollectDataSubControls.Diagnostics`
**File:** `DiagnosticChannel.cs`
Inherits from `BasePropertyChanged`.
**Nested Enum:**
```csharp
public enum Tags { BackgroundColor, Status, DiagnosticsInProgress, Selected, ForegroundColor }
```
**Read-Only Properties:**
- `HardwareChannel HardwareChannel` — The associated hardware channel.
- `Color BackgroundColor` — Background color based on selection and diagnostic status.
- `Color ForegroundColor``Color_ActionForeground` if selected, else `Color_ItemForeground`.
- `string SerialNumber` — Displayable name (sensor name, "Digital setting", "Squib setting", or "CAN").
- `string SerialNumberWithAxis` — Sensor name with axis.
- `string ChannelName` — Channel name respecting ISO view mode.
- `string Status` — Localized status string.
- `string ChannelNumberText` — Channel string with optional calibration enforcement suffix.
- `CalibrationEnforcement CalibrationEnforcement` — Calibration enforcement setting.
- `CalibrationBehaviors CalibrationBehavior` — Calibration behavior setting.
**Read/Write Properties:**
```csharp
public bool DiagnosticsInProgress { get; set; }
public bool Selected { get; set; }
```
**Constructor:**
```csharp
public DiagnosticChannel(
HardwareChannel channel,
CalibrationEnforcement enforcement = CalibrationEnforcement.None,
CalibrationBehaviors behavior = CalibrationBehaviors.NonLinearIfAvailable
)
```
Initializes the channel, subscribes to `HardwareChannel.PropertyChanged`, and watches for `DiagnosticStatus` changes.
---
### `TestObjectHelper` (Class)
**Namespace:** `DataPROWin7.CollectDataSubControls.Diagnostics`
**File:** `TestObjectHelper.cs`
Inherits from `BasePropertyChanged`.
**Read-Only Properties:**
- `bool ContainsTOM` — Indicates if any hardware contains a TOM (Test Object Module).
- `IGroup Group` — The associated group.
- `string DisplaySerialNumber` — Group display name.
- `string Description` — Group description.
- `Color BackgroundColor` — Background color based on selection and status.
- `Color ForegroundColor` — Foreground color based on selection.
- `bool AllHaveRunDiagnostics(bool postTestDiagnostics)` — Returns true if all expected channels have diagnostic results.
- `ApplicationStatusTypes Status` — Aggregated status (get/set).
- `string DiagnosticStatusText` — Localized status text.
- `ApplicationStatusTypes DiagnosticStatus` — Computed diagnostic status.
- `HardwareHelper[] TestObjectHardwareHelpers` — Array of hardware helpers.
**Read/Write Properties:**
```csharp
public bool Selected { get; set; }
public bool HaveRunDiagnostics { get; set; }
```
**Constructor:**
```csharp
public TestObjectHelper(
bool bWarnOnFailedBattery,
IGroup group,
DiagnosticsBase.DiagnosticsType type,
TestTemplate test
)
```
Builds hardware helpers for the group, handles ECM-to-USB connection transitions, and populates `TestObjectHardwareHelpers`.
**Methods:**
```csharp
public void ClearDiagnostics()
```
Clears diagnostics on all hardware and resets `HaveRunDiagnostics` to `false`.
```csharp
private bool DoesHardwareContainTOM(DASHardware h)
```
Returns true for `TOM`, `SLICE2_TOM`, `SLICE2_SLT` hardware types, or `TDAS_LabRack`/`TDAS_Pro_Rack` with squib channels.
```csharp
private bool ExpectDiagnosticResults(HardwareChannel ch, bool postTestDiagnostics)
```
Determines if diagnostics should be expected for a channel.
---
## 3. Invariants
1. **DiagnosticResult.HasSubLine1**: Always `true` when `subLine1ActualTitle` is non-null/non-whitespace in the constructor; otherwise `false`.
2. **DiagnosticResult threshold text**: Values of `double.NaN` always produce empty string text representations.
3. **DiagnosticResult.BackgroundColor**: Automatically updated when `Status` changes via the property setter, mapping `DiagnosticStatus.Passed``Brush_ApplicationStatus_Complete`, `DiagnosticStatus.Failed``Brush_ApplicationStatus_Failed`, and default → `Color_ItemBackground`.
4. **DiagnosticChannel.Selected**: Changing this value triggers `PropertyChanged` for both `BackgroundColor` and `ForegroundColor`.
5. **DigitalInputDiagnostics.InitialState**: Returns `StringResources.Table_NA` for `HardwareTypes.G5VDS`, `HardwareTypes.TDAS_Pro_Rack`, and `HardwareTypes.TDAS_LabRack` (per comments referencing bugs 9912 and 10342).
6. **TestObjectHelper.DiagnosticStatus**: Returns `ApplicationStatusTypes.IDLE` if `HaveRunDiagnostics` is `false`. Channel failures supersede DAS failures.
7. **TestObjectHelper post-test squib handling**: Squib channels are not expected to have diagnostic results during post-test diagnostics (per comment referencing 29948).
---
## 4. Dependencies
### External Dependencies (Imports):
| Module | Dependencies |
|--------|--------------|
| `DiagnosticResult` | `System.Windows.Media`, `DTS.Common`, `DataPROWin7.DataModel`, `DTS.Common.Base`, `DTS.Common.Interface.Sensors.AnalogDiagnostics` |
| `DigitalInputDiagnostics` | `DTS.Common.Base`, `DTS.Common.Enums`, `DTS.Common.Enums.Hardware`, `DTS.Common.Interface.Sensors.AnalogDiagnostics`, `DTS.Common.SharedResource.Strings` |
| `DiagnosticChannel` | `System.ComponentModel`, `System.Windows.Media`, `DataPROWin7.Common`, `DataPROWin7.DataModel`, `DTS.Common.SharedResource.Strings`, `DTS.Common.Base`, `DTS.Common.Enums.Sensors`, `DTS.Common`, `DTS.Common.Interface.Sensors.AnalogDiagnostics` |
| `TestObjectHelper` | `System`, `System.Collections.Generic`, `System.Linq`, `System.Windows.Media`, `System.Windows`, `DataPROWin7.Common`, `DataPROWin7.DataModel`, `DataPROWin7.SubControls`, `DTS.Common.Base`, `DTS.Common.Enums.Sensors`, `DTS.Common.Interface.Channels`, `DTS.Common.Interface.Groups.GroupList`, `DTS.Common`, `DTS.Common.Enums`, `DTS.Common.Classes.Sensors.AnalogDiagnostics` |
### Key External Types Referenced:
- `BasePropertyChanged` — Base class providing `INotifyPropertyChanged` implementation
- `HardwareChannel` — Hardware channel data model
- `DiagnosticStatus` — Enum with values `Untested`, `Passed`, `Failed`
- `BrushesAndColors` — Static color/brush provider
- `StringResources` — Localized string resources
- `DASHardware` — DAS hardware representation
- `IGroup`, `IGroupChannel` — Group interfaces
- `TestTemplate` — Test configuration template
- `HardwareHelper` — Hardware diagnostic helper (not included in source)
### Consumers:
The XAML code-behind files (`CanDiagnosticResult`, `DigitalInputDiagnosticResult`, `TCDiagnosticResult`) are presumably bound to their respective XAML views, which are not included in the source.
---
## 5. Gotchas
1. **DiagnosticChannel.DiagnosticsInProgress**: The source comment states "I don't see this set anywhere, not sure if it's actually used, however it is retrieved at least once below so I'm leaving it here." This property may be vestigial.
2. **DigitalInputDiagnostics hardware-specific behavior**: `InitialState` and `ExpectedInitialState` return `StringResources.Table_NA` for `G5VDS`, `TDAS_Pro_Rack`, and `TDAS_LabRack` hardware types. Comments reference bug fixes 9912 and 10342, indicating historical issues with TDAS DIM channels.
3. **TestObjectHelper ECM/USB connection handling**: The constructor contains special

View File

@@ -0,0 +1,39 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/Download/ThreadData.cs
- DataPRO/DataPRO/CollectDataSubControls/Download/DownloadInfo.cs
- DataPRO/DataPRO/CollectDataSubControls/Download/EventData.cs
- DataPRO/DataPRO/CollectDataSubControls/Download/TestObject.cs
- DataPRO/DataPRO/CollectDataSubControls/Download/PhysicalHardware.cs
generated_at: "2026-04-17T15:52:41.202092+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "196b18af0582d16a"
---
# Documentation: DataPRO.Download Module
## 1. Purpose
This module provides data structures and view models for managing download operations within the DataPRO data collection system. It serves as the bridge between download orchestration logic and the UI, tracking download progress and status for both logical test groupings (`TestObject`) and physical hardware devices (`PhysicalHardware`). The module handles synchronization primitives for threaded operations, maintains state for multi-device downloads (including rack/distributor configurations), and exposes bindable properties for visual feedback during download operations.
---
## 2. Public Interface
### `DownloadThreadData` (internal class)
Simple data container for thread synchronization events.
| Member | Signature | Description |
|--------|-----------|-------------|
| `OverwriteDataEvent` | `ManualResetEvent { get; set; }` | Synchronization event for overwrite operations. |
| `PartialDownloadEvent` | `ManualResetEvent { get; set; }` | Synchronization event for partial download operations. |
---
### `DownloadInfo` (public class)
Data transfer object containing download target information.
| Member | Signature | Description |
|--------|-----------|-------------|
| `DasList` | `List<IDASCommunication> { get; set; }`

View File

@@ -0,0 +1,92 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/Realtime/PairedTargetData.cs
- DataPRO/DataPRO/CollectDataSubControls/Realtime/GraphPlotInfo.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/Realtime/RealtimeDASHelper.cs
- DataPRO/DataPRO/CollectDataSubControls/Realtime/MeterMode.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/Realtime/MeterGraph.xaml.cs
- DataPRO/DataPRO/CollectDataSubControls/Realtime/RealtimePlot.cs
generated_at: "2026-04-17T15:51:50.848883+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6be5ac43111cbd32"
---
# Documentation: DataPRO Realtime Data Collection Components
## 1. Purpose
This module provides UI components and helper classes for realtime data acquisition and display in the DataPRO application. It handles the pairing of sample data with DAS (Data Acquisition System) communication targets, manages channel selection and visualization for realtime plotting, and supports meter-mode displays for both single and multi-channel configurations. The module abstracts hardware-specific behaviors (particularly for TDAS vs. non-TDAS systems) and implements MVVM patterns for WPF data binding.
---
## 2. Public Interface
### PairedTargetData (internal class)
**Namespace:** `DataPROWin7.SubControls`
```csharp
public SampleData[] Data;
public IDASCommunication Target;
public PairedTargetData(SampleData[] newData, IDASCommunication newTarget)
public void CheapDispose()
```
- **Constructor:** Creates a pairing of sample data array with a DAS communication target.
- **CheapDispose():** Nulls both `Data` and `Target` fields to release memory without implementing `IDisposable`. Intended for cleanup when objects remain in concurrent queue lists.
---
### GraphPlotInfo (public partial class)
**Namespace:** `DataPROWin7.CollectDataSubControls`
**Base:** `UserControl`, `INotifyPropertyChanged`
```csharp
public event PropertyChangedEventHandler PropertyChanged;
public bool SetProperty<T>(ref T storage, T value, String propertyName = null)
public void OnPropertyChanged(string propertyName = null)
public void FixSelectedValueText(Controls.RealtimeChart.RealtimeChannel channel)
public RealtimePlot MyRealtimePlot { get; }
```
- **SetProperty\<T>():** Standard MVVM helper; returns `false` if value unchanged, otherwise updates storage and raises `PropertyChanged`.
- **OnPropertyChanged():** Raises the `PropertyChanged` event.
- **FixSelectedValueText():** Sets `ddlSelectedChannel.Text` to the string representation of the provided channel.
- **MyRealtimePlot:** Read-only property returning a new `RealtimePlot` instance.
---
### RealtimeDASHelper (internal class)
**Namespace:** `DataPROWin7.CollectDataSubControls.Realtime`
```csharp
public RealtimeChart.RealtimeChannel Channel { get; set; }
public RealtimeDASHelper(RealtimeChart.RealtimeChannel channel)
public static string[] GetKeys(RealtimeChart.RealtimeChannelAggregate chart)
```
- **Constructor:** Stores the provided channel in the `Channel` property.
- **GetKeys():** Static method that generates unique keys for DAS hardware based on type:
- For `HardwareTypes.TDAS_Pro_Rack` and `HardwareTypes.TDAS_LabRack`: returns `"DASSerialNumber_ModuleArrayIndex"` format.
- For all other hardware types: returns `SerialNumber` only.
- Iterates through all `RealtimeChannels` and their nested `Channels` collection.
---
### MeterMode (public partial class)
**Namespace:** `DataPROWin7.CollectDataSubControls`
**Base:** `UserControl`, `INotifyPropertyChanged`
```csharp
public event PropertyChangedEventHandler PropertyChanged;
protected bool SetProperty<T>(ref T storage, T value, String propertyName = null)
protected void OnPropertyChanged(string propertyName = null)
public string MainChannelName { get; }
public void SetRealtimeChannel(Controls.RealtimeChart.RealtimeChannel channel)
public void SetMain

View File

@@ -0,0 +1,200 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/ResolveChannels/SensorOutOfPosition.cs
- DataPRO/DataPRO/CollectDataSubControls/ResolveChannels/ExtraEIDsTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ResolveChannels/SensorsOutofPositionTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ResolveChannels/ResolvedChannelsTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ResolveChannels/ChannelsToResolveTable.cs
- DataPRO/DataPRO/CollectDataSubControls/ResolveChannels/HardwareChannelsTable.cs
generated_at: "2026-04-17T15:51:35.191627+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f8e62f0bf1c2f884"
---
# Resolve Channels Tables Module Documentation
## 1. Purpose
This module provides a set of WPF data grid table controls for the "Resolve Channels" feature in DataPRO, which manages the mapping between logical channels (defined in test setup) and physical hardware channels. The module handles displaying unresolved channels requiring manual intervention, resolved channel mappings, sensors detected on unexpected hardware positions, extra EIDs not in the test setup, and the complete hardware channel inventory. All tables support drag-and-drop operations for channel assignment and integrate with ComponentOne's WPF DataGrid for filtering and sorting capabilities.
---
## 2. Public Interface
### SensorOutOfPosition
A read-only data transfer object for the `SensorsOutOfPositionTable`.
**Constructor:**
```csharp
public SensorOutOfPosition(string currentChannel, string originalChannel, string sensorId, string sensor)
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `CurrentChannel` | `string` | The hardware channel where the sensor was found |
| `OriginalChannel` | `string` | The channel the sensor was originally assigned to |
| `SensorId` | `string` | The sensor's EID |
| `Sensor` | `string` | Sensor description |
---
### ExtraEIDsTable
Displays channels with EIDs not included in the test setup. Located in the lower-left of the ResolveChannels control.
**Constructor:**
```csharp
public ExtraEIDsTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page, ResolveChannels resolveChannels)
```
**Methods:**
| Method | Description |
|--------|-------------|
| `void UnSet()` | Clears the table by setting `ItemsSource = null` |
| `void UpdateTable(TableHelper[] items)` | Populates the table with data |
**Nested Types:**
- `TableHelper` - Data class with properties: `ChannelName`, `EID`, `SensorName`
- `ColumnIds` enum: `ChannelName`, `EID`, `SensorName`
---
### SensorsOutOfPositionTable
Displays sensors found on different hardware channels than originally assigned. Located in the lower-left of the ResolveChannels control.
**Constructor:**
```csharp
public SensorsOutOfPositionTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page, SubControls.ResolveChannels resolveChannels)
```
**Methods:**
| Method | Description |
|--------|-------------|
| `void UnSet()` | Clears the table |
| `void UpdateTable(SensorOutOfPosition[] items)` | Populates the table with out-of-position sensors |
**Enum:**
- `ColumnIds`: `CurrentChannel`, `OriginalChannel`, `SensorId`, `Sensor`
---
### ResolvedChannelsTable
Displays manually resolved channel mappings.
**Constructor:**
```csharp
public ResolvedChannelsTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)
```
**Methods:**
| Method | Description |
|--------|-------------|
| `void UnSet()` | Clears all rows from the internal DataTable |
| `void Update(ResolveChannels.ManuallyResolvedChannel[] channels)` | Populates the table with resolved channel data |
---
### ChannelsToResolveTable
Displays channels requiring manual resolution. Located in the top-left of the ResolveChannels control. Supports multi-row selection and drag-and-drop.
**Constructor:**
```csharp
public ChannelsToResolveTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page, ResolveChannels resolveChannels)
```
**Methods:**
| Method | Description |
|--------|-------------|
| `void UnSet()` | Clears all rows from the internal DataTable |
| `void Update(ResolveChannels.UnresolvedChannel[] channels)` | Populates the table with unresolved channels |
**Constants:**
```csharp
public const string DRAG_FORMAT = "UnresolvedChannel []";
```
---
### HardwareChannelsTable
Displays all hardware channels with filtering options (All/Assigned/Open/Manual). Located on the right side of the ResolveChannels control.
**Constructor:**
```csharp
public HardwareChannelsTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page, object owningControl)
```
**Methods:**
| Method | Description |
|--------|-------------|
| `void UnSet()` | Clears all rows from the internal DataTable |
| `void Update(TestTemplate test, Dictionary<string, ResolveChannels.UnresolvedChannel> resolvedChannels, List<ResolveChannels.ManuallyResolvedChannel> manuallyResolvedChannels, Dictionary<string, HardwareChannel> channelLookup)` | Updates table from test hardware |
| `void Update(DASHardware[] hardware, ...)` | Updates table from hardware array |
| `void ScrollIntoFocus(HardwareChannel channel)` | Scrolls to make the specified channel visible |
| `void btnRemoveCellTemplate_Click(object parameter)` | Handler for the remove/clear button in each row |
| `override void SetPermissions(DTS.Slice.Users.User.UserPermissionLevels actualPermission, DTS.Slice.Users.User.UserPermissionLevels requiredPermission)` | Sets permissions and toggles remove column visibility |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ViewMode` | `ResolveChannels.ChannelViews` | Filter mode: `ALL`, `Assigned`, `Open`, or `Manual` |
---
## 3. Invariants
- All table classes inherit from `Controls.GenericTable2`
- All tables use `AutoGenerateColumns = false` with manually defined columns
- Column headers are resolved via `StringResources.ResourceManager.GetString()` with fallback format `"N/A: {resourceKey}"`
- All data bindings use `BindingMode.OneWay`
- Channel lookup keys use format `"{DASId}_{ChannelNumber}"`
- `HardwareChannelsTable` and `ChannelsToResolveTable` use `System.Data.DataTable` as the backing store
- `ExtraEIDsTable` and `SensorsOutOfPositionTable` use direct `ItemsSource` assignment
- Selection modes: `ChannelsToResolveTable` and `HardwareChannelsTable` use `MultiRow`; others use `None`
---
## 4. Dependencies
### External Dependencies
- `C1.WPF.DataGrid` - ComponentOne WPF DataGrid controls (`DataGridTextColumn`, `DataGridBoundColumn`, `DataGridTemplateColumn`)
- `DTS.Common.Base` - `BasePropertyChanged` for property notification
- `DTS.Common.SharedResource.Strings` - `StringResources` for localized strings
- `DTS.Common.Enums.Hardware`, `DTS.Common.Enums.Sensors`, `DTS.Common.Enums.DASFactory` - Enumeration types
- `DTS.SensorDB.SensorsCollection.SensorsList` - Sensor database lookup via `GetSensorById()`
- `DTS.Common.Classes.Hardware.DragAndDropPayload` - Drag-and-drop format constant
### Internal Dependencies
- `Controls.GenericTable2` - Base class providing core table functionality
- `DataPROPage` - Page container with `PageCommand` support
- `ResolveChannels` - Parent control with `ManuallyResolveChannels()`, `ManuallyUnresolveChannel()`, `GetHWIDForSensorId()` methods
- `ResolveChannels.UnresolvedChannel` - Represents an unresolved channel with `Channel`, `Issue`, `MissingID`, `EIDOutOfPlace` properties
- `ResolveChannels.ManuallyResolvedChannel` - Represents a resolved mapping with `LogicalChannel`, `PhysicalChannel` properties
- `DataModel.HardwareChannel`, `DataModel.DASHardware`, `DataModel.TestTemplate` - Hardware data models
- `Controls.EditObjectSensorsControl` - Alternative owning control with `MagicallyUnresolveChannel()` method
- `ChannelRepresentation` - Helper for DAS channel display formatting
- `BrushesAndColors` - Brush definitions for row highlighting
---
## 5. Gotchas
1. **Namespace Inconsistency**: `SensorOutOfPosition` resides in `DataPROWin7.CollectDataSubControls.ResolveChannels` while `ExtraEIDsTable` and others are in `DataPROWin7.SubControls`. This may cause confusion when locating types.
2. **Unused Field**: `SensorsOutOfPositionTable._resolveChannels` is stored but never used (suppressed with ReSharper comment `// ReSharper disable once NotAccessedField.Local`).
3. **Squib Channel Skipping**: In `HardwareChannelsTable.Update()`, when a squib channel is encountered, the loop increments `i++` to skip the next channel because squibs occupy two hardware channels but display as one row.
4. **RTC Channels Excluded**: Channels with `BridgeType.RTC` (clock channels) are completely skipped in `HardwareChannelsTable` with no UI indication.
5. **High-G Channel Conditional Display**: TSR AIR High-G channels are hidden when the sample rate is ≤ `DFConstantsAndEnums.TSR_AIR_HIGH_G_CUTOFF_RATE_SPS` (500 SPS per comment).
6. **Module Column Zombie**: The `Module` column in `HardwareChannelsTable` is defined and populated but "no longer displayed" according to comments—data is still computed and stored.
7. **Drag Format String**: `ChannelsToResolveTable.DRAG_FORMAT` is `"UnresolvedChannel []"` (note the space before brackets). This exact string must be used when handling drag-drop from this table.
8. **ViewMode Filtering Performance**: `HardwareChannelsTable.Update()` builds complete row data for all channels before filtering by `ViewMode`, meaning computational work occurs even for rows that won't be displayed.
9. **Sensor ID Locking**: Channels with sensor EIDs matching their hardware position are "locked" (`CMD_ENABLED = false`), preventing drag operations. However, channels starting with `SensorConstants.TEST_SPECIFIC_DOUT` bypass this lock.
10. **TSR AIR Drag Logic**: Special handling exists for TSR AIR hardware where channels with sensors but `LogicalChannelName == StringResources.Table_NA` are still draggable (related to issue #18085).

View File

@@ -0,0 +1,45 @@
---
source_files:
- DataPRO/DataPRO/CollectDataSubControls/ReviewFile/Graph.cs
- DataPRO/DataPRO/CollectDataSubControls/ReviewFile/AbstractedFromReviewFile.cs
generated_at: "2026-04-17T15:57:02.075935+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "18f47728d1937509"
---
# Documentation: ReviewFile Graph Components
## 1. Purpose
This module provides data structures and utilities for managing graph visualization state within the DataPRO review file system. `Graph` represents an individual graph's display state and metadata (name, description, notes, visibility), while `AbstractedFromReviewFile` serves as a controller for managing graph collections, channel memory lifecycle, and ROI (Region of Interest) file regeneration from test data. Together, they support the review and rendering of test data graphs, including handling of wait states during graph rendering and cleanup of channel resources.
---
## 2. Public Interface
### Class: `Graph` (inherits `BasePropertyChanged`)
| Member | Signature | Description |
|--------|-----------|-------------|
| `Notes` | `string` (property) | Gets or sets notes associated with the graph. Defaults to empty string. |
| `Name` | `string` (property) | Gets or sets the graph name. |
| `Description` | `string` (property) | Gets or sets the graph description. |
| `ShowGraph` | `Visibility` (property) | Controls graph visibility. Setting triggers `OnPropertyChanged` for "ShowWait" and "ChartData". Defaults to `Visibility.Visible`. |
| `ShowWait` | `Visibility` (property, read-only) | Returns `Visibility.Collapsed` when `ShowGraph` is `Visible`; otherwise returns `Visibility.Visible`. |
| `WaitText` | `string` (property, read-only) | Generates a "Please wait, rendering graph {Name}" message with animated dots (0-3 dots based on `_statusCount`). |
| `IncrementStatusCount` | `void IncrementStatusCount()` | Increments internal counter; cycles from 0→1→2→3→0. Triggers `OnPropertyChanged("WaitText")`. |
| `ToString` | `override string ToString()` | Returns `_name`. |
### Class: `AbstractedFromReviewFile` (inherits `BasePropertyChanged`)
| Member | Signature | Description |
|--------|-----------|-------------|
| `orderedChannels` | `List<Test.Module.Channel>` (public field) | List of channels for display ordering. |
| `CurrentGraph` | `TestSetup.Graph` (property) | Gets or sets the current graph. Changing value triggers `ClearCurrentChannelsMemory()` if different. |
| `Graphs` | `ICollection<Graph>` (property, read-only) | Returns the internal `_graphs` collection. |
| `RangeDisplayMode` | `RangeDataViewOptions` (property) | Gets or sets the range display mode. Defaults to `RangeDataViewOptions.Auto`. |
| `CurrentFixedRangePercentageOfFullScale` | `double` (public field) | Default value: 100. |
| `CurrentFixedRangeValue` | `double` (public field) | Default value: 5000. |
| `UnSet` | `void UnSet()` | Clears current channels memory and clears the `_graphs` list. |
| `SingleChannelGraphNameFromChannel` | `static string SingleChannelGraphName

View File

@@ -0,0 +1,241 @@
---
source_files:
- DataPRO/DataPRO/Common/IPageGrid.cs
- DataPRO/DataPRO/Common/UsedInGroup.cs
- DataPRO/DataPRO/Common/UsedInTestSetup.cs
- DataPRO/DataPRO/Common/IFullScreenCapable.cs
- DataPRO/DataPRO/Common/UsedIn.cs
- DataPRO/DataPRO/Common/WindowWrapper.cs
- DataPRO/DataPRO/Common/UsageReport.cs
- DataPRO/DataPRO/Common/INavStepContent.cs
- DataPRO/DataPRO/Common/CommonStyles.xaml.cs
- DataPRO/DataPRO/Common/WaitCursor.cs
- DataPRO/DataPRO/Common/DeviceSelected.cs
- DataPRO/DataPRO/Common/TimeUnits.cs
- DataPRO/DataPRO/Common/Negative.cs
- DataPRO/DataPRO/Common/PageHelper.cs
- DataPRO/DataPRO/Common/SQLConversion.cs
- DataPRO/DataPRO/Common/BoolToVisibilityConverter.cs
- DataPRO/DataPRO/Common/InvertVisibilityConverter.cs
- DataPRO/DataPRO/Common/HardwareIPRanges.cs
- DataPRO/DataPRO/Common/Transition.cs
- DataPRO/DataPRO/Common/ToastWindow.xaml.cs
- DataPRO/DataPRO/Common/ModalDialog.xaml.cs
- DataPRO/DataPRO/Common/GroupedItemControl.cs
- DataPRO/DataPRO/Common/DataPROTabItem.cs
- DataPRO/DataPRO/Common/DbAccess.cs
generated_at: "2026-04-17T15:27:40.199737+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "101a4ee6e39bd69a"
---
# DataPROWin7.Common Module Documentation
## 1. Purpose
The `DataPROWin7.Common` namespace provides shared utilities, interfaces, value converters, UI controls, and data models used throughout the DataPRO application. It serves as a common infrastructure layer supporting navigation, modal dialogs, database access initialization, WPF value conversion, toast notifications, and various data transfer objects for usage reporting and group/test setup tracking.
---
## 2. Public Interface
### Interfaces
| Interface | Method Signature | Description |
|-----------|------------------|-------------|
| `IPageGrid` | `void OnSetActive()` | Called when a page grid becomes active. |
| `IFullScreenCapable` | `void GoFullScreen()` | Transitions the implementing view to full-screen mode. |
| `IFullScreenCapable` | `void GoSmallScreen()` | Transitions the implementing view back to normal/small screen mode. |
| `INavStepContent` | `void UnSet(Action OnComplete = null)` | Called when the current test setup changes; allows inheriting forms to clear UI fields. |
| `IModalDialogContent` | `void SetCancelEvent(ModalDialog.ButtonEvent ev)` | Sets the cancel button event handler for modal dialog content. |
| `IModalDialogContent` | `void SetOKEvent(ModalDialog.ButtonEvent ev)` | Sets the OK button event handler for modal dialog content. |
### Classes
#### `WindowWrapper`
```csharp
public WindowWrapper(IntPtr handle)
public IntPtr Handle { get; }
```
Wraps an `IntPtr` window handle, implementing `System.Windows.Forms.IWin32Window`.
#### `WaitCursor` (IDisposable)
```csharp
public WaitCursor()
public void Dispose()
```
Sets `Mouse.OverrideCursor` to `Cursors.Wait` on construction, restores previous cursor on disposal.
#### `TimeUnits` : `BasePropertyChanged`
```csharp
public enum Units { MilliSeconds, Seconds }
public Units MyUnits { get; set; }
public string ToShortString()
```
Returns `"ms"` for `MilliSeconds`, `"s"` for `Seconds`. Throws `NotSupportedException` for unknown units.
#### `Negative` : `IValueConverter`
```csharp
public static Negative Instance => new Negative();
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
```
Negates a `double` value in `Convert`. `ConvertBack` throws `Exception`.
#### `BoolToVisibilityConverter` : `IValueConverter`
```csharp
public Visibility TrueValue { get; set; } // default: Visible
public Visibility FalseValue { get; set; } // default: Collapsed
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
```
Converts `bool` to `Visibility`. Returns `null` for non-bool input.
#### `InvertVisibilityConverter` : `IValueConverter`
```csharp
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
```
Inverts `Visibility.Visible``Visibility.Collapsed`. Returns `Visible` for non-Visibility input.
#### `SQLConversion` (static)
```csharp
public static string ConvertInternalVersionToYear(int sqlVersion)
```
Maps SQL internal versions: 12→"2014", 13→"2016", 14→"2017", 15→"2019", 16→"2022". Returns `"{sqlVersion} (Internal)"` for unknown versions.
#### `PageHelper` (internal static)
```csharp
public static int GetTabAndButtonFontSize()
```
Returns `Properties.Settings.Default.TabAndPageButtonsFontSize` if within min/max bounds; otherwise returns `DTS.Common.Constants.TabAndPageButtonsFontSizeMin`.
#### `HardwareIPRanges`
```csharp
public IPRange[] IPRanges { get; set; }
public void AddIPRange(IPRange r)
public void AddRange(IPRange[] ranges)
```
Reads IP ranges from `HWIPRanges.txt` (comma-separated start/end IPs). Uses `IPAddressIntForm.TryParse` for validation.
#### `Transition` : `FrameworkElement`
```csharp
public enum TransitionState { A, B }
public object Source { get; set; } // DependencyProperty
public object DisplayA { get; set; } // DependencyProperty
public object DisplayB { get; set; } // DependencyProperty
public TransitionState State { get; set; } // DependencyProperty, default: A
```
Swaps display between A/B when `Source` changes.
#### `ToastWindow` : `Window`
```csharp
public ToastWindow(string screenShotFilename)
```
Displays a toast notification in the lower-right corner. Auto-closes after 2000ms. Clicking opens the screenshot file via `Process.Start`.
#### `ModalDialog` : `UserControl`
```csharp
public void SetParent(UIElement parent)
public bool ShowHandlerDialog(string message)
public UserControl MyContent { set; }
public string Message { get; set; } // DependencyProperty
public void OkButton_Click(object sender, RoutedEventArgs e)
public void CancelButton_Click(object sender, RoutedEventArgs e)
```
Shows a modal dialog with OK/Cancel buttons. `ShowHandlerDialog` blocks until closed, returning `true` for OK, `false` for Cancel.
#### `GroupedItemControl` : `Control`
```csharp
public static RoutedCommand ClickCommand { get; }
public ImageSource Image { get; set; } // DependencyProperty
public int ResourceId { get; set; } // DependencyProperty
public string Title { get; set; } // DependencyProperty, default: "Title"
public DataModel.TabPageItem TabItem { get; set; } // DependencyProperty
```
Custom control with click command routed to `MainWindow.GroupedItemControlClicked`.
#### `DataPROTabItem` : `TabItem`
```csharp
public DataPROTabItem(TabPageItem item)
public TabPageItem Item { get; }
public void SetReferringTab(DataPROTabItem tab)
public void GoToNewPage(UserControl o)
public void GoToPreviousPage(bool setActive)
public void ClearPreviousPages()
```
Manages page navigation with a history stack. Handles special navigation for `RunTestBase`, `EditTestSetupPage`, and TSR AIR Go mode.
#### `DbAccess` (abstract, all methods static)
```csharp
public static void InitializeGroupHardwareIds()
public static void InitializeTestSetupHardwareIds()
public static void InitializeDASIdChannelIndexGroupIdList()
public static void InitializeBaseModuleChannelIndexList()
public static void InitializeDASIds()
public static void InitializeGroupChannelIds()
public static void InitializeStaticGroupNames()
public static void InitializeEmbeddedGroupIdList()
public static void InitializeTestSetupGroupIds()
public static void InitializeTestSetupNames()
```
Initializes various in-memory caches from database using `DbOperations` and `GroupHelper`/`TestSetupHelper`.
### Data Transfer Objects
| Class | Properties |
|-------|------------|
| `UsedIn` | `Type`, `Name` |
| `UsedInGroup` | `Name` |
| `UsedInTestSetup` | `Name` |
| `DeviceSelected` | `Type`, `SerialNumber`, `CalDueDate`, `Groups` (List<UsedIn>), `TestSetups` (List<UsedIn>) |
| `UsageReport` | `SelectedDevices` (List<DeviceSelected>) |
---
## 3. Invariants
- **WaitCursor**: `Mouse.OverrideCursor` is always restored to its previous value when `Dispose()` is called.
- **BoolToVisibilityConverter**: `TrueValue` defaults to `Visibility.Visible`, `FalseValue` defaults to `Visibility.Collapsed`.
- **Transition**: `State` defaults to `TransitionState.A` on construction.
- **ToastWindow**: Always positions itself at `desktopWorkingArea.Right - Width` and `desktopWorkingArea.Bottom - Height`.
- **ModalDialog**: Parent `IsEnabled` is set to `false` while dialog is shown, `true` when hidden.
- **PageHelper**: Always returns a value within `[TabAndPageButtonsFontSizeMin, TabAndPageButtonsFontSizeMax]`.
- **HardwareIPRanges**: File parsing silently ignores malformed lines (catches exceptions per-line).
- **TimeUnits.ToShortString()**: Throws `NotSupportedException` if `MyUnits` is not a defined enum value.
---
## 4. Dependencies
### External Dependencies (from imports)
- `System.Windows.Forms.IWin32Window` (WindowWrapper)
- `System.Windows.Input` (WaitCursor, Cursors, Mouse)
- `System.Windows.Data`, `System.Windows` (value converters, Transition, ToastWindow, ModalDialog, GroupedItemControl)
- `Prism.Ioc`, `Prism.Events` (CommonStyles, DataPROTabItem)
- `DTS.Common.Base` (BasePropertyChanged - TimeUnits)
- `DTS.Common.Utilities.Logging` (APILogger - HardwareIPRanges, DataPROTabItem)
- `DTS.Common.Utils` (IPRange, IPAddressIntForm - HardwareIPRanges)
- `DTS.Common.Events`, `DTS.Common.Events.HelpTextEvent` (CommonStyles)
- `DTS.Common.SharedResource.Strings` (ToastWindow)
- `DTS.Common.Classes.Groups`, `DTS.Common.Classes.TestSetups`, `DTS.Common.Storage` (DbAccess)
- `DTS.Common.Enums` (DataPROTabItem)
- `DTS.Slice.Users.UserSettings` (DbAccess)
- `Unity` (DataPROTabItem)
### Internal Dependencies
- `DataPROWin7.DataModel.TabPageItem` (DataPROTabItem, GroupedItemControl)
- `DataPROWin7.TSRAIRGo.ViewModel.NavigationViewModel` (DataPROTabItem)
- `DataPROWin7.DataModel.Common.DbWrappers.TestSetupHardwareGet` (DbAccess)
### Consumers (inferred)
- `MainWindow` consumes `DataPROTabItem`, `GroupedItemControl`
- `DataPROPage` and derived types consume `IPageGrid`, `INavStepContent`
- Various views consume value converters and `WaitCursor`
---
## 5. Gotchas
1. **ModalDialog.ShowHandlerDialog** uses a busy-wait loop with

View File

@@ -0,0 +1,242 @@
---
source_files:
- DataPRO/DataPRO/Controls/GridFullScreen.xaml.cs
- DataPRO/DataPRO/Controls/CollectSelectControl.xaml.cs
- DataPRO/DataPRO/Controls/EditChannelCodesControl.xaml.cs
- DataPRO/DataPRO/Controls/UserListControl.cs
- DataPRO/DataPRO/Controls/RealtimeFullScreen.xaml.cs
- DataPRO/DataPRO/Controls/ViewGraphSelectControl.xaml.cs
- DataPRO/DataPRO/Controls/StatusRibbon.xaml.cs
- DataPRO/DataPRO/Controls/EditTestEngineerDetailsControl.xaml.cs
- DataPRO/DataPRO/Controls/EditUserInfoControl.xaml.cs
generated_at: "2026-04-17T15:46:03.267118+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ebe4edb1e9d5ba50"
---
# DataPRO Controls Module Documentation
## 1. Purpose
This module contains WPF UserControls for the DataPRO application's UI layer, providing specialized controls for fullscreen display, test setup selection, channel code editing, user management, realtime chart display, graph selection, status feedback, and data entry forms. These controls implement the `IPageContent` interface for page lifecycle management and `INotifyPropertyChanged` for data binding, serving as the primary UI components within the application's page-based navigation system.
---
## 2. Public Interface
### GridFullScreen
```csharp
public partial class GridFullScreen : UserControl, INotifyPropertyChanged
```
- `GridFullScreen()` - Initializes the control.
- `object MyFullscreenObject` - Gets/sets the content displayed in fullscreen mode.
- `event PropertyChangedEventHandler PropertyChanged` - Property change notification.
- `void closeButton_Click(object sender, RoutedEventArgs e)` - Closes fullscreen and navigates to previous page via `MainWindow.GoToPreviousPage()`.
### CollectSelectControl
```csharp
public partial class CollectSelectControl : UserControl, IPageContent, INotifyPropertyChanged
```
- `CollectSelectControl()` - Initializes the control.
- `bool Validate()` - Returns `true` (no validation logic implemented).
- `void IPageContent.OnSetActive()` - Empty implementation.
- `object GetPageContent()` - Loads test setups from database table `[tblTestSetups]` on first call; returns `this`.
- `bool NextStepButtonFocus` - Property for button focus state.
- `bool NextStepFocusLost` - Property for focus lost state.
**TestSetupInfo class:**
```csharp
public class TestSetupInfo
{
public string TestSetupName { get; set; }
public string Description { get; set; }
public string SamplesPerSecond { get; set; }
public DataModel.TestTemplate.RecordingModes Mode { get; set; }
}
```
### EditChannelCodesControl
```csharp
public partial class EditChannelCodesControl : UserControl, IPageContent, INotifyPropertyChanged
```
- `const string MY_ID = "Prepare_AdditionalDetails_Page_ChannelCodeDetails"` - Page identifier constant.
- `EditChannelCodesControl()` - Initializes the control.
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` - Delegates to `_vm.Validate(displayWindow)`.
- `void OnSetActive()` - Initializes ViewModels and activates the channel codes list.
- `object GetPageContent()` - Returns `this`.
- `void Delete()` - Deletes selected channel codes with confirmation dialog.
- `void Save()` - Saves changes via `_vm.Save()`.
- `void Reset()` - Empty implementation.
- `DataPROPage Page` - Sets the parent page reference.
### UserListControl
```csharp
public class UserListControl : GenericTable2
```
- `UserListControl(ContentControl parentControl, DataPROPage page)` - Initializes with multi-row selection mode and creates columns.
- `void UpdateList()` - Clears and repopulates the user list from `UserCollection.GetAllUsers()`, applying filters from `App.FilterUsers()`.
- `User SelectedUser` - Gets/sets the currently selected user.
- `User[] SelectedUsers` - Gets/sets the currently selected users (multi-select).
**TableColumns enum:**
```csharp
public enum TableColumns
{
DisplayName, UserName, Role, LastModified, LastModifiedBy, DatabaseId
}
```
### RealtimeFullScreen
```csharp
public partial class RealtimeFullScreen : UserControl, INotifyPropertyChanged
```
- `RealtimeFullScreen()` - Initializes the control.
- `void OnSetActive(RealtimeChart myChart)` - Sets the active chart for display.
- `RealtimeChart MyChart` - Gets/sets the displayed chart.
- `RunTestBase RTB` - Gets/sets the run test base reference.
- `SubControls.Realtime RealtimePage` - Sets the realtime page reference.
- `void EnableRealtimePrevious(bool bEnable)` - Enables/disables back button.
- `void EnableRealtimeNext(bool bEnable)` - Enables/disables next button.
- `Visibility BackButtonVisibility` / `NextButtonVisibility` - Controls button visibility.
- `bool HasBackButton` / `HasNextButton` - Controls button presence.
### ViewGraphSelectControlDelete
```csharp
public partial class ViewGraphSelectControlDelete : UserControl, IPageContent, INotifyPropertyChanged
```
- `ViewGraphSelectControlDelete()` - Initializes with empty `TestInfo` array.
- `bool Validate()` - Returns `true`.
- `void IPageContent.OnSetActive()` - Empty implementation.
- `object GetPageContent()` - Returns `this` (most logic commented out).
- `TestInfo[] FileNameList` - Gets/sets the list of test files.
- `DataModel.TestTemplate SelectedTest` - Gets/sets selected test.
- `bool BrowseFocusLost` - Focus tracking property.
- `string TestItemLongString` - Test item identifier string.
### StatusRibbon
```csharp
public partial class StatusRibbon : UserControl, INotifyPropertyChanged
```
- `StatusRibbon()` - Initializes the control.
- `string Prepend` - Dependency property for status text resource lookup prefix.
- `string Status` - Sets status text (triggers resource lookup via `Prepend_Status`).
- `string AggregateStatusText` - Gets the resolved status text.
- `int ProgressBarValue` - Gets/sets progress bar value (0-100).
- `Visibility ProgressBarVisibility` - Gets/sets progress bar visibility.
- `Color AggregateStatusColor` - Gets/sets the ribbon background color.
- `SolidColorBrush TextColor` - Gets/sets the text color.
- `void SetProgressValue(int value)` - Thread-safe progress setter; normalizes values to 0-100.
- `void SetProgressBarVisibility(Visibility v)` - Thread-safe visibility setter.
- `void SetStatusTextNoTranslate(string s)` - Sets status text directly without resource lookup.
- `void SetAggregateStatusColor(Color c)` - Thread-safe color setter.
- `void SetAlert(bool set)` - Thread-safe alert mode toggle; changes text color and alert visibility.
### EditTestEngineerDetailsControl
```csharp
public partial class EditTestEngineerDetailsControl : UserControl, IPageContent, INotifyPropertyChanged
```
- `EditTestEngineerDetailsControl()` - Initializes the control.
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` - Validates engineer names for blanks and duplicates.
- `void OnSetActive()` - Loads engineers from `DataModel.TestEngineerDetailsList.TestEngineerList.TestEngineers`.
- `object GetPageContent()` - Returns `this`.
- `void Save()` - Persists changes to `TestEngineerDetailsList`.
- `void Delete()` - Deletes selected engineers with confirmation dialog.
- `void Reset()` - Empty implementation.
- `DataPROPage Page` - Sets the parent page reference.
- `DataModel.TestEngineerDetails[] TestEngineers` - Gets/sets the engineer list.
- `ObservableCollection<DataModel.TestEngineerDetails> SelectedEngineerItems` - Selected items collection.
### EditUserInfoControl
```csharp
public partial class EditUserInfoControl : IPageContent, INotifyPropertyChanged
```
- `EditUserInfoControl()` - Initializes the control.
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` - Validates display name, role selection, and username uniqueness (for new users).
- `void OnSetActive()` - Triggers property change notifications for all `Tags` enum values.
- `object GetPageContent()` - Returns `this`.
- `void Reset()` - Clears validation markers on all input fields.
- `User CurrentUser` - Gets/sets the user being edited.
- `bool IsAdd` - Indicates if this is a new user creation.
- `bool IsNotDefaultUser` - Returns `true` if user is not a default system user.
- `string UserName` - Gets/sets the username.
- `string DisplayName` - Gets/sets the display name.
- `int UserRoleIndex` - Gets/sets the role index.
- `UserRoleData[] UserRoles` - Gets available roles.
- `bool LocalOnly` - Gets/sets local-only flag.
- `string LastModified` / `LastModifiedBy` - Gets modification metadata.
- `string UserTags` - Gets/sets comma-separated user tags.
**UserRoleData nested class:**
```csharp
public class UserRoleData
{
public User.DefaultRoles Role { get; }
public override string ToString() // Returns localized role name
}
```
---
## 3. Invariants
- **IPageContent contract**: All controls implementing `IPageContent` must provide `Validate()`, `OnSetActive()`, `GetPageContent()`, `Reset()`, and `UnSet()` methods.
- **Property change notification**: All `INotifyPropertyChanged` implementations use the `SetProperty<T>` pattern that returns `false` if the value equals the current value (no change).
- **Thread affinity**: WPF controls require UI thread access; `StatusRibbon` provides explicit thread-safe methods (`SetProgressValue`, `SetProgressBarVisibility`, `SetAggregateStatusColor`, `SetAlert`) that use `Dispatcher.CheckAccess()` and `Dispatcher.BeginInvoke()`.
- **DatabaseId column visibility**: In `UserListControl`, the `DatabaseId` column is always `Visibility.Collapsed` and is used internally to distinguish duplicate default user names.
- **Password sentinel**: `EditUserInfoControl` uses `UNCHANGED_SENTINEL = "***THISHASNTCHANGED***"` to detect if password fields were modified.
- **Blank engineer record**: `EditTestEngineerDetailsControl` always maintains a blank `TestEngineerDetails` at the end of the list for new entries.
- **Progress bar range**: `StatusRibbon.SetProgressValue()` normalizes values to 0-100 range.
---
## 4. Dependencies
### External Dependencies (from imports):
- **WPF assemblies**: `System.Windows.*` (Controls, Data, Input, Media, Navigation, Shapes)
- **Prism framework**: `Prism.Events`, `Prism.Ioc` (used in `EditChannelCodesControl`)
- **Unity container**: `Unity` (used in `EditChannelCodesControl`)
- **C1.WPF.DataGrid**: ComponentOne DataGrid (used in `UserListControl` for `DataGridSelectionMode.MultiRow`)
- **C1.WPF.FlexGrid**: ComponentOne FlexGrid (used in `ViewGraphSelectControlDelete`)
### Internal Dependencies:
- `DTS.Storage.DbOperations` - Database operations (`CollectSelectControl`)
- `DTS.Common.Interface.Channels.ChannelCodes` - Channel code interfaces (`EditChannelCodesControl`)
- `DTS.Common.SharedResource.Strings` - Localized string resources (`EditChannelCodesControl`, `StatusRibbon`, `EditTestEngineerDetailsControl`, `EditUserInfoControl`)
- `DTS.Common.Utilities.Logging` - Logging via `APILogger` (`UserListControl`)
- `DTS.Slice.Users` - User management types (`UserListControl`, `EditUserInfoControl`)
- `DTS.Common.Storage` - Storage operations (`EditUserInfoControl`)
- `DTS.Common.Events` - Prism events (`EditTestEngineerDetailsControl`)
- `DTS.Common.ISO` - ISO data types (`EditTestEngineerDetailsControl`)
- `DataModel` namespace - Data model types (`TestSetupInfo`, `TestEngineerDetails`, `TestTemplate`)
- `MainWindow` - Main application window for navigation
- `App` - Application class for message boxes and user filtering
- `GenericTable2` - Base class for `UserListControl`
- `RunTestBase`, `RealtimeChart` - Realtime testing components
- `DataPROPage`, `IPageContent`, `PageButton` - Page framework types
### Consumers:
- `MainWindow` - Calls `GoToPreviousPage()`, `RemoveFullScreenPlotInfo()`, `GoToSmallScreenRealtime()`
- `App` - Provides `DoMessageBox()`, `FilterUsers()`, `GetAllIUIItems()`
---
## 5. Gotchas
1. **Class naming inconsistency**: `ViewGraphSelectControlDelete` has "Delete" in the class name but appears to be a functional control, not a deleted/deprecated one. The filename is `ViewGraphSelectControl.xaml.cs`.
2. **Commented-out code**: `ViewGraphSelectControlDelete.GetPageContent()` contains extensive commented-out logic that may represent incomplete refactoring or dead code paths.
3. **Hardcoded SQL**: `CollectSelectControl` uses a raw SQL string `"SELECT * from [tblTestSetups]"` without parameterization.
4. **Refresh flag pattern**: `CollectSelectControl` uses a `bool refreshing = true` field that is set to `false` after first load and never reset, meaning `GetPageContent()` only loads data once per control instance.
5. **Null-conditional navigation**: `RealtimeFullScreen.closeButton_Click()` uses both `(Application.Current.MainWindow as MainWindow)?.RemoveFullScreenPlotInfo()` and `((MainWindow)Application.Current.MainWindow)?.GoToSmallScreenRealtime()` - mixing null-conditional with cast patterns.
6. **Password sentinel exposure**: The `UNCHANGED_SENTINEL` constant value `"***THISHASNTCHANGED***"` is visible in source; if users type this exact string as a password, behavior is undefined.
7. **Thread-safety inconsistency**: Only `StatusRibbon` provides thread-safe wrappers; other controls with `INotifyPropertyChanged` do not appear to handle cross-thread property changes.
8. **Validation stubs**: `CollectSelectControl.Validate()` and `ViewGraphSelectControlDelete.Validate()` always return `true` without performing validation.
9. **Implicit dependencies on Application.Current**: Multiple controls cast `Application.Current.MainWindow` to `MainWindow` and `Application.Current` to `App`, creating tight coupling to the specific application instance.

View File

@@ -0,0 +1,59 @@
---
source_files:
- DataPRO/DataPRO/Controls/Common/CommonFunctions.cs
generated_at: "2026-04-17T16:43:53.359036+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e4c1b1ecc2a41a83"
---
# Documentation: CommonFunctions.cs
## 1. Purpose
This module provides utility functions for creating SLICETC (presumably a hardware-specific thermocouple configuration) channels within the DataPRO application. It serves as a helper layer that orchestrates sensor retrieval, channel defaults loading, and delegates the actual channel creation to `GroupChannel`, abstracting the complexity of sensor lookup and configuration from callers.
---
## 2. Public Interface
### Delegates
#### `addChannelsToGroupDelegate`
```csharp
public delegate GroupChannel.AddChannelsToGroupDelegate addChannelsToGroupDelegate(IGroupChannel[] channels)
```
A delegate type that accepts an array of `IGroupChannel` objects and returns a `GroupChannel.AddChannelsToGroupDelegate`.
#### `getMaxDisplayOrderDelegate`
```csharp
public delegate GroupChannel.GetMaxDisplayOrderDelegate getMaxDisplayOrderDelegate()
```
A parameterless delegate that returns a `GroupChannel.GetMaxDisplayOrderDelegate`.
### Methods
#### `CreateSLICETCChannels`
```csharp
public static void CreateSLICETCChannels(
GroupChannel.AddChannelsToGroupDelegate addChannels,
GroupChannel.GetMaxDisplayOrderDelegate getMaxDisplayOrder,
DASHardware hardware,
IGroup group,
bool bEditGroup)
```
Creates SLICETC channels for a given hardware/group configuration. The method:
1. Retrieves channel setting defaults via `DbOperations.GetChannelSettingDefaults()`
2. Looks up three sensors by their serial numbers from `DTS.SensorDB.SensorsCollection.SensorsList`:
- Thermocoupler sensor (`SensorConstants.TEST_SPECIFIC_THERMOCOUPLER`)
- Stream out sensor (`SensorConstants.TEST_SPECIFIC_STREAM_OUT_SERIAL`)
- UART sensor (`SensorConstants.TEST_SPECIFIC_UART_SERIAL`)
3. Sets the thermocoupler's `Bridge` property to `SensorConstants.BridgeType.Thermocoupler`
4. Delegates to `GroupChannel.CreateSLICETCChannels()` with all gathered parameters
---
## 3. Invariants
- **Sensor existence**: The three sensors identified by the constants (`TEST_SPECIFIC_THERMOCOUPLER`, `TEST_SPECIFIC_STREAM_OUT_SERIAL`, `TEST_SPECIFIC_UART_SERIAL`) must exist in `DTS.SensorDB.SensorsCollection.SensorsList` at runtime, or a null reference exception will occur.
- **Delegate validity**: The `addChannels` and `getMaxDisplayOrder` delegates passed to `CreateSLICETCChannels` must be non-null and callable

View File

@@ -0,0 +1,286 @@
---
source_files:
- DataPRO/DataPRO/Controls/CustomUIElements/ChannelsNavStepToggleList.cs
- DataPRO/DataPRO/Controls/CustomUIElements/UI_TEST.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/combobox.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/checkbox.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/radiobutton.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/ParametersNavStepToggleList.cs
- DataPRO/DataPRO/Controls/CustomUIElements/CustomTickBar.cs
- DataPRO/DataPRO/Controls/CustomUIElements/RealtimeChannelToggleButton.cs
- DataPRO/DataPRO/Controls/CustomUIElements/NavStepActionButton.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/NavStepRadioButton.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/ModalLicensePrompt.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/ModalUserPrompt.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/RealtimeListContainerButton.cs
- DataPRO/DataPRO/Controls/CustomUIElements/NavStepToggleList.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/ActionComboBox.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/ActionLabel.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/ActionRadioButton.xaml.cs
- DataPRO/DataPRO/Controls/CustomUIElements/PageButton.xaml.cs
generated_at: "2026-04-17T15:45:35.148778+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "480c35226e29513e"
---
# CustomUIElements Module Documentation
## 1. Purpose
This module provides a collection of custom WPF controls for the DataPRO application's navigation and user interface. It includes specialized toggle lists for navigation steps, permission-aware UI elements (buttons, radio buttons, combo boxes, labels), modal dialog content controls, and custom rendered controls like `CustomTickBar`. The controls integrate with Prism's event aggregation system for cross-component communication and implement a role-based permission model through the `IUIItems` interface.
---
## 2. Public Interface
### NavStepToggleList (NavStepToggleList.xaml.cs)
Base class for collapsible toggle button lists used in navigation panels.
```csharp
public NavStepToggleList() // Constructor - initializes collapsed visibility
public void ChangeState(bool on) // Explicitly changes root button state
public bool CheckState { get; } // Current checked state of root button
public virtual void MainStateChange() // Called when root button state changes
public virtual void UpdateList() // Called when control needs refresh for display
public void SetText(string text) // Sets root button text
public void SetList(NavStepRadioButton[] children) // Sets child toggle buttons
public NavStepRadioButton[] GetChildren() // Returns child toggle buttons
public Visibility PanelVisibility { get; set; } // Visibility of child panel
```
### ChannelsNavStepToggleList (ChannelsNavStepToggleList.cs)
Specialization for channel navigation.
```csharp
public ChannelsNavStepToggleList(string text, string id, string groupName)
public override void MainStateChange() // Empty override
```
### ParametersNavStepToggleList (ParametersNavStepToggleList.cs)
Specialization for parameters navigation with mutual exclusion behavior.
```csharp
public ParametersNavStepToggleList(string text, string id, string groupName)
public override void MainStateChange() // Calls TurnOffOtherNavCheckListButtons on current page
```
### RealtimeToggleListRootButton (RealtimeListContainerButton.cs)
Root button for DAS hardware or calculated channels lists.
```csharp
public RealtimeToggleListRootButton() // Default constructor
public RealtimeToggleListRootButton(DataModel.DASHardware h) // Constructs from hardware
public RealtimeToggleListRootButton(DTS.Common.ISO.CalculatedValueClass[] cc) // Constructs from calculated channels
public DataModel.DASHardware Hardware { get; private set; }
public void UpdateRealtimeChannels(RealtimeChart.RealtimeChannel[] channels)
public override void UpdateList()
```
### RealtimeChannelToggleButton (RealtimeChannelToggleButton.cs)
Individual toggle button for a single realtime channel.
```csharp
public RealtimeChannelToggleButton()
public RealtimeChannelToggleButton(DataModel.HardwareChannel channel)
public RealtimeChannelToggleButton(DTS.Common.ISO.CalculatedValueClass channel)
public DataModel.HardwareChannel HardwareChannel { get; private set; }
public DTS.Common.ISO.CalculatedValueClass CalculatedChannel { get; private set; }
public RealtimeChart.RealtimeChannel RealtimeChannel { get; set; }
```
### NavStepRadioButton (NavStepRadioButton.xaml.cs)
Base radio button control for navigation.
```csharp
public NavStepRadioButton()
public NavStepRadioButton(string text)
public void SetText(string text)
public string Id { get; set; }
public bool CheckState { get; set; }
public virtual void navStepButton_Click(object sender, RoutedEventArgs e)
public event OnStateChangeDelegate OnStateChanged
```
### NavStepActionButton (NavStepActionButton.xaml.cs)
Action button with localized text and action callback.
```csharp
public NavStepActionButton(string id, ActionFiredDelegate action)
public string Id { get; set; }
public string ButtonText { get; set; }
public void SetVisible(bool bShow)
public event ActionFiredDelegate OnActionFired
public delegate void ActionFiredDelegate(string id)
```
### CustomTickBar (CustomTickBar.cs)
Custom tick bar with text annotations.
```csharp
public string[] TextArray { get; set; } // Default: ["Low", "Med", "High", "Very High", "MAX"]
protected override void OnRender(DrawingContext dc)
```
### ActionComboBox (ActionComboBox.xaml.cs)
Permission-aware combo box implementing `IUIItems`.
```csharp
public ActionComboBox()
public ActionComboBox(DTS.Slice.Users.User.UserPermissionLevels requiredPermissionLevel, string id, IActionButtonContainer page)
public long GetID() / void SetID(long id)
public string UniqueId { get; set; }
public string GetName()
public DTS.Slice.Users.User.UserPermissionLevels GetRequiredPermission()
public DTS.Slice.Users.User.UserPermissionLevels GetDefaultRolePermission(DTS.Slice.Users.User.DefaultRoles role)
public bool GetDefaultRoleVisibility(DTS.Slice.Users.User.DefaultRoles role)
public IActionButtonContainer ActionButtonContainer { get; set; }
public string DisplayText { get; set; }
public void SetVisible(bool bShow)
public void SetVisible(Visibility visibility)
public void SetEnabled(bool bShow)
```
### ActionRadioButton (ActionRadioButton.xaml.cs)
Permission-aware radio button implementing `IUIItems`.
```csharp
public ActionRadioButton()
public ActionRadioButton(DTS.Slice.Users.User.UserPermissionLevels requiredPermissionLevel, string id, IActionButtonContainer page)
public string UniqueId { get; set; }
public string DisplayText { get; set; }
public string ActionGroupName { get; set; }
public bool ActionChecked { get; set; }
public DTS.Slice.Users.User.UserPermissionLevels RequiredPermission { get; set; }
// Plus inherited IUIItems methods
```
### ActionLabel (ActionLabel.xaml.cs)
Permission-aware label implementing `IUIItems`.
```csharp
public ActionLabel()
public ActionLabel(DTS.Slice.Users.User.UserPermissionLevels requiredPermissionLevel, string id, IActionButtonContainer page)
public string UniqueId { get; set; }
public string DisplayText { get; set; }
// Plus inherited IUIItems methods
```
### PageButton (PageButton.xaml.cs)
Permission-aware page button implementing `IUIItems`.
```csharp
protected PageButton()
public PageButton(DTS.Slice.Users.User.UserPermissionLevels requiredPermissionLevel, string id, DataPROPage page)
public PageButton(DTS.Slice.Users.User.UserPermissionLevels requiredPermissionLevel, string id, MainWindow mainWindow)
public string UniqueId { get; set; }
public string DisplayText { get; set; }
public Style PageButtonStyle { get; }
public void SetVisible(bool bShow)
public void SetEnabled(bool bEnable)
public void SetStyle(ButtonStyles s)
public enum ButtonStyles { Normal, Bold, Flashing }
// Plus inherited IUIItems methods
```
### ModalUserPrompt (ModalUserPrompt.xaml.cs)
Modal content for user prompts implementing `IModalContent`.
```csharp
protected ModalUserPrompt()
public ModalUserPrompt(string _userPrompt, bool reusable = false)
public string PromptString { get; set; }
public bool ReusableMessageBox { get; set; }
public DateTime CloseTime { get; set; }
public System.Windows.Forms.DialogResult DialogResult { get; }
public ModalPage.OnCloseDelegate CloseFunction { get; set; }
public void SetButtons(PageButton[] buttons)
public PageButton[] GetButtons()
public PageButton DefaultButton { get; set; }
void IModalContent.OnSetActive()
```
### ModalLicensePrompt (ModalLicensePrompt.xaml.cs)
Modal content for license prompts with checkbox.
```csharp
protected ModalLicensePrompt()
public ModalLicensePrompt(string userPrompt, string checkboxString)
public string PromptString { get; set; }
public string CheckboxString { get; set; }
public bool IsboxChecked { get; set; }
public bool ReusableMessageBox { get; set; }
public System.Windows.Forms.DialogResult DialogResult { get; }
public ModalPage.OnCloseDelegate CloseFunction { get; set; }
public void SetButtons(PageButton[] buttons)
public PageButton[] GetButtons()
public PageButton DefaultButton { get; set; }
void IModalContent.OnSetActive()
```
### combobox, checkbox, radiobutton (partial classes)
Tooltip event handlers for help text publishing.
```csharp
public void ToolTipEventHandler(object sender, ToolTipEventArgs e)
```
---
## 3. Invariants
- **NavStepToggleList**: Always initializes with `Visibility = Visibility.Collapsed`. The `MainButton.OnStateChanged` event is subscribed in constructor.
- **NavStepRadioButton**: `_bLastState` tracks the previous check state; `CheckState` setter does not trigger events, only `navStepButton_Click` does.
- **RealtimeChannelToggleButton**: Each button is associated with either a `HardwareChannel` OR a `CalculatedChannel`, never both (set via different constructors).
- **CustomTickBar**: `TextArray` defaults to 5 elements; `OnRender` catches `IndexOutOfRangeException` and substitutes empty string if tick count exceeds array length.
- **ActionComboBox/ActionRadioButton/ActionLabel/PageButton**: All require `IActionButtonContainer` or `DataPROPage` reference for event handling; `SetVisible(true)` still checks user permissions before showing.
- **ModalUserPrompt/ModalLicensePrompt**: `DialogResult` is always `System.Windows.Forms.DialogResult.Cancel` (read-only property).
- **NavStepActionButton**: When `Id == "ArmSystemStopMonitoring"` and `ButtonText == StringResources.Record_Attach`, the `Id` is changed to `"ArmSystemStartMonitoring"` before firing `OnActionFired`.
---
## 4. Dependencies
### External Dependencies (from imports)
- **Prism.Ioc** - `ContainerLocator` for service resolution
- **Prism.Events** - `IEventAggregator` for event publishing
- **DTS.Common.Events** - `HelpTextEvent`, `HelpTextEventArg`
- **DTS.Common.Utilities.Logging** - `APILogger.Log()`
- **DTS.Common.SharedResource.Strings** - `StringResources` for localization
- **DTS.Common.ISO** - `CalculatedValueClass`
- **DTS.Slice.Users** - `IUIItems` interface, `User.UserPermissionLevels`, `User.DefaultRoles`
- **System.Windows.Controls.Primitives** - `TickBar` base class
### Internal Dependencies (inferred from code)
- `NavStepToggleList` depends on: `MainWindow`, `HomePage`, `RunRunBase`, `SubControls.Realtime`
- `ParametersNavStepToggleList` depends on: `MainWindow`, `HomePage`
- `NavStepRadioButton` depends on: `MainWindow`, `HomePage`
- `RealtimeToggleListRootButton` depends on: `DataModel.DASHardware`, `DataModel.HardwareChannel`, `RealtimeChart.RealtimeChannel`
- `RealtimeChannelToggleButton` depends on: `DataModel.HardwareChannel`, `RealtimeChart.RealtimeChannel`
- `PageButton` depends on: `DataPROPage`, `MainWindow`, `App`
- `ActionComboBox/ActionRadioButton` depend on: `IActionButtonContainer`, `App`
### Dependents (modules likely depending on this)
- Any page/control using navigation step toggles
- Modal dialog systems using `IModalContent`
- Permission-based UI rendering systems
---
## 5. Gotchas
1. **Hardcoded culture and font in CustomTickBar**: `OnRender` uses `CultureInfo.GetCultureInfo("en-us")` and `new Typeface("Verdana")` hardcoded. Localization will not apply to tick labels.
2. **NavStepActionButton ID mutation**: The `Id` property is mutated inside `actionButton_Click` when `Id == "ArmSystemStopMonitoring"` and `ButtonText == StringResources.Record_Attach`. The Id changes to `"ArmSystemStartMonitoring"` before the event fires. This is documented in comment referencing issue #20097.
3. **Duplicate permission logic**: `GetDefaultRolePermission` and `GetDefaultRoleVisibility` are duplicated verbatim across `ActionComboBox`, `ActionLabel`, `ActionRadioButton`, and `PageButton`. Changes must be applied to all four.
4. **Application.Current casts without null checks**: Multiple controls cast `Application.Current` to `App` or access `Application.Current.MainWindow` without null checks (e.g., `NavStepRadioButton.navStepButton_Click`, `NavStepToggleList.MainStateChange`).
5. **ModalUserPrompt.CloseTime never set**: The `CloseTime` property is documented as tracking when prompt was closed, but no code in the provided source sets it (remains `DateTime.MinValue`).
6. **NavStepRadioButton._bSetting field unused**: The `volatile bool _bSetting` field is declared but never referenced in the provided code.
7. **combobox/checkbox/radiobutton naming**: These partial classes use lowercase names which violates C# naming conventions and may cause confusion with framework types.
8. **SetVisible(Visibility) redundancy**: The `SetVisible(Visibility visibility)` method in `ActionComboBox`, `ActionLabel`, and `ActionRadioButton` simply assigns to `Visibility` property with a switch statement that handles all cases identically to direct assignment.

View File

@@ -0,0 +1,201 @@
---
source_files:
- DataPRO/DataPRO/Controls/DAS/EditDASRecordControl.xaml.cs
- DataPRO/DataPRO/Controls/DAS/DataRecodersTileControl.xaml.cs
- DataPRO/DataPRO/Controls/DAS/TOMDiagnostics.xaml.cs
- DataPRO/DataPRO/Controls/DAS/ImportDASRecordControl.xaml.cs
- DataPRO/DataPRO/Controls/DAS/ExportDASRecordControl.xaml.cs
generated_at: "2026-04-17T15:50:22.415201+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f208fddbec78af70"
---
# DAS Controls Documentation
## 1. Purpose
This module contains WPF UserControls for managing Data Acquisition System (DAS) hardware records within the DataPRO application. It provides functionality for viewing, editing, importing, and exporting DAS hardware configurations, as well as displaying diagnostic information for hardware channels. The controls implement the `IPageContent` interface for integration with the page-based navigation system and use the MVVM pattern with Unity dependency injection.
---
## 2. Public Interface
### EditDASRecordControl
**Namespace:** `DataPROWin7.Controls`
**Implements:** `IPageContent`, `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `EditDASRecordControl` | `public EditDASRecordControl(DataPROPage page)` | Constructor accepting the hosting page. |
| `SetHardware` | `public void SetHardware(DataModel.DASHardware hardware, bool isAdd)` | Sets the hardware being added or edited. Subscribes to `INotifyPropertyChanged` on the hardware object. |
| `Save` | `public void Save()` | Saves current hardware via the view model, sets `_page.IsAdd = false`, and updates modified state to `Saved`. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `OnSetActive` | `public void OnSetActive()` | Initializes view models and activates the hardware view model. Sets `_bInOnSetActive` flag during execution. |
| `SetPermissions` | `public void SetPermissions(User.UserPermissionLevels actualPermission, User.UserPermissionLevels requiredPermission)` | Controls visibility/enabled state of `ViewContainer` based on permission level. `Deny` collapses the view; `Edit` or higher enables it. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Validates hardware via `IAddEditHardwareViewModel.Validate()`. Returns `false` if `ISOHardware` is null. |
| `OnButtonPress` | `public bool OnButtonPress(PageButton button)` | Returns `false`. |
| `KeyDown` | `bool IPageContent.KeyDown(object sender, KeyEventArgs e)` | Returns `false`. |
| `StartSearch` | `public void StartSearch(string term)` | Empty implementation. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Empty implementation. |
### DataRecodersTileControl
**Namespace:** `DataPROWin7.Controls.DAS`
**Implements:** `IPageContent`, `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `DataRecodersTileControl` | `public DataRecodersTileControl(DataRecordersPage page)` | Constructor accepting the hosting page. |
| `SelectedHardware` | `public DataModel.DASHardware[] SelectedHardware { get; set; }` | Currently selected hardware array, populated from `DASHardwareList.GetList().GetHardware()`. |
| `UpdateList` | `public void UpdateList()` | Refreshes hardware list via `_hardwareListVm.GetHardware(true, true, false, null, null)`. |
| `OnSetActive` | `void IPageContent.OnSetActive()` | Calls `OnSetActiveAsync()` via `Task.Run()`. |
| `StartSearch` | `void IPageContent.StartSearch(string term)` | Filters hardware list via `_hardwareListVm.Filter(term)`. |
| `Validate` | `bool IPageContent.Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true`. |
| `OnButtonPress` | `bool IPageContent.OnButtonPress(PageButton button)` | Returns `false`. |
| `KeyDown` | `bool IPageContent.KeyDown(object sender, KeyEventArgs arg)` | Returns `false`. |
| `GetPageContent` | `object IPageContent.GetPageContent()` | Returns `this`. |
| `UnSet` | `void IPageContent.UnSet(Action OnComplete = null)` | Calls `_hardwareListVm?.Unset()`. |
| `SetPermissions` | `void IPageContent.SetPermissions(...)` | Empty implementation. |
### TOMDiagnostics
**Namespace:** `DataPROWin7.Controls.DAS`
**Implements:** `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `TOMDiagnostics` | `public TOMDiagnostics()` | Constructor; initializes chart axes with format strings. |
| `SetChannel` | `public void SetChannel(DataModel.HardwareChannel c)` | Sets the hardware channel for diagnostics display. Uses `Dispatcher.BeginInvoke` for thread safety. Updates all property bindings and chart values. |
| `DurationBackground` | `public SolidColorBrush DurationBackground { get; }` | Returns status brush based on `_hardwareChannel.DurationStatus`. |
| `SquibDelayBackground` | `public SolidColorBrush SquibDelayBackground { get; }` | Returns status brush based on `_hardwareChannel.DelayStatus`. |
| `ExpectedDelayText` | `public string ExpectedDelayText { get; }` | Returns formatted squib fire delay from `_hardwareChannel.Sensor.SquibFireDelayMS` using `"N3"` format, or `"N/A"`. |
| `ExpectedDurationText` | `public string ExpectedDurationText { get; }` | Returns formatted duration if `_hardwareChannel.Sensor.LimitDuration` is true, or `"N/A"`. |
| `DelayMSText` | `public string DelayMSText { get; }` | Returns `"Passed"`, `"Failed"`, or `"N/A"` based on `_hardwareChannel.DelayStatus`. |
| `DurationMSText` | `public string DurationMSText { get; }` | Returns `"Passed"`, `"Failed"`, or `"N/A"` based on `_hardwareChannel.DurationStatus`. |
| `OutputPeakCurrentText` | `public string OutputPeakCurrentText { get; }` | Returns max value from `_hardwareChannel._diagnostics.SquibFireCurrentData` using `"N3"` format. |
### ImportDASRecordControl
**Namespace:** `DataPROWin7.Controls`
**Implements:** `IPageContent`, `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ImportDASRecordControl` | `public ImportDASRecordControl(DataPROPage page)` | Constructor; initializes `DataRecordersControl` and subscribes to `ColumnChangedEvent`. |
| `ImportFile` | `public string ImportFile { get; set; }` | Path to the import file. |
| `Import` | `public void Import()` | Queues import operation via `ThreadPool.QueueUserWorkItem(ImportFunc)`. |
| `Reset` | `public void Reset()` | Clears `includedDASLookup`, resets `ImportFile`, and updates hardware list. |
| `OnSetActive` | `public void OnSetActive()` | Activates hardware control, sets status to `Waiting`, and calls `Reset()`. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` (minimal validation). |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `OnButtonPress` | `public bool OnButtonPress(PageButton button)` | Returns `true` if `button.UniqueId == "MessageBoxButton_OK"`, else `false`. |
| `SetStatus` | `public delegate void SetStatusDelegate(ImportTestSetup.PossibleStatus status, string errorMessage)` | Thread-safe status update via `Dispatcher.BeginInvoke`. |
### ExportDASRecordControl
**Namespace:** `DataPROWin7.Controls`
**Implements:** `IPageContent`, `INotifyPropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ExportDASRecordControl` | `public ExportDASRecordControl(DataPROPage page)` | Constructor accepting the hosting page. |
| `ExportFile` | `public string ExportFile { get; set; }` | Path to the export file. |
| `SelectedHardware` | `public DASHardware SelectedHardware { get; }` | Returns selected hardware from `_allHardware`. |
| `Export` | `public void Export()` | Queues export via `ThreadPool`. Checks for file existence and prompts for overwrite if needed. |
| `Reset` | `public void Reset()` | Validates current state. |
| `OnSetActive` | `public void OnSetActive()` | Initializes VMs, subscribes to `HardwareListHardwareIncludedEvent`, and refreshes hardware list. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Validates `_exportFile` is not empty and `_includedDAS.Count > 0`. Marks UI elements as invalid if validation fails. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `SetStatusText` | `public void SetStatusText(string text)` | Sets status ribbon text. |
| `SetRibbonColor` | `public void SetRibbonColor(System.Windows.Media.Color color)` | Sets status ribbon color. |
| `UnSet` | `void IPageContent.UnSet(Action OnComplete = null)` | Unsubscribes from `HardwareListHardwareIncludedEvent`. |
---
## 3. Invariants
### EditDASRecordControl
- `_bInOnSetActive` must be `true` during `OnSetActive()` execution to prevent `NotifyAware_PropertyChanged` from triggering premature state changes.
- `InitializeVmsIfNeeded()` must be called before accessing `_vm`, `_vmHWList`, `UnityContainer`, or `EventAggregator`.
- When `SetHardware` is called with `isAdd = false`, the hardware parameter must not be null for proper operation.
- `ViewContainer` visibility is mutually exclusive with `Deny` permission level.
### DataRecodersTileControl
- `InitializeVMsIfNeeded()` must be called before accessing `_hardwareListVm`.
- `OnSetActiveAsync()` uses `Dispatcher.Invoke` to ensure UI operations occur on the UI thread.
- `_hardwareListVm.OverdueHardware.Any()` determines visibility of overdue calibration section.
### TOMDiagnostics
- `SetChannel` must be called before accessing diagnostic properties; otherwise, properties return `"N/A"` or default brushes.
- `UpdateCurrentValues()` and `UpdateTimeAxis()` use `lock(MyLock)` for thread safety.
- Channel array access in `GetVoltageChannel()` assumes channels are ordered consecutively (accesses `Channels[i + 1]`).
### ImportDASRecordControl
- `_bLoading` flag prevents `ColumnChangedEvent` handler from processing events during `OnSetActive()`.
- `includedDASLookup` dictionary keys are hardware IDs from `hardware.GetHardware().GetId()`.
- XML import supports version migration via `ImportTestSetup.MigrateXMLToCurrentVersion()` for versions below `FileUtils.DataPRO20XmlVersion`.
### ExportDASRecordControl
- `_bInChallenge` flag prevents recursive overwrite prompts during file export.
- `_includedDAS` dictionary keys are serial numbers.
- When `ShowCompactHardware` is enabled and hardware is a pseudo-rack, child DAS hardware is automatically included/excluded.
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Used In |
|-----------|---------|
| `DTS.Slice.Users` | All controls (permission levels) |
| `Prism.Ioc` | All controls (`ContainerLocator`) |
| `Unity` | All controls (`IUnityContainer`) |
| `Prism.Events` | All controls (`IEventAggregator`) |
| `DTS.Common.Interface.Hardware.AddEditHardware` | `EditDASRecordControl` (`IAddEditHardwareViewModel`, `IAddEditHardwareView`) |
| `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` | Multiple controls (`IHardwareListViewModel`, `IHardwareListView`, `IHardwareListOverdueView`, `ISLICE6TreeView`, `IHardwareListSelectView`) |
| `DTS.Common.Storage` | `EditDASRecordControl` (`DbOperations`) |
| `DTS.Common.SharedResource.Strings` | All controls (localized strings) |
| `DTS.Common.Events.Hardware.HardwareList` | `DataRecodersTileControl`, `ExportDASRecordControl` (`HardwareListHardwareSelectedEvent`, `HardwareListEditHardwareEvent`, `HardwareListHardwareIncludedEvent`) |
| `DTS.Common.Utilities.Logging` | `DataRecodersTileControl`, `ImportDASRecordControl`, `ExportDASRecordControl` (`APILogger`) |
| `DTS.Common.Events` | `DataRecodersTileControl` (`PageErrorEvent`) |
| `DTS.Common.Interface.Sensors.AnalogDiagnostics` | `TOMDiagnostics` (`DiagnosticStatus`) |
| `DTS.Common` | `TOMDiagnostics`, `ImportDASRecordControl`, `ExportDASRecordControl` (`BrushesAndColors`) |
| `DataPROWin7.DataModel.Classes.Hardware` | `DataRecodersTileControl`, `ExportDASRecordControl` (`DASHardwareList`, `DASHardware`) |
### Internal Dependencies
| Component | Depends On |
|-----------|------------|
| `EditDASRecordControl` | `DataPROPage`, `IAddEditHardwareViewModel`, `IHardwareListViewModel` |
| `DataRecodersTileControl` | `DataRecordersPage`, `IHardwareListViewModel` |
| `TOMDiagnostics` | `DataModel.HardwareChannel` |
| `ImportDASRecordControl` | `DataPROPage`, `DataRecordersControl`, `ImportTestSetup` |
| `ExportDASRecordControl` | `DataPROPage`, `IHardwareListViewModel`, `ExportTestSetup` |
---
## 5. Gotchas
### Thread Safety Issues
- **TOMDiagnostics**: The static `MyLock` object is used for synchronization, but `SetChannel` uses `Dispatcher.BeginInvoke` while `UpdateCurrentValues`/`UpdateTimeAxis` use `lock`. This mixed approach could lead to race conditions if `SetChannel` is called rapidly from multiple threads.
### Potential Null Reference Issues
- **TOMDiagnostics.GetVoltageChannel()**: Accesses `Channels[i + 1]` without bounds checking. If the channel is the last in the array, this will throw `IndexOutOfRangeException`.
- **EditDASRecordControl.SetHardware()**: Subscribes to `PropertyChanged` on hardware objects but the unsubscribe logic only runs when new hardware is set, potentially causing memory leaks if hardware is set multiple times.
### Event Subscription Leaks
- **ExportDASRecordControl**: The `OnIncluded` handler is subscribed with `keepSubscriberReferenceAlive = false`, but the unsubscribe only happens in `UnSet()`. If `UnSet` is not called, the subscription persists.
- **DataRecodersTileControl**: Event subscriptions to `HardwareListHardwareSelectedEvent` and `HardwareListEditHardwareEvent` are never unsubscribed.
### UI Thread Assumptions
- **DataRecodersTileControl.OnSetActive()**: Delegates to `Task.Run(() => OnSetActiveAsync())` but `OnSetActiveAsync` uses `Dispatcher.Invoke` for all operations, negating the benefit of the background thread.
### Incomplete Implementations
- **EditDASRecordControl.StartSearch()**: Empty method body.
- **EditDASRecordControl.UnSet()**: Empty method body.
- **DataRecodersTileControl.SetPermissions()**: Empty method body.
- **ImportDASRecordControl.StartSearch()**: Empty method body.
- **ExportDASRecordControl.StartSearch()**: Empty method body.
- **ExportDASRecordControl.OnButtonPress()**: Only handles `"MessageBoxButton_OK"`, ignores other buttons.
### Magic Strings
- Import/Export controls use magic strings for button IDs (`"MessageBoxButton_OK"`) and resource key prefixes (`"ExportTestSetup_"`).
### Calibration Period Configuration
- `DataRecodersTileControl` and `ExportDASRecordControl` both call `SetCalPeriods` with 13 different calibration period settings from `Properties.Settings.Default`. This configuration must be kept synchronized between both controls.

View File

@@ -0,0 +1,144 @@
---
source_files:
- DataPRO/DataPRO/Controls/DAS/HardwareDiscovery/ChannelDiscoveryTable.cs
- DataPRO/DataPRO/Controls/DAS/HardwareDiscovery/AutoDiscoveredDASTable.cs
generated_at: "2026-04-17T15:52:25.968409+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "02c78f75058b710a"
---
# Documentation: Hardware Discovery Tables
## 1. Purpose
This module provides two WPF data grid controls for the hardware discovery workflow in a data acquisition system (DAS). `ChannelDiscoveryTable` displays discovered sensor channels with their associated hardware locations and sensor metadata, supporting Quick data collection scenarios. `AutoDiscoveredDASTable` displays physically connected DAS devices that have been auto-detected and communicated with, allowing users to include/exclude devices and configure sampling parameters before committing them to the system's hardware registry.
---
## 2. Public Interface
### ChannelDiscoveryTable
**Inherits from:** `GenericTable2`
**Constructors:**
- `ChannelDiscoveryTable(System.Windows.Controls.ContentControl containerControl, DataPROPage page, DataPROWin7.HardwareDiscovery.Location location, HardwareDiscoveryControl hardwareDiscoveryControl)` — Initializes the table with column definitions based on `Fields` enum; configures read-only text columns for channel display.
**Properties:**
- `int DigitalInCount` — Count of digital input channels; uses `SetProperty` with `CountTags.DigitalInCount`.
- `int SquibCount` — Count of squib-type channels; uses `SetProperty` with `CountTags.SquibCount`.
- `int AnalogCount` — Count of analog channels; uses `SetProperty` with `CountTags.AnalogCount`.
**Methods:**
- `void CountCount()` — Iterates through `Rows`, extracts `ChannelHelper` from each row's `DataItem`, and tallies channels by `SensorConstants.BridgeType` (DigitalInput, SQUIB, or default/analog).
- `DTS.SensorDB.SensorData[] GetOnlineSensors()` — Intended to return an array of online sensors; **currently returns an empty array** (list is created but never populated).
- `void UpdateChannels(ChannelHelper[] foundChannels)` — Clears `DataTable.Rows`, populates new rows from the provided array, mapping each `Fields` enum value to row columns.
- `void UnSet()` — Clears all rows from `DataTable`.
- `IGroupChannel[] SetSensors(IGroup groupToAddTo, Dictionary<IGroup, IGroupChannel[]> groupToGroupChannel, DataModel.TestTemplate testSetup)` — Assigns sensors to hardware channels; unassigns previously claimed channels that no longer match. **Returns an empty array** (`newGroupChannels` is never populated).
**Nested Types:**
`CountTags` (enum):
- `DigitalInCount`, `SquibCount`, `AnalogCount`
`Fields` (enum):
- `ChannelName`, `Sensor`, `SensorId`, `Location`, `ChannelHelper`
`ChannelHelper` (class, implements `IComparable<ChannelHelper>`):
- **Constructor:** `ChannelHelper(DTS.SensorDB.SensorData sd, string hchannel, IGroupChannel channel, IGroup group)`
- **Properties:**
- `IGroupChannel Channel` (read-only)
- `IGroup Group` (read-only)
- `string HardwareString` — The hardware channel identifier.
- `string Sensor` — Formatted string with serial number and comment, or "Unknown({SensorId})" if `_sd` is null.
- `string SensorSerialNumber` — Serial number or empty string.
- `string Location` — Hardware string or `StringResources.Table_NA`.
- `string SensorId` — EID from sensor data or internal `_id` field.
- **Methods:**
- `DTS.SensorDB.SensorData GetSensorData()` — Returns the internal `_sd` field.
- `int CompareTo(ChannelHelper rhs)` — Complex comparison logic using `NaturalStringComparer` for hardware strings, with fallback comparisons on sensor data and ID.
---
### AutoDiscoveredDASTable
**Inherits from:** `GenericTable2`
**Constructors:**
- `AutoDiscoveredDASTable(System.Windows.Controls.ContentControl parentControl, DataPROPage page)` — Initializes internal `DataTable`, configures columns per `ColumnIds` enum, adds a template column for configuration selection.
**Methods:**
- `void Clear()` — Clears all rows from `_dt` and reassigns `DataTable`.
- `void Update(DTS.DASLib.Service.IDASCommunication[] das)` — Clears and repopulates the table with DAS device information including serial number, type (localized), status, channel count, and available configurations.
- `void CommitDAS()` — Iterates rows, checks `Included` flag, validates device state (armed status, channel count), and commits to `DataModel.DASHardwareList`. Updates `DASStatus` column with result ("Added", "Updated", "Skipped", "Armed", "NoChannels").
**Private Fields:**
- `System.Data.DataTable _dt` — Internal data table for row storage.
- `volatile bool _bUpdating` — Flag to prevent recursive change handling.
- `static readonly int[] AVAILABLE_SLICE2_MAXMODULES` — Values: `{3, 4, 5, 6}`.
- `static readonly string[] AVAILABLE_SLICE2_CONFIGURATIONS` — Localized strings for MegaSample, 800k, 700k, 600k sample configs.
**Private Methods:**
- `string GetSelectedConfiguration(DTS.DASLib.Service.IDASCommunication das)` — Returns configuration string based on module count for SLICE2_SIM; "MAX" for others.
- `string[] GetAvailableConfigurations(DTS.DASLib.Service.IDASCommunication das)` — Returns `AVAILABLE_SLICE2_CONFIGURATIONS` for SLICE2_SIM; `{"MAX"}` for others.
- `int CalculateMaxModules(int sps)` — Maps sample rate ranges to module counts (unused in visible code).
- `void _dt_ColumnChanged(object sender, System.Data.DataColumnChangeEventArgs e)` — Handles `SelectedConfiguration` changes; reconfigures SLICE2 devices via `IDASReconfigure.SetMaxModuleCount()`.
---
## 3. Invariants
- **ChannelDiscoveryTable** always contains columns defined by the `Fields` enum in the order: `ChannelName`, `Sensor`, `SensorId`, `Location`, `ChannelHelper`.
- **AutoDiscoveredDASTable** always contains columns defined by `ColumnIds` enum; the `Configuration` column uses a WPF template resource named `"selectDASConfigurationCellTemplate"`.
- `SensorId` column is only visible when `_location == DataPROWin7.HardwareDiscovery.Location.TestSetups`.
- `_bUpdating` flag in `AutoDiscoveredDASTable` guards against recursive `ColumnChanged` events during programmatic updates.
- `ChannelHelper.CompareTo` never returns null; handles all null-checking branches explicitly.
- `CountCount()` only counts rows where `DataItem` is a `DataRowView` containing a valid `ChannelHelper` with non-null sensor data.
---
## 4. Dependencies
**ChannelDiscoveryTable imports:**
- `DTS.Common.Classes.Groups`
- `DTS.Common.Enums.Sensors`
- `DTS.Common.Interface.Channels`
- `DTS.Common.Interface.Groups.GroupList`
- `DTS.Common.Storage`
- `DTS.Common.Utilities` (includes `NaturalStringComparer`)
- `DTS.Common.Utilities.Logging`
- `DTS.Common.SharedResource.Strings`
- `DTS.SensorDB.SensorsCollection.SensorsList`
- `C1.WPF.DataGrid` (ComponentOne)
- `System.Data`
**AutoDiscoveredDASTable imports:**
- `DTS.DASLib.Service.IDASCommunication`
- `DTS.DASLib.DASFactory`
- `ISODll.Hardware.HardwareTypes`
- `DataModel.DASHardware`, `DataModel.DASHardwareList`
- `C1.WPF.DataGrid`
- `System.Data`
**Consumers (inferred):**
- `HardwareDiscoveryControl` — Instantiates `ChannelDiscoveryTable`.
- `AutoDetectDASPage` — Referenced in `CommitDAS()` and `_dt_ColumnChanged()` for `RequeryConfig()`.
---
## 5. Gotchas
1. **`GetOnlineSensors()` returns an empty array.** The method creates a `List<DTS.SensorDB.SensorData>` but never adds elements to it before calling `ToArray()`. This appears to be incomplete implementation.
2. **`SetSensors()` returns an empty array.** The `newGroupChannels` list is created but never populated; the method performs side effects (unassigning hardware channels) but returns nothing useful.
3. **`CalculateMaxModules(int sps)` is defined but never called.** Dead code that maps sample rates to module counts.
4. **Commented-out code in `CommitDAS()`.** Lines referencing `DataModel.DASHardwareList.GetList().Replace()` and `.Delete()` are commented out, suggesting incomplete handling of `HardwareTypeChangedException`.
5. **`UpdateChannels` comment uncertainty.** The line `case Fields.ChannelName: row[field.ToString()] = ch.Channel.IsoChannelName; break; //is this right?` contains a developer's uncertainty comment.
6. **Future-breaking change noted.** In `GetOnlineSensors()`, a comment states: *"in the future, when sensors are embedded in a test setup, the below line is one among many that will need to change"*.
7. **Configuration column uses magic resource string.** The template `"selectDASConfigurationCellTemplate"` is loaded from `Application.Current.FindResource()`; failure to define this resource will cause a runtime exception.

View File

@@ -0,0 +1,411 @@
---
source_files:
- DataPRO/DataPRO/Controls/DataExports/DataEmptyExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataSimpleChapter10ExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataHDFExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataSimpleXLSXExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataToyotaExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataSimpleCSVExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataDiademExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataSimpleTSVExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataCSVExportOptions.xaml.cs
- DataPRO/DataPRO/Controls/DataExports/DataROIAwareBase.cs
generated_at: "2026-04-17T15:48:44.469682+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "559e6a183ca3ce90"
---
# Data Export Options Module Documentation
## 1. Purpose
This module provides a collection of WPF `UserControl` derivatives for configuring data export operations in the DataPRO application. Each control represents configuration options for a specific export format (CSV, TSV, XLSX, HDF, Chapter 10, Toyota TDM, Diadem). The module centralizes export validation logic and user input handling through a class hierarchy anchored by `DataROIAwareBase`, which provides shared functionality for exports involving Regions of Interest (ROI) and event-based data selection.
---
## 2. Public Interface
### DataROIAwareBase (Base Class)
**File:** `DataROIAwareBase.cs`
Base class for export options controls that manage Regions of Interest.
```csharp
public class DataROIAwareBase : UserControl, INotifyPropertyChanged, IDataROIAwareBase
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `RegionsOfInterest` | `BindingList<IRegionOfInterest>` | List of ROI periods for export |
| `EventsToDownload` | `BindingList<IDownloadEvent>` | List of events selected for download |
| `DataStart` | `double` | Start time of data range |
| `DataEnd` | `double` | End time of data range |
| `PreTriggerSeconds` | `double` | Pre-trigger time in seconds |
| `PostTriggerSeconds` | `double` | Post-trigger time in seconds |
| `EventsVisibility` | `Visibility` | Controls visibility of events UI |
| `ROIVisibility` | `Visibility` | Controls visibility of ROI UI |
| `AddROIVisibility` | `Visibility` | Controls visibility of add ROI button |
| `ChannelDetailsVisibility` | `Visibility` | Controls visibility of channel details (read-only) |
| `RecordingMode` | `RecordingModes` | Current recording mode |
| `RemoveROICommand` | `RoutedCommand` | Command to remove an ROI |
| `AddROICommand` | `RoutedCommand` | Command to add an ROI |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `SetGroups` | `void SetGroups(ITestSetup testSetup, Dictionary<string, IDASHardware> hardwareLookup)` | Sets up channel groups from test setup |
| `SetTest` | `void SetTest(string path)` | Sets test path for ROI channels VM |
| `SubscribeToROIEvents` | `void SubscribeToROIEvents()` | Subscribes to ROI channel selection events via EventAggregator |
| `UnsubscribeToROIEvents` | `void UnsubscribeToROIEvents()` | Unsubscribes from ROI channel selection events |
| `SetEnabled` | `void SetEnabled(bool bEnable)` | Enables/disables the control (thread-safe) |
| `ValidatePage` | `virtual bool ValidatePage(ref List<string> errors)` | Validates the page; returns true if valid |
**Protected Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `ValidateROISuffix` | `bool ValidateROISuffix(Control roiControl)` | Validates ROI suffixes are unique |
| `ValidateEventSelected` | `bool ValidateEventSelected()` | Validates at least one event is selected |
| `ValidateROIEnabled` | `bool ValidateROIEnabled(Control roiControl)` | Validates at least one ROI is enabled |
---
### DataEmptyExportOptions
**File:** `DataEmptyExportOptions.xaml.cs`
A minimal export options control with no configurable options.
```csharp
public partial class DataEmptyExportOptions : UserControl, INotifyPropertyChanged
```
**Nested Class:**
```csharp
public class DataEmptyExportOption : INotifyPropertyChanged
```
An empty options container with `SetProperty<T>` and `OnPropertyChanged` methods but no properties.
---
### DataSimpleChapter10ExportOptions
**File:** `DataSimpleChapter10ExportOptions.xaml.cs`
Configuration for Chapter 10 format exports.
```csharp
public partial class DataSimpleChapter10ExportOptions : DataROIAwareBase
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `Filtered` | `bool` | `true` | Whether to export filtered data |
| `UnFiltered` | `bool` | `false` | Whether to export unfiltered data |
| `IncludeSecondaryHeader` | `bool` | `true` | Include secondary time header (Time format 1) |
| `UseAnalogFormat` | `bool` | `true` | Use analog format for export |
| `UsePCMFormat` | `bool` | `false` | Use PCM format for export |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `ValidatePage` | `override bool ValidatePage(ref List<string> errors)` | Validates format selection (exactly one of PCM or Analog must be selected) and ROI suffix uniqueness |
---
### DataHDFExportOptions
**File:** `DataHDFExportOptions.xaml.cs`
Configuration for HDF format exports.
```csharp
public partial class DataHDFExportOptions : UserControl, INotifyPropertyChanged
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `ExportADC` | `bool` | `true` | Include ADC values in export |
| `ExportMV` | `bool` | `true` | Include mV values in export |
| `ExportUnfilteredEU` | `bool` | `true` | Include unfiltered EU values in export |
| `IncludeLogs` | `bool` | `true` | Include logs in export |
| `IncludeReports` | `bool` | `true` | Include reports in export |
| `IncludeSetup` | `bool` | `true` | Include setup files in export |
| `IncludeDTSFile` | `bool` | `true` | Include DTS file in export |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `ValidatePage` | `bool ValidatePage(ref List<string> errors)` | Validates at least one of `ExportADC`, `ExportMV`, or `ExportUnfilteredEU` is true |
---
### DataSimpleXLSXExportOptions
**File:** `DataSimpleXLSXExportOptions.xaml.cs`
Configuration for XLSX (Excel) format exports.
```csharp
public partial class DataSimpleXLSXExportOptions : DataROIAwareBase
```
**Nested Enum:**
```csharp
public enum Tags { ExportXLSXUnfiltered, ExportXLSXFiltered }
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ExportXLSXUnfiltered` | `bool` | Export unfiltered data |
| `ExportXLSXFiltered` | `bool` | Export filtered data |
| `ExportHeaders` | `ObservableCollection<IExportHeader>` | Collection of export headers |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `StartSearch` | `void StartSearch(string term)` | Search method (implementation empty in source) |
| `ValidatePage` | `override bool ValidatePage(ref List<string> errors)` | Validates filtered/unfiltered selection, event selection, ROI suffix uniqueness, and at least one ROI enabled |
---
### DataToyotaExportOptions
**File:** `DataToyotaExportOptions.xaml.cs`
Configuration for Toyota TDM format exports.
```csharp
public partial class DataToyotaExportOptions : DataROIAwareBase
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `CurrentOptions` | `DataToyotaExportOption` | Current export configuration |
**Nested Class:**
```csharp
public class DataToyotaExportOption : INotifyPropertyChanged
```
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `SubSample` | `ushort` | `1` | Subsample rate |
| `ROIVisibility` | `Visibility` | `Collapsed` | ROI visibility setting |
| `AddROIVisibility` | `Visibility` | `Collapsed` | Add ROI button visibility |
| `ChannelDetailsVisibility` | `Visibility` | `Collapsed` | Channel details visibility |
| `RecordingMode` | `RecordingModes` | `CircularBuffer` | Recording mode |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `StartSearch` | `void StartSearch(string term)` | Search method (implementation empty in source) |
| `ValidatePage` | `override bool ValidatePage(ref List<string> errors)` | Validates event selection, ROI suffix uniqueness, and at least one ROI enabled |
---
### DataSimpleCSVExportOptions
**File:** `DataSimpleCSVExportOptions.xaml.cs`
Configuration for simple CSV format exports.
```csharp
public partial class DataSimpleCSVExportOptions : DataROIAwareBase, INotifyPropertyChanged
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `ExportCSVUnfiltered` | `bool` | `false` | Export unfiltered data |
| `ExportCSVFiltered` | `bool` | `false` | Export filtered data |
| `ExportCSVMV` | `bool` | `false` | Export mV values |
| `ExportCSVADC` | `bool` | `false` | Export ADC values |
| `ExportHeaders` | `ObservableCollection<IExportHeader>` | Collection of export headers |
| `SubSample` | `ushort` | `1` | Subsample rate |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `StartSearch` | `void StartSearch(string term)` | Search method (implementation empty in source) |
| `ValidatePage` | `override bool ValidatePage(ref List<string> errors)` | Validates at least one export type selected, ROI suffix uniqueness, and at least one ROI enabled |
---
### DataDiademExportOptions
**File:** `DataDiademExportOptions.xaml.cs`
Configuration for Diadem format exports.
```csharp
public partial class DataDiademExportOptions : UserControl, INotifyPropertyChanged
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `DiademChannelName200` | `Settings.EditTestSettings.ExportOptionHelper` | Channel name option (position 200) |
| `DiademUserComment201` | `Settings.EditTestSettings.ExportOptionHelper` | User comment option (position 201) |
| `DiademReserved1_301` | `Settings.EditTestSettings.ExportOptionHelperReserved1` | Reserved field 1 option (position 301) - can be Group Name or AAF Rate |
| `DiademReserved2_302` | `Settings.EditTestSettings.ExportOptionHelperReserved2` | Reserved field 2 option (position 302) - can include Channel Sensitivity |
**Nested Class:**
```csharp
public class DataDiademExportOption : INotifyPropertyChanged
```
Empty options container with `SetProperty<T>` and `OnPropertyChanged` methods but no properties.
**Event Handlers:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `SelectAllText` | `void SelectAllText(object sender, RoutedEventArgs e)` | Selects all text in a TextBox |
| `cmbDiademChannelName200_SelectionChanged` | `void cmbDiademChannelName200_SelectionChanged(object sender, SelectionChangedEventArgs e)` | Handles channel name selection change |
| `cmbDiademUserComment201_SelectionChanged` | `void cmbDiademUserComment201_SelectionChanged(object sender, SelectionChangedEventArgs e)` | Handles user comment selection change |
| `cmbDiademReserved1_301_SelectionChanged` | `void cmbDiademReserved1_301_SelectionChanged(object sender, SelectionChangedEventArgs e)` | Handles reserved field 1 selection change |
| `cmbDiademReserved2_302_SelectionChanged` | `void cmbDiademReserved2_302_SelectionChanged(object sender, SelectionChangedEventArgs e)` | Handles reserved field 2 selection change |
---
### DataSimpleTSVExportOptions
**File:** `DataSimpleTSVExportOptions.xaml.cs`
Configuration for TSV (Tab-Separated Values) format exports.
```csharp
public partial class DataSimpleTSVExportOptions : DataROIAwareBase
```
**Constants:**
| Constant | Type | Value | Description |
|----------|------|-------|-------------|
| `MAX_SUPPORTED_SAMPLES` | `double` | `2000000000` | Maximum samples for filtered export (arbitrary limit for memory constraints) |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ExportTSVUnfiltered` | `bool` | Export unfiltered data |
| `ExportTSVFiltered` | `bool` | Export filtered data |
| `SubSample` | `ushort` | Subsample rate |
| `SPS` | `double` | Samples per second (for size calculation) |
| `ActualStartSeconds` | `double` | Start time for filtered all export |
| `ActualEndSeconds` | `double` | End time for filtered all export |
| `NumberOfChannels` | `int` | Channel count for size calculation |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `StartSearch` | `void StartSearch(string term)` | Search method (implementation empty in source) |
| `ValidatePage` | `override bool ValidatePage(ref List<string> errors)` | Validates filtered/unfiltered selection, event selection, ROI suffix uniqueness, ROI enabled, and export size limit for filtered exports |
---
### DataCSVExportOptions
**File:** `DataCSVExportOptions.xaml.cs`
Configuration for advanced CSV format exports with column ordering.
```csharp
public partial class DataCSVExportOptions : UserControl, INotifyPropertyChanged
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `CurrentOptions` | `DataCSVExportOption` | Current export configuration |
| `ColumnOrderHeight` | `GridLength` | Height for column order UI (always returns `Auto`) |
**Nested Class:**
```csharp
public class DataCSVExportOption : INotifyPropertyChanged
```
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `IndividualFiles` | `bool` | `false` | Export to individual files |
| `IncludeFieldHeaders` | `bool` | `true` | Include field headers in export |
| `FieldSeparator` | `string` | `","` | Field separator character |
| `CustomColumnOrder` | `bool` | `false` | Enable custom column ordering |
| `IncludedFields` | `object[]` | Array of included field objects |
| `IncludedColumns` | `string[]` | Array of included column names |
| `AvailableColumns` | `string[]` | Array of available column names |
| `Name` | `string` | `"new setting options"` | Setting name |
| `FileName` | `string` | `"DataDB.csv"` | Output filename |
| `Folder` | `string` | `""` | Output folder path |
| `CustomColumnOrderVisibility` | `Visibility` | Visibility based on `CustomColumnOrder` |
| `ColumnOrderHeight` | `GridLength` | Height based on `CustomColumnOrder` |
| `FilenameVisibility` | `Visibility` | Collapsed if `IndividualFiles` is true |
**Methods (DataCSVExportOption):**
| Method | Signature | Description |
|--------|-----------|-------------|
| `RemoveAll` | `void RemoveAll()` | Moves all columns from included to available |
| `Remove` | `void Remove(List<int> indices)` | Removes specified columns from included list |
| `Add` | `void Add(List<int> indices)` | Adds specified columns to included list |
**Event Handlers:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `btnInclude_Click` | `void btnInclude_Click(object sender, RoutedEventArgs e)` | Include button handler (implementation commented out) |
| `btnRemove_Click` | `void btnRemove_Click(object sender, RoutedEventArgs e)` | Remove button handler (implementation commented out) |
| `btnRemoveAll_Click` | `void btnRemoveAll_Click(object sender, RoutedEventArgs e)` | Remove all button handler (implementation commented out) |
| `btnFolderBrowse_Click` | `void btnFolderBrowse_Click(object sender, RoutedEventArgs e)` | Opens folder browser dialog |
---
### IDataROIAwareBase (Interface)
**File:** `DataROIAwareBase.cs`
Interface defining the contract for ROI-aware export controls.
```csharp
public interface IDataROIAwareBase
```
Defines all public members of `DataROIAwareBase` class (see above for full member list).
---
## 3. Invariants
### Validation Rules
1. **DataSimpleChapter10ExportOptions:** Exactly one of `UsePCMFormat` or `UseAnalogFormat` must be `true`. Both cannot be true, and both cannot be false.
2. **DataHDFExportOptions:** At least one of `ExportADC`, `ExportMV`, or `ExportUnfilteredEU` must be `true`.
3. **DataSimpleXLSXExportOptions:** At least one of `ExportXLSXUnfiltered` or `ExportXLSXFiltered` must be `true`.
4. **DataSimpleCSVExportOptions:** At least one of `ExportCSVUnfiltered`, `ExportCSVFiltered`, `ExportCSVMV`, or `ExportCSVADC` must be `true`.
5. **DataSimpleTSVExportOptions:** At least one of `ExportTSVUnfiltered` or `ExportTSVFiltered` must be `true`. Additionally, filtered exports must not exceed `MAX_SUPPORTED_SAMPLES` (2 billion samples).
6. **ROI Suffix Uniqueness:** All ROI suffixes in `RegionsOfInterest` must be unique (validated via `ValidateROISuffix`).
7. **ROI Enabled:** When ROI visibility is visible, at least one ROI must have `IsEnabled == true` (validated via `ValidateROIEnabled`).
8. **Event Selection:** When events are used, at least one event in `EventsToDownload` must have `IsEnabled == true` (validated via `ValidateEventSelected`).
### Property Change Notification
- All classes implementing `INotifyPropertyChanged` use a `SetProperty<T>` method that checks for equality before raising `PropertyChanged`.
- Two implementation patterns exist: null-conditional operator (`?.Invoke`) and null-check with local variable capture.
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Purpose |
|-----------|---------|
| `System.Windows.Controls` | WPF UserControl base class |
| `System.ComponentModel` | `INotifyPropertyChanged` interface |
| `DTS.Common.SharedResource.Strings` | Localized string resources (`StringResources`) |
| `DTS.Common.Interface.ExportData` | `IExportHeader` interface |
| `DTS.Common.Enums` | `RecordingModes` enum |
| `DTS.Common.Classes.TestSetups` | `ITestSetup` interface |
| `DTS.Common.Events.RegionOfInterest` | `RegionOfInterestChannelsSelectedEvent` |
| `DTS.Common.Interface.DataRecorders` | `IDASHardware` interface |
| `DTS.Common.Interface.DownloadEvent` | `IDownloadEvent` interface |
| `DTS.Common.Interface.RegionOfInterest` | `IRegionOfInterest` interface |
| `DTS.Common.Interface.TestSetups.TestSetupsList` | Test setup interfaces |
| `DTS.Common.Utilities.Logging` | `APILogger` for exception logging

View File

@@ -0,0 +1,67 @@
---
source_files:
- DataPRO/DataPRO/Controls/Downloads/SimpleDownloadOptions.xaml.cs
generated_at: "2026-04-17T15:59:49.852280+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0e1d27b067d2cea1"
---
# Documentation: SimpleDownloadOptions
## 1. Purpose
`SimpleDownloadOptions` is a WPF `UserControl` that provides a UI for configuring download options for recorded data. It manages Regions of Interest (ROI), download events, and validates download parameters against recording mode constraints. The control serves as the configuration interface for users to define what data to download, which time regions to include, and which channels to capture, while enforcing business rules specific to different recording modes (CircularBuffer, Recorder, Active, etc.).
---
## 2. Public Interface
### Methods
| Signature | Description |
|-----------|-------------|
| `void SetEnabled(bool bEnable)` | Enables or disables the control. Uses `Dispatcher.BeginInvoke` for thread-safe access if called from a non-UI thread. Returns early if `((App)Application.Current).CurrentUser` is null. |
| `void SetParent(object o)` | Delegates to `_roiChannelsVm.SetParent(o)` if the ROI channels ViewModel is initialized. |
| `void StartSearch(string term)` | Triggers filtering on the ROI channels ViewModel via `_roiChannelsVm.Filter(term)`. |
| `bool ValidatePage(double PreTriggerSeconds, double PostTriggerSeconds, RecordingModes recordingMode, ref List<string> errors)` | Validates ROI configuration and channel assignments. Returns `true` if valid; appends error messages to the `errors` list. |
| `void ClearView()` | Resets all UI state: clears `RegionsOfInterest`, `EventsToDownload`, resets timing values to 0, sets `RecordingMode` to `CircularBuffer`, and collapses visibility flags. |
| `void Initialize(double dataStart, double dataEnd, double preTrigger, double postTrigger, RecordingModes recordingMode, BindingList<IRegionOfInterest> regionsOfInterest, BindingList<IDownloadEvent> eventsToDownload, Dictionary<string, IDASHardware> hardwareLookup, TestTemplate testTemplate, IReadOnlyDictionary<int, double> eventLengthByIndex)` | Populates the control with download configuration data. Calculates aggregate sample rate, populates event lengths, and initializes the ROI channels ViewModel. |
### Properties
| Type | Name | Access | Description |
|------|------|--------|-------------|
| `Visibility` | `RoiVisibility` | get/set | Controls visibility of ROI section. Backed by `_roiVisibility`, default is `Collapsed`. |
| `Visibility` | `EventDetailsVisibility` | get/set | Controls visibility of event details section. Default is `Collapsed`. |
| `Visibility` | `DataDetailsVisibility` | get | Visibility for data details section. Default is `Collapsed`. |
| `Visibility` | `ChannelDetailsVisibility` | get | Visibility for channel details section. Becomes `Visible` when `RegionsOfInterest.Count > 1`. |
| `string` | `DownloadPath` | get | Full path to download folder, derived from `Properties.Settings.Default.DownloadFolder`. |
| `double` | `DataStart` | get | Start time of data range. |
| `double` | `DataEnd` | get | End time of data range. |
| `double` | `PreTriggerSeconds` | get | Pre-trigger duration in seconds. |
| `double` | `PostTriggerSeconds` | get | Post-trigger duration in seconds. |
| `double` | `SampleRateAggregate` | get | Aggregate sample rate across DAS units. Set to `double.NaN` if rates differ. |
| `string` | `SPSText` | get | Formatted sample rate string; returns localized "Multiple Sample Rates" text if `SampleRateAggregate` is `NaN`. |
| `RecordingModes` | `RecordingMode` | get | Current recording mode. |
| `BindingList<IRegionOfInterest>` | `RegionsOfInterest` | get | Collection of ROI definitions. |
| `BindingList<IDownloadEvent>` | `EventsToDownload` | get | Collection of events selected for download. |
| `RoutedCommand` | `AddROICommand` | get/set | Command to add a new ROI period. |
| `RoutedCommand` | `RemoveROICommand` | get/set | Command to remove an ROI period. |
### Events
| Event | Description |
|-------|-------------|
| `PropertyChangedEventHandler PropertyChanged` | Standard `INotifyPropertyChanged` implementation for data binding. |
---
## 3. Invariants
### ROI Validation Rules (enforced in `ValidateROIControl`)
1. **Unique Suffixes**: All ROI items must have unique `Suffix` values. Grouping by suffix and counting must equal total count.
2. **At Least One Enabled ROI**: `RegionsOfInterest` must contain at least one item where `IsEnabled == true`.
3. **Valid Region Bounds**: For each enabled ROI, `Start` must not equal `End`, and `Start` must not be greater than `End`.
4. **Channel Assignment for Multiple ROIs**: When `RegionsOfInterest.Count > 1`, each enabled

View File

@@ -0,0 +1,114 @@
---
source_files:
- DataPRO/DataPRO/Controls/Sensors and models/SensorCS3ImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorTDMCSVImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorToyotaImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorEQXImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorTHFDatabaseFileImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SIFImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorMODSensorFileImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorXMLImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/BoolConditionalEditor.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/DoubleConditionalEditor.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/StringConditionalEditor.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/ModelDataBaseControl.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/BulkEdit.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/ParseImportFactory.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorCSVImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/IFilterConditionalEditor.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/ImportSensorModelsControl.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SampleRateAAFilterLookup.cs
- DataPRO/DataPRO/Controls/Sensors and models/TDCSensorDatabaseImportOptions.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/OverdueSensorsTable.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorTestHistoryControl.xaml.cs
generated_at: "2026-04-17T15:44:44.167906+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c0ff157bc2138ee0"
---
# Documentation: Sensor Import and Model Controls
## 1. Purpose
This module provides the WPF user interface components and supporting logic for managing sensor data import configurations and model databases within the DataPRO application. It encompasses specialized `UserControl` classes for defining import options for various file formats (CSV, XML, EQX, Toyota, etc.), custom property editors for the Xceed PropertyGrid to handle "mixed" values during bulk editing, and factory/helper classes for parsing imports and looking up hardware-specific settings like anti-aliasing filters.
## 2. Public Interface
### Import Options Controls
These controls manage configuration for specific data sources. They all implement `INotifyPropertyChanged` and expose a `CurrentOptions` property.
* **`SensorCS3ImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.CS3ImportOptions`.
* **`SensorTDMCSVImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.TDMCSVImportOptions`.
* **`SensorToyotaImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.ToyotaImportOptions`.
* **`SensorEQXImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.EQXImportOptions`.
* **`SensorTHFDatabaseFileImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.THFDatabaseImportOptions`.
* **`SensorMODSensorFileImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.MODFileImportOptions`.
* **`SensorXMLImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.XMLImportOptions`.
* `Update()`: Updates the visibility of `PanelSensorFirstUseDate` based on `Common.SerializedSettings.UseSensorFirstUseDate`.
* **`SIFImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.SIFSensorDatabaseImportOptions`.
* **`TDCSensorDatabaseImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.TDCSensorDatabaseImportOptions`.
* `AvailableImportCultures`: Returns `CultureHelper[]` containing all system cultures.
* `StripBackslash`: Gets or sets a boolean determining if TDC serial numbers are sanitized during import.
* **`SensorCSVImportOptions`**
* `CurrentOptions`: Property of type `ImportSensorsOptionsControl.CSVImportOptions`.
* `btnInclude_Click`, `btnRemove_Click`, `btnRemoveAll_Click`: Event handlers that modify the `CurrentOptions` based on user selection in list views.
### Conditional Property Editors
These controls implement `Xceed.Wpf.Toolkit.PropertyGrid.Editors.ITypeEditor` to handle properties that may have mixed values (null) or specific values.
* **`BoolConditionalEditor`**
* `Value`: `DependencyProperty` of type `bool?`.
* `ResolveEditor(PropertyItem)`: Binds the control to the property grid item.
* **`DoubleConditional`**
* `Value`: `DependencyProperty` of type `double?`.
* `ResolveEditor(PropertyItem)`: Binds the control to the property grid item.
* **`StringConditionalEditor`**
* `Value`: `DependencyProperty` of type `string`.
* `ResolveEditor(PropertyItem)`: Binds the control to the property grid item.
* **`IFilterConditionalEditor`**
* `Value`: `DependencyProperty` of type `IFilterClass`.
* `AllFilterClasses`: Property returning an array of predefined `IFilterClass` objects (None, Unfiltered, CFC10, CFC60, CFC180, CFC1000).
* `ResolveEditor(PropertyItem)`: Binds the control to the property grid item.
### Core Logic and Container Controls
* **`ParseImportFactory`** (Static Class)
* `CreateParseImport(SupportedExportFormats importFormat, IImportNotification importNotification, User currentUser, ImportOptions importOptions)`: Returns an `IParseImport` instance. Supports `EQX`, `CSV`, and `TDCSensorDatabase` formats.
* **`SampleRateAAFilterLookup`**
* `ContainsKey(DAS_TYPE, uint)` / `ContainsKey(IDASCommunication, uint)`: Checks if a sample rate exists in the settings.
* `GetClosestKey(...)`: Returns the nearest valid sample rate key equal to or greater than the input.
* `GetExact(...)`: Retrieves the exact AA filter value for a given sample rate.
* **`ModelDatabaseControl`**
* Implements `IPageContent`.
* `BridgeUpdated()`: Propagates updates to the internal `EditModelControl`.
* `Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)`: Validates the internal model control.
* **`BulkEdit`**
* Implements `IPageContent`, `INotifyPropertyChanged`.
* `SensorAggregate`: Property of type `ISensorAggregate`. When set, it updates the `SelectedObject` of `gridProperties`.
* **`OverdueSensorsTable`** (Inherits `GenericTable2`)
* `UpdateTable(OverdueSensorHelper[] entries)`: Populates the table with sensor calibration data and sets control visibility based on row count.
* `UnSet()`: Clears all rows from the table.
* **`SensorTestHistoryControl`**
* Implements `IPageContent`, `INotifyPropertyChanged`.
* `Histories`: Array of `DTS.Common.Storage.SensorTestHistory`.
* `DisplaySensorTestHistory(string serialNumber)`: Loads history for a specific sensor.
* `ExportFilePath`: Path for XML export.
* **`ImportSensorModelsControl`**
* Implements `IPageContent`, `INotifyPropertyChanged`.
* `btnBrowse_Click`: Opens a file dialog to select import files (`.e2x`, `.sif`, `.xml`).
## 3. Invariants
* **Property Change Notification**: All `SetProperty` implementations across the module follow the pattern: if the new value equals the existing value, the method returns `false` and no `PropertyChanged` event is raised. If the value changes, the event is raised.
* **Conditional Editor State**: For `BoolConditionalEditor`, `DoubleConditional`, and `StringConditionalEditor`, a `null` `Value` represents a "Mixed" state, causing a button to be displayed. A non-null value displays the actual editor control (CheckBox, TextBox).
* **SampleRateAAFilterLookup Construction**: The `SampleRateAAFilterLookup` constructor throws a generic `Exception` if `Common.SerializedSettings.AvailableSampleRates` is empty or null.
* **OverdueSensorsTable Visibility**: The `UpdateTable` method guarantees that the control's visibility is set to `Visible

View File

@@ -0,0 +1,163 @@
---
source_files:
- DataPRO/DataPRO/Controls/Sensors and models/Classes/SensorDatabaseLocking.cs
- DataPRO/DataPRO/Controls/Sensors and models/Classes/EQXImporter.cs
- DataPRO/DataPRO/Controls/Sensors and models/Classes/CSVImporter.cs
generated_at: "2026-04-17T15:53:26.766026+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8325d6897e1c5433"
---
# Documentation: Sensor Import and Locking Classes
## 1. Purpose
### SensorDatabaseLocking.cs
This internal helper class provides thread-safe lock management for sensor database items. It serves as an abstraction layer between `SensorDatabaseControl` and the `LockManager`, tracking owned locks and providing operations to acquire, update, release, and query lock status. Per the source comments, this class is intended to be temporary and should eventually be removed from UI code.
### EQXImporter.cs
This class implements the `SensorTestSetupImporter` abstract base class to provide EQX (Equipment Exchange) format file import functionality. It parses XML-based EQX sensor database files, validates version compatibility (up to v1.5), extracts sensor data and calibrations, and handles both sensor imports and test setup imports.
### CSVImporter.cs
This class implements the `SensorTestSetupImporter` abstract base class to provide CSV format file import functionality. It parses CSV sensor database files with support for multiple format versions, extracts sensor data and calibrations, and handles both sensor imports and test setup imports with extensive validation.
---
## 2. Public Interface
### SensorDatabaseLocking
| Method | Signature | Description |
|--------|-----------|-------------|
| `LockItem` | `public static bool LockItem(string serialNumber, int databaseId, string userName, int userId, out LockRecord lockRecord, out LockError lockError)` | Locks a sensor item. Delegates to `LockManager.LockItem` with `LockManager.ItemCategories.Sensor`. Returns `true` if successful. |
| `SetLockedItems` | `public void SetLockedItems(LockRecord[] locks)` | Thread-safe setter for the internal `_existingLocks` array. Uses lock on `MyLock`. |
| `IsExpiredLock` | `public static bool IsExpiredLock(LockRecord lockRecord, string userName, string machineName)` | Returns `true` if lock is expired (based on `StrandedLockTimeoutMinutes` setting) OR if current user/machine owns the lock. |
| `HasAnyLocks` | `public bool HasAnyLocks()` | Returns `true` if there are any tracked locks. Thread-safe. |
| `UpdateLocks` | `public bool UpdateLocks(string userName, int userId, out LockError[] lockErrors, out LockRecord[] failingLocks)` | Updates all tracked locks. Returns `true` if all updates succeed; `false` otherwise with error details. |
| `IsLocked` | `public bool IsLocked(LockRecord lockRecord)` | Returns `true` if the specified record is in the tracked locks collection. |
| `FreeLocks` | `public void FreeLocks(string userName, int userId)` | Releases all tracked locks. Clears `_existingLocks` and calls `LockManager.FreeLock` for each. Exceptions are logged but not re-thrown. |
| `GetLockRecords` | `public LockRecord[] GetLockRecords()` | Returns a copy of the tracked locks array. Never returns `null`; returns empty array if no locks. |
### EQXImporter
| Method | Signature | Description |
|--------|-----------|-------------|
| Constructor 1 | `public EQXImporter(Action<List<string>> errorReport, IEnumerable<string> filenames, ImportPageType importPageType, ImportSensorsOptionsControl.ImportOptions importOptions, List<TestTemplate> testSetups, List<DataModel.TestObject> groups, Dictionary<string, List<SensorCalibration>> calibrationLookup, Dictionary<string, SensorData> sensors)` | Initializes with lookup dictionaries for sensors and calibrations. |
| Constructor 2 | `public EQXImporter(Action<List<string>> errorReport, IEnumerable<string> filenames, ImportPageType importPageType, ImportSensorsOptionsControl.ImportOptions importOptions, List<TestTemplate> testSetups, List<DataModel.TestObject> groups, List<SensorCalibration> calibrationList, List<SensorData> sensorList, List<DataModel.TestObjectTemplate> groupTemplates, List<MMEPossibleChannels> customChannels, List<MMEPositions> positions, List<MMEPhysicalDimensions> physicalDimensions, List<MMETransducerMainLocation> mainLocs, List<MMEFineLocations3> fineLoc3S, List<MMEFineLocations2> fineLoc2S, List<MMEFineLocations1> fineLoc1S, List<MMEFilterClasses> filterClasses, List<MMEDirections> directions, List<MMETestObjects> testObjects, List<IGroup> igroups)` | Initializes with full MME configuration lists. |
| `Options` | `protected override ImportSensorsOptionsControl.ImportOptions Options { get; set; }` | Returns `EQXImportOptions` instance. Defaults to new instance if `_eqxOptions` is `null`. |
| `ParseTestSetup` | `protected override TestSetupImportData ParseTestSetup(string filename)` | Creates `TestSetupImportData` using `UserSettings` defaults. Does not parse EQX-specific test setup data. |
| `ParseSensor` | `protected override SensorImportData ParseSensor(string filename)` | Parses EQX XML file, validates version, extracts sensors and calibrations via `EQXSensorDatabase`. Handles EID preservation for null ID modules. |
| `GetExcitationErrors` | `private List<string> GetExcitationErrors()` | Validates excitation settings for imported sensors. Returns list of errors for unsupported or missing excitation. |
### CSVImporter
| Method | Signature | Description |
|--------|-----------|-------------|
| Constructor 1 | `public CSVImporter(Action<List<string>> errorReport, IEnumerable<string> filenames, ImportPageType importPageType, ImportSensorsOptionsControl.ImportOptions importOptions, List<TestTemplate> testSetups, List<DataModel.TestObject> groups, Dictionary<string, List<SensorCalibration>> calibrationLookup, Dictionary<string, SensorData> sensors)` | Initializes with lookup dictionaries. Creates `CalibrationImport` and `ImportNotification` instances. |
| Constructor 2 | `public CSVImporter(Action<List<string>> errorReport, IEnumerable<string> filenames, ImportPageType importPageType, ImportSensorsOptionsControl.ImportOptions importOptions, List<TestTemplate> testSetups, List<DataModel.TestObject> groups, List<SensorCalibration> calibrationList, List<SensorData> sensorList, List<TestObjectTemplate> groupTemplates, List<MMEPossibleChannels> customChannels, List<MMEPositions> positions, List<MMEPhysicalDimensions> physicalDimensions, List<MMETransducerMainLocation> mainLocs, List<MMEFineLocations3> fineLoc3S, List<MMEFineLocations2> fineLoc2S, List<MMEFineLocations1> fineLoc1S, List<MMEFilterClasses> filterClasses, List<MMEDirections> directions, List<MMETestObjects> testObjects, List<IGroup> igroups)` | Initializes with full MME configuration lists. |
| `Options` | `protected override ImportSensorsOptionsControl.ImportOptions Options { get; set; }` | Returns `TDCSensorDatabaseImportOptions` instance. |
| `ParseTestSetup` | `protected override TestSetupImportData ParseTestSetup(string filename)` | Parses CSV file header to extract version info using `CSVTestParserFactory`. Supports version 6 with multiple parsers. |
| `ParseSensor` | `protected override SensorImportData ParseSensor(string filename)` | Parses CSV sensor data, handles column mapping via `CSVImportTags`, populates sensors and calibrations. Returns lookup dictionaries for groups and channels. |
| `PopulateSensor` | `private bool PopulateSensor(IReadOnlyList<CSVImportTags.Tags> columns, string[] tokens, DateTime fileDateTime, ParseParameters pp)` | Processes a single CSV row into sensor and calibration data. Returns `true` if no errors. |
| `Parse` | `private void Parse(CSVImportTags.Tags tag, string sValue, ParseParameters pp, IReadOnlyDictionary<int, IParseCSVSensor> parsers)` | Delegates tag parsing to version-specific parser. |
| `PreParse` | `private void PreParse(ParseParameters pp)` | Initializes sensor with squib and digital output defaults. |
| `PostParse` | `private void PostParse(ParseParameters pp)` | Finalizes calibration data, handles IRTracc sensors, validates sensitivity and excitation. |
---
## 3. Invariants
### SensorDatabaseLocking
- `_existingLocks` is always accessed within a lock on `MyLock` for thread safety.
- `GetLockRecords()` never returns `null`; returns empty array when no locks exist.
- `FreeLocks()` clears `_existingLocks` to an empty array (`new LockRecord[0]`), not `null`.
- `UpdateLocks()` returns `false` if `_existingLocks` is `null`.
- Lock expiration is determined by `Properties.Settings.Default.StrandedLockTimeoutMinutes`.
### EQXImporter
- `MAX_EQX_VERSION_SUPPORT` is `1.5F`; files with higher versions are rejected.
- `Options` property always returns `EQXImportOptions`; throws `InvalidCastException` if wrong type.
- `_db` (`EQXSensorDatabase`) is instantiated during `ParseSensor` and used for all sensor/calibration extraction.
- When `ImportPageType.ImportSensor`, sensors are added via `AddSensor()`; when `ImportPageType.ImportTestSetup`, data populates lookup dictionaries.
### CSVImporter
- `Options` property always returns `TDCSensorDatabaseImportOptions`.
- CSV version 6 triggers multi-parser processing; other versions use single parser.
- `PopulateSensor` returns `true` only when `pp.Errors.Count == 0`.
- Sensors with serial numbers starting with `ISO_CH_ONLY_PREFIX` skip calibration lookup population.
- Sensitivity units `SensUnits.mVperVperEU` are automatically converted to `SensUnits.mVperEU` for non-proportional calibrations.
---
## 4. Dependencies
### SensorDatabaseLocking
**Depends on:**
- `DTS.Common.Classes.Locking` - `LockManager`, `LockRecord`, `LockError`
- `DTS.Common.Storage` - `Properties.Settings.Default.StrandedLockTimeoutMinutes`
- `DTS.Common.Utilities.Logging` - `APILogger.Log(Exception)`
**Depended on by:**
- `SensorDatabaseControl` (per source comments)
### EQXImporter
**Depends on:**
- `DataPROWin7.Common` - `UserSettings`, `App`
- `DataPROWin7.DataModel` - `TestTemplate`, `TestObject`, `TestObjectTemplate`
- `DTS.Common.SharedResource.Strings` - `StringResources`
- `DTS.Common.Enums` - `BridgeType`, `ExcitationVoltageOptions`, `SensorInformationFile`, `NonLinearStyles`
- `DTS.SensorDB` - `SensorData`, `SensorCalibration`
- `DTS.Common.Utilities.Logging` - `APILogger`
- `Prism.Ioc` - `ContainerLocator`
- `Prism.Events` - `IEventAggregator`
- `DTS.Common.Events` - `PageErrorEvent`, `PageErrorArg`
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`
- `DTS.Common.ISO` - ISO-related types
- `DTS.Common.Classes` - `FactorySensorModel`
- `EquipmentExchange.EQXSensorDatabase` (external assembly)
- `ImportSensorsOptionsControl.EQXImportOptions` (UI control)
**Depended on by:**
- Unclear from source alone; likely sensor import workflow/UI
### CSVImporter
**Depends on:**
- `DataPROWin7.DataModel` - `TestTemplate`, `TestObject`, `TestObjectTemplate`
- `DTS.Common.SharedResource.Strings` - `StringResources`
- `DTS.Common.Classes.Sensors` - Sensor-related classes
- `DTS.Common.Enums` - `BridgeType`, `ExcitationVoltageOptions`, `SensUnits`, `InitialOffsetTypes`, `ZeroMethod`, `NonLinearStyles`
- `DTS.Common.Enums.Sensors` - `SensorConstants.ISO_CH_ONLY_PREFIX`
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`
- `DTS.Common.ISO` - ISO-related types
- `DTS.SensorDB` - `SensorData`, `SensorCalibration`
- `DTS.Common.Classes` - Common classes
- `DTS.Common.DataModel` - Data model types
- `DTS.Common.Utilities.Logging` - `APILogger`
- `DTS.Common.Import.Factories` - `CSVTestParserFactory`, `CSVSensorParserFactory`
- `DTS.Common.Import.Interfaces` - `IParseCSVSensor`, `ICalibrationImport`, `IImportNotification`
- `DTS.Common.Import` - `CsvUtil`, `SensorDatabaseExport`, `ParseParameters`
- `DTS.Common.Import.ImportOptions` - Import option types
- `ImportSensorsOptionsControl.TDCSensorDatabaseImportOptions` (UI control)
**Depended on by:**
- Unclear from source alone; likely sensor import workflow/UI
---
## 5. Gotchas
### SensorDatabaseLocking
- **Tech Debt:** Per source comments, this class is explicitly marked as temporary and should be removed from UI code. It was abstracted from `SensorDatabaseControl` for easier modification.
- **Silent Failure:** `FreeLocks()` catches and logs exceptions without re-throwing; lock release failures may go unnoticed by callers.
- **Static Lock Object:** `MyLock` is static, meaning all instances share the same lock for `_existingLocks` access, even though `_existingLocks` is an instance field.
### EQXImporter
- **Version Check:** Files with `DataFormatEdition > 1.5` are rejected with an error; this is a hard limit.
- **EID Preservation:** Special handling exists for sensors with null `IDModuleString` - the code attempts to preserve existing EID from the database (FB 18467).
- **Excitation Validation:** `GetExcitationErrors()` only validates for non-digital bridge types; `DigitalInput`, `SQUIB`, and `TOMDigital` are skipped.
- **Progress Reporting:** Progress is only updated every 10 sensors (`if (0 == _currentDone % 10)`).
- **Event Aggregator:** Uses `ContainerLocator.Container.Resolve<IEventAggregator>()` with try/catch that silently ignores resolution failures.
### CSVImporter
- **Sensitivity Unit Conversion:** Non-proportional calibrations

View File

@@ -0,0 +1,58 @@
---
source_files:
- DataPRO/DataPRO/Controls/Sensors and models/Interfaces/ISensorTestSetupImporter.cs
generated_at: "2026-04-17T16:46:06.399707+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "cdf311972cfefe04"
---
# Documentation: ISensorTestSetupImporter Interface
## 1. Purpose
The `ISensorTestSetupImporter` interface defines a contract for importing sensor test setups into the DataPRO system. It exists to abstract the import process, allowing different implementations to handle sensor and model imports while providing consistent progress reporting, error handling, and UI feedback through delegate callbacks. The interface follows a template method pattern, as noted in the source comment referencing "FB 30357."
## 2. Public Interface
### `ISensorTestSetupImporter` Interface
**Namespace:** `DataPROWin7.Controls.Sensors_and_models.Interfaces`
#### Method: `Process`
```csharp
void Process(
SetStatusTextDelegate SetStatus,
SetProgressValueDelegate SetProgressValue,
AddSensorDelegate AddSensor,
AddModelDelegate AddModel,
Action<List<string>> ReportErrors,
ImportDoneDelegate MarkDone,
ref Tuple<bool, string> fileInUse);
```
**Behavior:** Executes the import process for sensor test setups. Implementations are expected to:
- Report status updates via `SetStatus`
- Report progress via `SetProgressValue`
- Add imported sensors via `AddSensor`
- Add imported models via `AddModel`
- Report any errors via `ReportErrors`
- Signal completion via `MarkDone`
- Communicate file-in-use status via the `fileInUse` tuple parameter
**Parameters:**
| Parameter | Type | Description |
|-----------|------|-------------|
| `SetStatus` | `SetStatusTextDelegate` | Callback to update status text in the UI |
| `SetProgressValue` | `SetProgressValueDelegate` | Callback to update progress indicator |
| `AddSensor` | `AddSensorDelegate` | Callback to add a sensor to the import |
| `AddModel` | `AddModelDelegate` | Callback to add a model to the import |
| `ReportErrors` | `Action<List<string>>` | Callback to report a list of error messages |
| `MarkDone` | `ImportDoneDelegate` | Callback to signal import completion |
| `fileInUse` | `ref Tuple<bool, string>` | Reference parameter indicating file lock status; the boolean indicates whether a file is in use, the string likely contains the file path or related message |
## 3. Invariants
- The `fileInUse` parameter is passed by reference, implying that implementers must populate or modify this value during processing.
- All delegate types (`SetStatusTextDelegate`, `SetProgressValueDelegate`, `AddSensorDelegate`, `AddModelDelegate`, `ImportDoneDelegate`) are expected to be non-null when passed to `Process`, though this is not enforced at the interface

View File

@@ -0,0 +1,193 @@
---
source_files:
- DataPRO/DataPRO/Controls/Sensors and models/SensorInputControls/EditStreamInputControl.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorInputControls/SupportedExcitationControl.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorInputControls/EditDigitalOutputControl.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorInputControls/InitialOffsetControl.xaml.cs
- DataPRO/DataPRO/Controls/Sensors and models/SensorInputControls/EditUartSettingsControl.xaml.cs
generated_at: "2026-04-17T15:49:07.341149+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "dcc75abdb57a34e3"
---
# Sensor Input Controls Documentation
## 1. Purpose
This module contains a collection of WPF `UserControl` components for configuring various sensor input and output settings within the DataPRO application. These controls provide UI elements for editing stream inputs (UDP), digital outputs, UART communication parameters, excitation voltage options, and initial offset configurations. Each control implements `INotifyPropertyChanged` for data binding and integrates with a parent `DataPROPage` to track modification state. The controls serve as the presentation layer for sensor configuration data stored in `DTS.SensorDB.SensorData` and related model classes.
---
## 2. Public Interface
### EditStreamInputControl
**Properties:**
- `DataPROPage Page` (set-only) - Assigns the parent page for modification tracking.
- `DTS.SensorDB.SensorData Setting` (get/set) - The sensor data model being edited. Setting this triggers property change notifications for all `Tags` enum values.
- `string UDPAddress` (get/set) - Gets or sets `_setting.StreamInUDPAddress`.
- `string SettingName` (get/set) - Gets or sets `_setting.SerialNumber`.
- `string UserTags` (get/set) - Comma-separated tag string; uses `DbOperations.TagsGet`, `DbOperations.TagsGetId`, `DbOperations.TagsInsert` for persistence.
**Methods:**
- `bool Validate(ref List<string> errors, bool displayWindow)` - Validates that `SettingName` is not empty/whitespace and that `UDPAddress` is valid via `Utils.ValidateUDPAddress()`. Returns `true` if valid.
**Events:**
- `event PropertyChangedEventHandler PropertyChanged` - Standard INPC implementation.
---
### SupportedExcitationControl
**Properties:**
- `DataPROPage Page` (set-only) - Assigns the parent page for modification tracking.
- `DTS.SensorDB.SensorBase Model` (set-only) - Sets the sensor model and initializes `SupportedExcitations` from `value.SupportedExcitation`.
- `List<ExcitationVoltageOptions.ExcitationVoltageOption> SupportedExcitations` (get/set) - List of supported excitation voltages; setter updates `SupportedExcitation_2V`, `SupportedExcitation_5V`, `SupportedExcitation_10V`.
- `bool SupportedExcitation_2V` (get/set) - Gets/sets whether 2V excitation is supported.
- `bool SupportedExcitation_5V` (get/set) - Gets/sets whether 5V excitation is supported.
- `bool SupportedExcitation_10V` (get/set) - Gets/sets whether 10V excitation is supported.
**Methods:**
- `void UpdateList(bool value, ExcitationVoltageOptions.ExcitationVoltageOption excitationVoltageOption)` - Adds or removes the specified option from `_supportedExcitations`.
**Events:**
- `event PropertyChangedEventHandler PropertyChanged`
---
### EditDigitalOutputControl
**Properties:**
- `DataPROPage Page` (set-only) - Assigns the parent page for modification tracking.
- `DTS.SensorDB.SensorData Setting` (get/set) - The sensor data model; setter also sets `nbDigitalOutputDelayMS.Value` and `nbDigitalOutputDurationMS.Value`.
- `string SettingName` (get/set) - Gets or sets `_setting.SerialNumber`.
- `string UserTags` (get/set) - Comma-separated tag string.
- `ModeHelper SelectedMode` (get/set) - Gets/sets `_setting.DigitalOutputMode`.
- `ModeHelper[] AvailableModes` (get) - Array of available `DigitalOutputModes` (excludes `DigitalOutputModes.NONE`).
- `bool LimitDuration` (get/set) - Gets/sets `_setting.DigitalOutputLimitDuration`.
- `Visibility DurationVisibility` (get) - Returns `Visibility.Visible` if `LimitDuration` is true, otherwise `Visibility.Collapsed`.
**Methods:**
- `bool Validate(ref List<string> errors, bool displayWindow)` - Validates that `SettingName` is not empty/whitespace.
**Nested Classes:**
- `public class ModeHelper` - Contains `DigitalOutputModes Mode` property; `ToString()` returns localized string via `StringResources.ResourceManager.GetString()`.
**Events:**
- `event PropertyChangedEventHandler PropertyChanged`
---
### InitialOffsetControl
**Properties:**
- `InitialOffsets InitialOffsets` (get/set) - The offsets model; setter updates `InitialOffsetCollection` and calls `UpdateInitialOffsetTypes()`.
- `InitialOffset[] InitialOffsetCollection` (get/set) - Array of `InitialOffset` objects.
- `List<InitialOffsetTypes> AvailableOffsetTypes` (get/set) - Types not yet used in the collection.
- `InitialOffsetTypes SelectedOffset` (get/set) - Currently selected offset type for adding.
- `bool CanAddInitialOffset` (get) - Returns `true` if `AvailableOffsetTypes` has any items.
- `bool IsNonLinear` (get/set) - Flag indicating non-linear mode.
**Methods:**
- `bool Validate(bool HasLinearComponent, ref List<string> warnings, ref List<string> errors, bool Valid, bool DisplayErrors)` - Validates offset collection; checks for duplicate types and validates `EUAtMV` requires linear component. Returns `true` if save should proceed.
- `void UpdateInitialOffsetTypes()` - Rebuilds `AvailableOffsetTypes` excluding types already in collection; ensures `InitialOffsetTypes.None` is at index 0 if present.
**Events:**
- `event PropertyChangedEventHandler PropertyChanged`
---
### EditUartSettingsControl
**Properties:**
- `DataPROPage Page` (set-only) - Assigns the parent page for modification tracking.
- `DTS.SensorDB.SensorData Setting` (get/set) - The sensor data model being edited.
- `uint BaudRate` (get/set) - Gets/sets `Setting.UartBaudRate`; setter enforces `BAUD_RATE_MAX` limit.
- `uint DataBits` (get/set) - Gets/sets `Setting.UartDataBits`.
- `ParityHelper SelectedParity` (get/set) - Gets/sets `Setting.UartParity`.
- `StopBitsHelper SelectedStopBits` (get/set) - Gets/sets `Setting.UartStopBits`.
- `UartDataFormatHelper SelectedUartDataFormat` (get/set) - Gets/sets `Setting.UartDataFormat`.
- `ParityHelper[] AvailableParities` (get) - All `System.IO.Ports.Parity` values.
- `StopBitsHelper[] AvailableStopBits` (get) - All `System.IO.Ports.StopBits` values.
- `HandshakeHelper[] AvailableFlowControls` (get) - Only `Handshake.None` (hardcoded per FB 30486).
- `UartDataFormatHelper[] AvailableUartDataFormats` (get) - All `UartDataFormat` values.
- `string SettingName` (get/set) - Gets/sets `_setting.SerialNumber`.
- `string UserTags` (get/set) - Comma-separated tag string.
**Methods:**
- `bool Validate(ref List<string> errors, bool displayWindow)` - Validates `SettingName` is not empty and validates baud rate via `BaudValidator.Validate()`.
**Nested Classes:**
- `public class ParityHelper` - Wraps `Parity` enum with localized `ToString()`.
- `public class StopBitsHelper` - Wraps `StopBits` enum with localized `ToString()`.
- `public class HandshakeHelper` - Wraps `Handshake` enum with localized `ToString()`.
- `public class UartDataFormatHelper` - Wraps `UartDataFormat` enum with localized `ToString()`.
**Events:**
- `event PropertyChangedEventHandler PropertyChanged`
---
## 3. Invariants
1. **Null Safety**: All property getters check for `null` on `_setting`/`Setting`/`_model` before accessing members, returning default values (empty string, `null`, `false`, etc.) when the backing field is null.
2. **Initialization Flag Pattern**: All controls use a volatile boolean flag (`_bInit`, `_bInitModel`) to suppress `MarkPageModified()` calls during programmatic property initialization. The flag is set in a try/finally block.
3. **Page Assignment**: `Page` property setters silently return if `null` is assigned; null pages are not allowed.
4. **Baud Rate Limit**: `EditUartSettingsControl.BaudRate` setter enforces `value <= DTS.Common.Constant.EmbeddedSensors.BAUD_RATE_MAX`.
5. **Flow Control Constraint**: `EditUartSettingsControl` hardcodes `AvailableFlowControls` to only contain `Handshake.None` (documented as FB 30486).
6. **Digital Output Modes**: `EditDigitalOutputControl` excludes `DigitalOutputModes.NONE` from `AvailableModes`.
7. **Initial Offset Uniqueness**: `InitialOffsetControl.UpdateInitialOffsetTypes()` ensures each `InitialOffsetTypes` value appears at most once in the collection.
8. **EUAtMV Dependency**: `InitialOffsetControl.Validate()` enforces that `InitialOffsetTypes.EUAtMV` requires `HasLinearComponent == true`.
---
## 4. Dependencies
### External Dependencies (Imports):
- `DTS.Common.Utils` - `Utils.ValidateUDPAddress()`
- `DTS.Common.Enums` - `Tags`, `DigitalOutputModes`, `ExcitationVoltageOptions`, `UartDataFormat`
- `DTS.Common.Storage` - `DbOperations`, `DataPROPage`, `PageHeaderRibbon`
- `DTS.Common.SharedResource.Strings` - `StringResources` for localized strings
- `DTS.SensorDB` - `SensorData`, `SensorBase`
- `DTS.Common.Classes.Sensors` - `InitialOffsets`, `InitialOffset`
- `DTS.Common.Enums.Sensors` - `InitialOffsetTypes`
- `DTS.Common.Converters` - `EnumDescriptionTypeConverter`
- `DTS.Common.Events` / `DTS.Common.Events.Sensors.SensorsList` - `SensorChangedEvent`, `SensorChangedArgs`, `PageErrorEvent`, `PageErrorArg`
- `DTS.Common.DAS.Concepts` - (imported but usage unclear from source)
- `DTS.Common.Constant.EmbeddedSensors` - `BAUD_RATE_DEFAULT`, `BAUD_RATE_MAX`
- `Prism.Events` - `IEventAggregator`
- `Prism.Ioc` - `ContainerLocator`
- `System.IO.Ports` - `Parity`, `StopBits`, `Handshake`
- `C1.WPF` - ComponentOne controls (`C1.WPF.PropertyChangedEventArgs<double>`)
- Standard WPF assemblies (`System.Windows.Controls`, etc.)
### Consumers:
- Not determinable from source alone. These controls appear to be hosted within `DataPROPage` instances in the sensor configuration UI.
---
## 5. Gotchas
1. **PropertyChanged Side Effect**: In `EditStreamInputControl`, `EditDigitalOutputControl`, `SupportedExcitationControl`, and `EditUartSettingsControl`, calling `OnPropertyChanged()` has a side effect of calling `MarkPageModified()` when not in initialization mode. This means any property change marks the page as modified.
2. **Setting Setter Broadcasts All Tags**: When `Setting` is set, the setter iterates through all `Tags` enum values and calls `OnPropertyChanged()` for each, triggering multiple potential page modification marks if `_bInit` is not properly managed.
3. **UserTags String Format**: The `UserTags` property expects/returns comma-separated values. Empty tags or malformed input behavior is not explicitly handled.
4. **InitialOffsetControl Validation Complexity**: The `Validate()` method has a comment noting that `SensorDatabaseControl` ignores warnings AND errors unless `false` is returned, leading to a workaround where warnings are displayed directly via `PageErrorEvent` rather than passed up the chain.
5. **Flow Control Hardcoded**: `EditUartSettingsControl` hardcodes `Handshake.None` as the only available flow control option (FB 30486), despite the `HandshakeHelper` class supporting other values.
6. **EventAggregator Resolution**: `SupportedExcitationControl` and `InitialOffsetControl` resolve `IEventAggregator` at runtime via `ContainerLocator.Container.Resolve<IEventAggregator>()` rather than constructor injection.
7. **Validate Method Signature Inconsistency**: `InitialOffsetControl.Validate()` has a different signature (`bool HasLinearComponent, ref List<string> warnings, ref List<string> errors, bool Valid, bool DisplayErrors`) compared to other controls (`ref List<string> errors, bool displayWindow`).
8. **UI Element References in Code-Behind**: `Validate()` methods reference named XAML elements (`NameTextBox`, `UDPAddressTextBox`, `BaudRateComboBox`) that are not defined in the C# source, implying tight coupling to XAML definitions.

View File

@@ -0,0 +1,283 @@
---
source_files:
- DataPRO/DataPRO/Controls/Settings/ISettingsControl.cs
- DataPRO/DataPRO/Controls/Settings/EditAdvancedSettings.xaml.cs
- DataPRO/DataPRO/Controls/Settings/EditRealtimeSettings.xaml.cs
- DataPRO/DataPRO/Controls/Settings/TestHistorySettings.xaml.cs
- DataPRO/DataPRO/Controls/Settings/EditUISettings.xaml.cs
- DataPRO/DataPRO/Controls/Settings/ImportDB.xaml.cs
- DataPRO/DataPRO/Controls/Settings/SoftwareFilters.xaml.cs
- DataPRO/DataPRO/Controls/Settings/EditISOSettings.xaml.cs
- DataPRO/DataPRO/Controls/Settings/DBImport.xaml.cs
- DataPRO/DataPRO/Controls/Settings/DatabaseSettings.xaml.cs
- DataPRO/DataPRO/Controls/Settings/PowerAndBattery.xaml.cs
- DataPRO/DataPRO/Controls/Settings/EditTables.xaml.cs
generated_at: "2026-04-17T15:45:49.828667+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8354cf391e84f180"
---
# Settings Controls Module Documentation
## 1. Purpose
This module provides a collection of WPF UserControls for managing application settings within the DataPRO system. Each control implements a standardized interface (`IPageContent`, `ISettingsControl`, `INotifyPropertyChanged`) to integrate with the application's page navigation framework. The controls manage diverse settings categories including advanced configuration, real-time settings, UI preferences, ISO settings, database operations, software filters, hardware power/battery configurations, and table customization. The module serves as the settings management layer, bridging user interactions with persistent configuration storage.
---
## 2. Public Interface
### ISettingsControl (Interface)
**File:** `ISettingsControl.cs`
**Namespace:** `DataPROWin7.Controls.Settings`
```csharp
void RestoreOriginalSettings()
```
Restores settings to their original/default state. Implementations should reset internal settings objects and trigger property change notifications.
---
### EditAdvancedSettings
**File:** `EditAdvancedSettings.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `AdvancedSettings` | `public AdvancedSettings { get; set; }` | Gets or sets the advanced settings object bound to the property grid. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Validates settings; currently returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Refreshes settings and rebinds the property grid by setting `SelectedObject` to null then to `_advancedSettings`. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Empty implementation. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Calls `_advancedSettings.Restore()` and raises `PropertyChanged` for "AdvancedSettings". |
---
### EditRealtimeSettings
**File:** `EditRealtimeSettings.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `RealtimeSettings` | `public RealtimeSettings { get; set; }` | Gets or sets the realtime settings object. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Refreshes settings and rebinds property grid. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Empty implementation. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Calls `_realtimeSettings.Restore()` and raises `PropertyChanged` for "RealtimeSettings". |
---
### TestHistorySettings
**File:** `TestHistorySettings.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `TestHistoryDefaults` | `public TestHistoryDefaults { get; set; }` | Holds the actual settings displayed in the control. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Creates a new `TestHistoryDefaults` instance and raises `PropertyChanged`. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Empty implementation. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Calls `Settings.TestHistoryDefaults.RestoreOriginalSettings()`, creates new `TestHistoryDefaults`, and raises `PropertyChanged`. |
---
### EditUISettings
**File:** `EditUISettings.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Creates new `UIProperties`, subscribes to `PropertyChanged`, and binds to `gridUIProperties`. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Unsubscribes from `_uiProperties.PropertyChanged` and sets `_uiProperties` to null. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Creates new `UIProperties(true)` (restoring defaults), re-subscribes to events, and rebinds. |
**Private event handler:**
- `_uiProperties_PropertyChanged`: Handles "ShowGroups" (calls `MainWindow.SetGroupsVisible()`) and "UICulture" (calls `App.SetCulture(true)`).
---
### ImportDB
**File:** `ImportDB.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `DBImportView` | `public object DBImportView { get; set; }` | Bound view for database import. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Resolves `IDBImportView` and `IDBViewModel` via Unity container, initializes view model, and sets content. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Empty implementation. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `RestoreOriginalSettings` | `public void RestoreOriginalSettings()` | Empty implementation. |
---
### SoftwareFilters
**File:** `SoftwareFilters.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `SoftwareFiltersView` | `public object SoftwareFiltersView { get; set; }` | Bound view for software filters. |
| Constructor | `public SoftwareFilters(DataPROPage page)` | Initializes with a `DataPROPage` reference. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Resolves `ISoftwareFiltersView` and `ISoftwareFiltersViewModel`, initializes, and populates view. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Sets `_vm.CurrentUser` and calls `_vm.Unset()`. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `RestoreOriginalSettings` | `public void RestoreOriginalSettings()` | Empty implementation. |
| `CheckChangeStep` | `public bool CheckChangeStep()` | Sets `_vm.CurrentUser` and returns `_vm.ValidateAndSave()`. |
---
### EditISOSettings
**File:** `EditISOSettings.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `IsoSettingsView` | `public object IsoSettingsView { get; set; }` | Bound view for ISO settings. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Resolves `IISOSettingsView` and `IISOSettingsViewModel`, initializes, and assigns `SerializedSettings.ValidateTestPositionAndTestObject`. |
| `UnSet` | `void IPageContent.UnSet(Action OnComplete = null)` | Saves ISO data via `_vm.Model.SaveData()`, updates `SerializedSettings` properties, and calls `App.ResetISOSupport()`. |
| `Reset` | `public void Reset()` | Reloads ISO data via `_vm.Model.LoadData()`. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Resets all `SerializedSettings` to defaults and reloads data. |
---
### DBImport
**File:** `DBImport.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `DBImportView` | `public object DBImportView { get; set; }` | Bound view for database import. |
| Constructor | `public DBImport(DataPROPage page)` | Initializes with a `DataPROPage` reference. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Resolves view/viewmodel, initializes, sets status text based on `_vm.ImportFileName`. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Empty implementation. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `RestoreOriginalSettings` | `public void RestoreOriginalSettings()` | Empty implementation. |
| `Import` | `public void Import()` | Validates import file exists, queues `ImportXML` on ThreadPool. |
| `ImportXML` | `public void ImportXML(object o)` | Creates `DatabaseImport.DbImporter` and calls `ImportXML()` with status callback. |
---
### DatabaseSettings
**File:** `DatabaseSettings.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `DatabaseCopyEnabled` | `public bool DatabaseCopyEnabled { get; }` | Returns `true` if `DBType == 2` and using centralized DB. |
| `DatabaseControlEnabled` | `public bool DatabaseControlEnabled { get; }` | Returns `true` if `DBType == 2`. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Initializes view models and sets DB type state. |
| `UnSet` | `public void UnSet(Action OnComplete = null)` | Returns early if `_eventAggregator` is null. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `RestoreOriginalSettings` | `public void RestoreOriginalSettings()` | Empty implementation. |
| `OnDbError` | `public void OnDbError(DbStatusArg args)` | Handles `DbStatusEvent` and reports errors to current page. |
---
### PowerAndBattery
**File:** `PowerAndBattery.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public PowerAndBattery(DataPROPage page)` | Initializes hardware type settings for 30+ `HardwareTypes` values. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Calls `Reset()`. |
| `UnSet` | `void IPageContent.UnSet(Action OnComplete = null)` | Empty implementation. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Iterates all `HardwareTypes` enum values, calls `Restore()` on each `InputAndBatterySetting` control. |
**Private method:**
- `GetSettingCtrl(HardwareTypes type)`: Returns the appropriate `InputAndBatterySetting` control for a given hardware type via switch statement.
---
### EditTables
**File:** `EditTables.xaml.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `AllTables` | `public TableHelper[] AllTables { get; set; }` | Array of table helpers exposed for binding. |
| Constructor | `public EditTables(DataPROPage page)` | Initializes with a `DataPROPage` reference. |
| `Validate` | `public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally. |
| `OnSetActive` | `public void OnSetActive()` | Calls `Populate()`. |
| `UnSet` | `void IPageContent.UnSet(Action OnComplete = null)` | Sets `AllTables` to empty array. |
| `Reset` | `public void Reset()` | Empty implementation. |
| `GetPageContent` | `public object GetPageContent()` | Returns `this`. |
| `RestoreOriginalSettings` | `void ISettingsControl.RestoreOriginalSettings()` | Resets all tables via `GenericTableDictionary.Dictionary.ResetTable()` and repopulates. |
**Nested class `TableHelper`:**
- Properties: `TableId`, `AllChannelsGrid`
- Handles column changes via `dt_ColumnChanged` event handler
- Persists changes via `GenericTableDictionary.Dictionary.SaveColumns()`
---
## 3. Invariants
1. **Interface Implementation**: All settings controls must implement `IPageContent`, `INotifyPropertyChanged`, and `ISettingsControl`.
2. **Property Grid Rebinding Pattern**: `EditAdvancedSettings`, `EditRealtimeSettings` must set `propertyGrid.SelectedObject = null` before reassigning to force UI refresh (documented workaround for PropertyGrid not observing INotifyPropertyChanged).
3. **Event Subscription Lifecycle**: `EditUISettings` must unsubscribe from `_uiProperties.PropertyChanged` in `UnSet()` to prevent memory leaks.
4. **Unity Container Resolution**: Controls using Prism/Unity (`SoftwareFilters`, `EditISOSettings`, `DBImport`, `DatabaseSettings`, `ImportDB`) resolve dependencies lazily in `OnSetActive()` and cache the container.
5. **Permission Check Pattern**: `IPageContent.SetPermissions` implementations compare `actualPermission >= requiredPermission` to enable/disable controls.
6. **Hardware Type Mapping**: `PowerAndBattery.GetSettingCtrl()` must return the correct `InputAndBatterySetting` control for each supported `HardwareTypes` enum value.
7. **ISO Settings Persistence**: `EditISOSettings.UnSet()` must save data and update `SerializedSettings` properties before calling `App.ResetISOSupport()`.
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Used By |
|-----------|---------|
| `System.ComponentModel` | All controls (INotifyPropertyChanged) |
| `System.Windows.Controls` | All controls (UserControl base) |
| `DTS.Slice.Users` / `DTS.Slice.Users.User` | Permission types (`UserPermissionLevels`) |
| `DTS.Slice.Users.UserSettings` | `TestHistorySettings` |
| `Xceed.Wpf.Toolkit.PropertyGrid` | `EditAdvancedSettings`, `EditRealtimeSettings` |
| `Prism.Events`, `Prism.Regions`, `Prism.Ioc` | `SoftwareFilters`, `EditISOSettings`, `DBImport`, `DatabaseSettings`, `ImportDB` |
| `Unity` | DI container for view/viewmodel resolution |
| `DTS.Common.Interface` | `IDBViewModel`, `IDBImportView`, `IISOSettingsView`, `IISOSettingsViewModel` |
| `DTS.Common.Interface.Database` | `IDatabaseCopyViewModel`, `IDatabaseSwitchViewModel` |
| `DTS.Common.Interface.Sensors.SoftwareFilters` | `ISoftwareFiltersViewModel`, `ISoftwareFiltersView` |
| `DTS.Common.Events.Database` | `DbStatusEvent`, `DbStatusArg` |
| `DTS.Common.Enums.Hardware` | `HardwareTypes` enum |
| `DTS.Common.ISO` | `PowerAndBattery` |
| `DataPROWin7.Common` | `SerializedSettings`, `DataPROPage` |
| `DataPROWin7.DataModel` | `EditUISettings` |
| `DatabaseImport` | `DBImport` (DbImporter class) |
### Internal Dependencies (Inferred)
- `AdvancedSettings`, `RealtimeSettings`, `UIProperties`, `TestHistoryDefaults` - Settings model classes
- `InputAndBatterySetting` - Control used by `PowerAndBattery`
- `TableOptionsTable` - Control used by `EditTables`
- `GenericTableDictionary` - Table configuration storage
- `MainWindow`, `HomePage`, `App` - Application shell classes
---
## 5. Gotchas
1. **PropertyGrid INotifyPropertyChanged Workaround**: The source explicitly documents that `Xceed.Wpf.Toolkit.PropertyGrid` does not observe `INotifyPropertyChanged`. The workaround is to set `SelectedObject = null` then reassign. See `EditAdvancedSettings.OnSetActive()` and `EditRealtimeSettings.OnSetActive()`.
2. **Duplicate Import Controls**: Both `ImportDB.xaml.cs` and `DBImport.xaml.cs` exist with similar but different implementations. `DBImport` has more complete functionality including actual import logic via `DatabaseImport.DbImporter`. The relationship between these two is unclear from source alone.
3. **Empty Method Implementations**: Many `Validate()`, `Reset()`, `UnSet()`, and `RestoreOriginalSettings()` methods are empty or return `true` unconditionally. This suggests either incomplete implementations or that validation logic resides elsewhere.
4. **Hardcoded Hardware Types List**: `PowerAndBattery` constructor contains a hardcoded array of 30+ `HardwareTypes` values that must be kept in sync with the `GetSettingCtrl()` switch statement. Missing entries will not be initialized.
5. **EditISOSettings Self-Assignment Oddity**: In `OnSetActive()`, the line `SerializedSettings.ValidateTestPositionAndTestObject = SerializedSettings.ValidateTestPositionAndTestObject` appears to be a no-op self-assignment.
6. **Event Aggregator Unsubscription Missing**: `DatabaseSettings` subscribes to `DbStatusEvent` in `InitializeVmsIfNeeded()` but never unsubscribes in `UnSet()`.
7. **Thread Pool Usage**: `DBImport.Import()` and `DBImport.ImportXML()` use `ThreadPool.QueueUserWorkItem` for background operations without cancellation support or error handling visible in the source.

View File

@@ -0,0 +1,330 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestObject/IEditObjectSensorsControlPage.cs
- DataPRO/DataPRO/Controls/TestObject/TableOptionsTable.cs
- DataPRO/DataPRO/Controls/TestObject/ImportObjectImport.xaml.cs
- DataPRO/DataPRO/Controls/TestObject/ImportObjectOptions.xaml.cs
- DataPRO/DataPRO/Controls/TestObject/EditObjectInfoControl.xaml.cs
- DataPRO/DataPRO/Controls/TestObject/ImportObjectPreview.xaml.cs
- DataPRO/DataPRO/Controls/TestObject/SensorLockAndContend.cs
- DataPRO/DataPRO/Controls/TestObject/EditObjectHardwareControl.xaml.cs
- DataPRO/DataPRO/Controls/TestObject/ExportGroup.xaml.cs
generated_at: "2026-04-17T15:47:48.640909+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b7434af174e9b783"
---
# Documentation: DataPRO TestObject Controls
## 1. Purpose
This module provides UI controls and supporting classes for editing, importing, and exporting test objects (groups/sensors) within the DataPRO application. It encompasses hardware configuration, sensor locking management, table options configuration, and multi-step import/export workflows. The controls implement `IPageContent` for integration with the page navigation system and `INotifyPropertyChanged` for data binding support.
---
## 2. Public Interface
### IEditObjectSensorsControlPage
```csharp
void SetOnlineSensors(DTS.SensorDB.SensorData[] sensors);
```
Interface for setting online sensors data.
---
### TableOptionsTable
Inherits from `GenericTable2`.
**Constructor:**
```csharp
public TableOptionsTable(System.Windows.Controls.ContentControl container, DataPROPage page)
```
**Nested Enum:**
```csharp
public enum TableColumns {
ColumnName,
ColumnHeader,
Visible,
DisplayOrder,
Width,
UserData
}
```
**Protected Methods:**
```csharp
protected override void CreateColumns(string resourcePrefix, Type enumType)
```
Creates DataGrid columns based on `TableColumns` enum. Creates `DataGridCheckBoxColumn` for `Visible`, `DataGridNumericColumn` for `DisplayOrder` and `Width`, and `DataGridTextColumn` for others. Note: `UserData` column is explicitly skipped.
---
### ImportObjectImport
Partial `UserControl` implementing `IPageContent` and `INotifyPropertyChanged`.
**Properties:**
```csharp
public IGroupImportImportView ImportView { get; set; }
```
**Methods:**
```csharp
public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
public void OnSetActive()
public object GetPageContent()
```
**IPageContent Implementation:**
- `SetPermissions(UserPermissionLevels actualPermission, UserPermissionLevels requiredPermission)` - Enables control if `actualPermission >= requiredPermission`
- `KeyDown(object, KeyEventArgs)` - Returns `false`
- `StartSearch(string)` - No-op
- `OnButtonPress(PageButton)` - Returns `false`
- `UnSet(Action)` - No-op
---
### ImportObjectOptions
Partial `UserControl` implementing `IPageContent` and `INotifyPropertyChanged`.
**Properties:**
```csharp
public IGroupImportOptionsView OptionsView { get; set; }
```
**Methods:**
```csharp
public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
```
Validates via `OptionsView.Validate(out List<string>, out List<string>)`, aggregates errors/warnings, and reports errors to the current page if any exist.
```csharp
public void OnSetActive()
public object GetPageContent()
```
---
### EditObjectInfoControl
Partial `UserControl` implementing `IPageContent` and `INotifyPropertyChanged`.
**Constructors:**
```csharp
public EditObjectInfoControl(DataPROPage page)
protected EditObjectInfoControl()
```
**Methods:**
```csharp
public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow) // Returns true
public void OnSetActive()
public object GetPageContent()
```
**Event Handlers:**
```csharp
private void TextBoxSourceUpdated(object sender, System.Windows.Data.DataTransferEventArgs e)
```
Publishes `PageModifiedEvent` with `PageModifiedArg.Status.Modified` and sets `_page.ModifiedObjectName`.
---
### ImportObjectPreview
Partial `UserControl` implementing `IPageContent` and `INotifyPropertyChanged`.
**Properties:**
```csharp
public IGroupImportPreviewView PreviewView { get; set; }
public bool DontValidate { get; set; }
```
**Methods:**
```csharp
public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
```
If `DontValidate` is true, returns `true`. Otherwise validates via `PreviewView.Validate(bool isAdmin, out List<string>, out List<string>)`. Reports errors to page. Warnings are shown asynchronously via `ThreadPool.QueueUserWorkItem(DoWarning, warnings)` and returns `false`.
```csharp
private static void DoWarning(object o)
```
Static method that displays warnings with OK/Cancel buttons.
---
### SensorLockAndContend
**Constructor:**
```csharp
public SensorLockAndContend(DataPROPage page)
```
**Properties:**
```csharp
public bool HasLockedSensors { get; } // Returns _sensorsLocked.Any()
```
**Methods:**
```csharp
public LockRecord[] GetLockRecords()
public void LockSensors(SensorData[] sensorsToLock)
```
Attempts to lock each sensor. Handles "stranded locks" (locks older than `StrandedLockTimeoutMinutes` or owned by same user/machine). Contentious locks are processed via `ContendLocks()`.
```csharp
private void ContendLocks(User user)
```
Admins are prompted to steal locks; non-admins receive error report.
```csharp
private void StealLocks()
public void FreeSensors()
```
Releases all locked sensors and clears `_sensorsContentiousLocks`.
---
### EditObjectHardwareControl
Partial `UserControl` implementing `IPageContent` and `INotifyPropertyChanged`.
**Constructors:**
```csharp
public EditObjectHardwareControl(DataPROPage page)
private EditObjectHardwareControl()
```
**Properties:**
```csharp
public string HardwareInfo { get; set; }
private int ChannelsRequired { get; set; }
```
**Methods:**
```csharp
public void AddHardware(DataModel.DASHardware hardware, IGroup group, Dictionary<string, DataModel.DASHardware> lookup, DataModel.DASHardware[] allHardware)
```
Adds hardware to group's `IncludedHardware`. Handles special cases for `IsPseudoRack()`, `IsTSRAIR()`, and `IsSLICETC()` hardware types.
```csharp
public void OnSetActive()
public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
private bool ValidateTestObjectHardware(ref List<string> errors) // Currently returns true
public object GetPageContent()
void IPageContent.UnSet(Action OnComplete)
```
**Event Handlers:**
```csharp
private void OnIncludedChanged(HardwareListHardwareIncludedEventArgs args)
private void OnGroupChannelsChanged(GroupChannelsChangedEventArgs obj)
private void OnShowCompactChanged(bool bShowCompact)
private void EditObjectHardwareControl_OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
```
---
### ExportGroup
Partial `UserControl` implementing `IPageContent` and `INotifyPropertyChanged`.
**Constructor:**
```csharp
public ExportGroup(DataPROPage page)
```
**Nested Enum:**
```csharp
private enum Columns {
Included,
Name,
Description,
ChannelCount,
LastModifiedBy,
LastModified
}
```
**Properties:**
```csharp
public string ExportFile { get; set; }
public string TCFFile { get; set; }
public bool UseFirstUseDate { get; set; } // Default: true
```
**Methods:**
```csharp
public bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
public void OnSetActive()
public void Export()
public bool OnButtonPress(PageButton button) // Returns true only for "MessageBoxButton_OK"
public void UnSet(Action OnComplete)
public void SetStatusText(string text)
public void SetRibbonColor(System.Windows.Media.Color color)
private void SetStatus(ExportTestSetup.PossibleStatus status, string errorMessage)
private void SetProgress(double value)
```
**Delegates:**
```csharp
public delegate void SetStatusDelegate(ExportTestSetup.PossibleStatus status, string errorMessage);
public delegate void SetProgressDelegate(double progress);
```
---
## 3. Invariants
- **Permission Checking**: All `IPageContent.SetPermissions` implementations use integer comparison `(int)actualPermission >= (int)requiredPermission` to determine enabled state.
- **Thread Safety**: `SensorLockAndContend` and `ExportGroup` use `ThreadPool.QueueUserWorkItem` for background operations; UI updates use `Dispatcher.BeginInvoke`.
- **Event Subscription Tracking**: `EditObjectHardwareControl` uses boolean flags (`_bSubscribed`, `_bSubscribedCompactChanged`) to prevent duplicate subscriptions.
- **Lock Ownership**: `SensorLockAndContend.LockSensors` only allows stealing locks if the lock is stranded (timed out) OR owned by the same user on the same machine.
- **Validation Pattern**: All `Validate` methods accept `ref List<string> errors` and `ref List<string> warnings` parameters for accumulating validation messages.
- **Hardware Inclusion**: When adding pseudo-rack hardware with `ShowCompactHardware` enabled, child hardware DAS IDs are automatically included.
---
## 4. Dependencies
### External Dependencies (from imports):
- `DTS.SensorDB` - `SensorData`, `SensorsCollection`, `SensorConstants`
- `DTS.Common.Classes.Locking` - `LockManager`, `LockRecord`
- `DTS.Common.Storage` - Implied storage operations
- `DTS.Common.Utilities.Logging` - `APILogger`
- `DTS.Common.Interface.Groups` - `IGroupImportImportView`, `IGroupImportOptionsView`, `IGroupImportPreviewView`
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`, `IGroupListViewModel`
- `DTS.Common.Events` - `PageModifiedEvent`, `PageModifiedArg`
- `DTS.Common.Enums.Sensors`, `DTS.Common.Enums.Hardware`
- `DTS.Common.SharedResource.Strings` - Localized string resources
- `DTS.Slice.Users` - `User`, `UserPermissionLevels`
- `Prism.Events` - `IEventAggregator`
- `Prism.Ioc` - `ContainerLocator`
- `Unity` - `IUnityContainer`
- `C1.WPF.DataGrid` - Third-party DataGrid controls
### Internal Dependencies:
- `GenericTable2` - Base class for `TableOptionsTable` and used by `ExportGroup`
- `DataPROPage` - Page container passed to most controls
- `MainWindow`, `HomePage` - Navigation context for error reporting
- `App` - Application-level message box and current user access
### Dependents:
Unclear from source alone - these appear to be UI controls consumed by higher-level page orchestration components.
---
## 5. Gotchas
1. **TableOptionsTable.UserData Column Skipped**: The `CreateColumns` method explicitly breaks out of the switch for `TableColumns.UserData` without creating any column. This is intentional but undocumented behavior.
2. **ImportObjectImport.Validate Always Returns True**: The `Validate` method is a stub that always returns `true` regardless of input, unlike other import controls that perform actual validation.
3. **ValidateTestObjectHardware is Incomplete**: `EditObjectHardwareControl.ValidateTestObjectHardware` contains commented-out logic and always returns `true`. The validation logic for channel counts exists but is disabled.
4. **Warning Display Blocks Navigation**: `ImportObjectPreview.Validate` returns `false` when warnings exist (even if no errors), queuing the warning display to the thread pool. This means navigation is blocked until the user dismisses the warning dialog.
5. **File Overwrite Race Condition**: `ExportGroup.Export` uses a `_bInChallenge` flag to prevent double-prompting, but the flag is only checked after `File.Exists` check. The ThreadPool usage for `FileOverwriteWarning` creates potential for race conditions.
6. **Stranded Lock Timeout**: `SensorLockAndContend` uses `Properties.Settings.Default.StrandedLockTimeoutMinutes` to determine when a lock can be stolen - this value is configuration-dependent and not validated in code.
7. **Commented-Out Event Handlers**: `EditObjectInfoControl` contains commented-out `TextChanged` handlers for `DisplayName` and `Description` fields, suggesting historical refactoring of the modification tracking mechanism.
8. **TSRAIR/SLICETC Special Handling**: `EditObjectHardwareControl.AddHardware` has significant special-case logic for TSRAIR and SLICETC hardware types that creates channels automatically - this behavior is not obvious from the method signature.

View File

@@ -0,0 +1,261 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/AvailableRecordingMode.cs
- DataPRO/DataPRO/Controls/TestSetups/EditTestSetupROIChannelsControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/EditTestSetupChannels.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/EditTestSetupParameters.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/EditTestSetupSysBuiltObjectsControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/EditTestSetupGraphControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/EditTestSetupSysBuiltObjectsTypeControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/TimedTriggersTable.cs
generated_at: "2026-04-17T15:45:04.870741+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "66b40f2efe6fc8de"
---
# Documentation: DataPRO Test Setup Controls
## 1. Purpose
This module provides WPF user controls for editing and managing test setup configurations within the DataPRO application. It encompasses UI components for configuring channels, sensors, regions of interest (ROI), graphs, parameters, system-built test objects, and timed triggers. These controls implement the `IPageContent` interface to integrate with the application's page navigation system and support `INotifyPropertyChanged` for data binding.
---
## 2. Public Interface
### AvailableRecordingMode
A simple data class for representing recording mode options in UI dropdowns.
| Member | Signature | Description |
|--------|-----------|-------------|
| `RecordingMode` | `DFConstantsAndEnums.RecordingMode { get; set; }` | Gets or sets the recording mode enum value. |
| `DisplayString` | `string { get; set; }` | Gets or sets the user-facing display text. |
| `ToString()` | `override string ToString()` | Returns `DisplayString` for data binding scenarios. |
---
### EditTestSetupROIChannelsControl
Control for editing Region of Interest (ROI) channels within a test setup. Implements `IPageContent` and `INotifyPropertyChanged`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SetData` | `void SetData(TestTemplate test)` | Initializes the ROI channels view model with test data, builds hardware lookup, and sets groups/ROI. |
| `ShowROIGrid` | `void ShowROIGrid(TestTemplate test)` | Calls `SetData` and displays the ROI channels view in `ContentContainer`. |
| `ClearGrid` | `void ClearGrid()` | Clears the `RegionsOfInterest` collection on the view model. |
| `Validate` | `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Delegates validation to `_roiChannelsVm.Validate()`, always returns `true`. |
| `OnSetActive` | `void OnSetActive()` | Empty implementation. |
| `GetPageContent` | `object GetPageContent()` | Returns `this`. |
| `CurrentTest` | `TestTemplate` (via `Tags.CurrentTest`) | Not explicitly exposed as property but referenced in `Tags` enum. |
**IPageContent Explicit Implementations:**
- `void IPageContent.SetPermissions(User.UserPermissionLevels, User.UserPermissionLevels)` - Empty.
- `bool IPageContent.KeyDown(object, KeyEventArgs)` - Returns `false`.
- `void IPageContent.StartSearch(string)` - Empty.
- `bool IPageContent.OnButtonPress(PageButton)` - Returns `false`.
- `void IPageContent.UnSet(Action)` - Empty.
---
### EditTestSetupChannels
Control for assigning sensors and hardware to channels. Implements `IPageContent`, `INotifyPropertyChanged`, and `TestObject.IEditObjectSensorsControlPage`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `GetTestChannelsGroup` | `IGroup GetTestChannelsGroup()` | Delegates to `_editObjectSensorsControl.GetTestChannelsGroup()`. |
| `GetMaxDisplayOrder` | `int GetMaxDisplayOrder()` | Delegates to `_editObjectSensorsControl.GetMaxDisplayOrder()`. |
| `AddChannels` | `void AddChannels(IGroupChannel[] groupChannels)` | Delegates to `_editObjectSensorsControl.AddChannels()`. |
| `ClearFilters` | `void ClearFilters()` | Clears all filters in the channels control. |
| `SetOnlineSensors` | `void SetOnlineSensors(DTS.SensorDB.SensorData[] sensors)` | Delegates to `_editObjectSensorsControl.SetOnlineSensors()`. |
| `CurrentTest` | `DataModel.TestTemplate { get; set; }` | Gets/sets current test; setter calls `_editObjectSensorsControl.UpdateTestSetup()`. |
| `Validate` | `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true`. |
| `Validate` | `bool Validate(ref List<string> errors, DataModel.DASHardware[] hardware)` | Returns `true`. |
| `FilterAnalog` | `void FilterAnalog()` | Sets `filterTypeAnalogButton.IsChecked = true`. |
| `FilterDigitalIn` | `void FilterDigitalIn()` | Sets `filterTypeDigitalInButton.IsChecked = true`. |
| `FilterSquib` | `void FilterSquib()` | Sets `filterTypeSquibButton.IsChecked = true`. |
| `FilterDigitalOut` | `void FilterDigitalOut()` | Sets `filterTypeDigitalOutButton.IsChecked = true`. |
| `FilterUart` | `void FilterUart()` | Sets `filterTypeUartButton.IsChecked = true`. |
| `FilterStreamOut` | `void FilterStreamOut()` | Sets `filterTypeStreamOutButton.IsChecked = true`. |
| `FilterStreamIn` | `void FilterStreamIn()` | Sets `filterTypeStreamInButton.IsChecked = true`. |
| `FilterAll` | `void FilterAll()` | Sets `rbAll.IsChecked = true`. |
| `OnSetActive` | `void OnSetActive()` | Delegates to `_editObjectSensorsControl.OnSetActive()`. |
| `GetPageContent` | `object GetPageContent()` | Returns `this`. |
---
### EditTestSetupParameters
Control for editing channel parameters within a test setup. Implements `IPageContent` and `INotifyPropertyChanged`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `SetGroupChannelListViewModel` | `void SetGroupChannelListViewModel(IGroupChannelListViewModel vm)` | Sets the view model, configures capacity format, and assigns `SettingsView` to container. |
| `CurrentTest` | `DataModel.TestTemplate { get; set; }` | Gets/sets the current test template. |
| `Validate` | `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Validates channel parameters, checks squib delays, and sensor data currency. |
| `Validate` | `bool Validate(ref List<string> errors, ref List<string> warnings, DataModel.DASHardware[] hardware)` | Overload that performs actual validation logic. |
| `OnSetActive` | `void OnSetActive()` | Re-populates channels, applies settings, and sets filters. |
| `UnSet` | `void UnSet(Action OnComplete = null)` | Calls `_vm.Unset()`. |
| `GetPageContent` | `object GetPageContent()` | Returns `this`. |
**IPageContent Explicit Implementations:**
- `void IPageContent.SetPermissions(...)` - Controls visibility/enabled state based on permission levels.
- `bool IPageContent.KeyDown(...)` - Returns `false`.
- `void IPageContent.StartSearch(string)` - Empty.
- `bool IPageContent.OnButtonPress(PageButton)` - Returns `false`.
---
### EditTestSetupSysBuiltObjectsControl
Control for managing system-built test objects. Implements `IPageContent`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `CurrentTest` | `DataModel.TestTemplate` (DependencyProperty) | Gets/sets the current test template. |
| `UpdateChannelIndex` | `void UpdateChannelIndex(string sysBuiltTestObjectSerialNumberConverted, int channelTypesIndex)` | Updates `ChannelTypesIndex` on matching `AddedGroups`. |
| `UpdateObjectTemplate` | `void UpdateObjectTemplate(string sysBuiltTestObjectSerialNumberConverted, DataModel.TestObjectTemplate objectTemplate)` | Updates `Template` on matching `AddedGroups`. |
| `Validate` | `bool Validate(ref List<string> errors, bool displayWindow)` | Returns `true` (always valid). |
| `OnSetActive` | `void OnSetActive()` | Empty implementation. |
| `GetPageContent` | `object GetPageContent()` | Returns `this`. |
| `TestSetupNameValid` | `bool { get; set; }` | Gets/sets name validation state. |
| `ISOItemVisibility` | `Visibility { get; }` | Returns `Collapsed` if `ISOSupportLevel.NO_ISO`, otherwise `Visible`. |
**Event Handlers:**
- `ChannelType_Changed` - Creates new template, commits to collection, updates display order.
- `Position_Changed` - Updates position and calls `tto.SetSensors()`.
- `TestObjectChangePosition_Click` - Resets position to channel defaults.
---
### EditTestSetupGraphControl
Control for editing test setup graphs. Implements `IPageContent` and `INotifyPropertyChanged`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `AvailableChannels` | `GroupChannel[] { get; set; }` | Gets/sets channels available for graph assignment. |
| `SelectedGraph` | `TestGraph { get; set; }` | Gets/sets the currently selected graph. |
| `CurrentTest` | `TestTemplate { get; set; }` | Gets/sets the current test template. |
| `Validate` | `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true`. |
| `OnSetActive` | `void OnSetActive()` | Selects first graph if any exist. |
| `GetPageContent` | `object GetPageContent()` | Returns `this`. |
**Event Handlers:**
- `btnAddGraph_Click` - Adds new `TestGraph` with default name, publishes `PageModifiedEvent`.
- `btnGraphRemove_Click` - Removes graph, publishes `PageModifiedEvent`.
- `AvailableGraphChannelsAdd_Click` - Adds channel to graph, enforces 8-channel limit.
- `GraphChannelsRemove_Click` - Removes channel from graph.
- `lvExistingGraphs_SelectionChanged` - Manages graph selection state.
---
### EditTestSetupSysBuiltObjectsTypeControl
Control for managing system-built test object types. Implements `IPageContent` and `INotifyPropertyChanged`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `CurrentTest` | `DataModel.TestTemplate { get; set; }` | Gets/sets the current test template. |
| `UpdateObjectTemplate` | `void UpdateObjectTemplate(string, DataModel.TestObjectTemplate)` | Empty implementation (commented out). |
| `Validate` | `bool Validate(ref List<string> errors, bool displayWindow)` | Returns `true`. |
| `OnSetActive` | `void OnSetActive()` | Raises `OnPropertyChanged("ISOItemVisibility")`. |
| `GetPageContent` | `object GetPageContent()` | Returns `this`. |
| `TestSetupNameValid` | `bool { get; set; }` | Gets/sets name validation state. |
| `ISOItemVisibility` | `Visibility { get; }` | Returns `Collapsed` if `ISOSupportLevel.NO_ISO`, otherwise `Visible`. |
---
### TimedTriggersTable
Table control for displaying timed triggers. Inherits from `GenericTable2`.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Clear` | `void Clear()` | Clears the data table. |
| `UpdateList` | `void UpdateList(TestTemplate test, DASHardware[] hardwares = null)` | Populates table with hardware serial numbers, duration, start time, and status. |
| `UnSet` | `void UnSet()` | Clears all data rows. |
| `UpdateTable` | `void UpdateTable()` | Refreshes table display (dispatches to UI thread if needed). |
| `IsPassed` | `bool IsPassed(ref List<string> errors)` | Checks if all triggers passed; adds error message if any failed. |
**Nested Enums:**
- `Status` - `NA`, `Pass`, `Fail`
- `Locations` - `BasicInfo`, `ArmCheckList`
- `Fields` - `SerialNumber`, `Duration`, `StartDateTime`, `TimedTriggerText`, `Status`, `StatusEnum`
---
## 3. Invariants
1. **Graph Channel Limit**: A graph may contain at most 8 channels. Once this limit is reached, `AvailableChannels` is cleared (see `PopulateAvailableChannels` in `EditTestSetupGraphControl`).
2. **ROI Initialization Order**: Groups must be set before ROI data. Comment `FB16120` states: "Set Groups (and thus all channels) before setting ROI, ROI will be filtered if bad channel data."
3. **Hardware Lookup Keys**: In `EditTestSetupROIChannelsControl.SetData`, the `testHardwareLookup` dictionary uses `SerialNumber` as the key, preventing duplicate entries for the same hardware.
4. **Permission Level Comparison**: Permission checks use integer comparison: `(int)actualPermission < (int)requiredPermission` or `(int)actualPermission < (int)UserPermissionLevels.Read`.
5. **Channel Filtering**: Digital output channels are excluded from graph channel selection (comment `14046`).
6. **Table Location Behavior**: `TimedTriggersTable` only displays the `Status` column when `_myLocation == Locations.ArmCheckList`.
7. **Validation Return Values**: Several `Validate` methods always return `true` regardless of actual validation state (e.g., `EditTestSetupChannels`, `EditTestSetupGraphControl`, `EditTestSetupSysBuiltObjectsControl`).
---
## 4. Dependencies
### External Dependencies (from imports):
- **Prism Framework**: `Prism.Events`, `Prism.Ioc` - Event aggregation and IoC container location
- **Unity**: `Unity` - Dependency injection container (`IUnityContainer`)
- **C1.WPF.DataGrid**: Third-party grid control used by `TimedTriggersTable`
- **DTS.Common**: Core interfaces and utilities including:
- `DTS.Common.Interface.Channels`
- `DTS.Common.Interface.Groups` / `GroupList` / `GroupTemplate`
- `DTS.Common.Interface.RegionOfInterest` / `RegionOfInterestChannels`
- `DTS.Common.Interface.DataRecorders`
- `DTS.Common.Interface.Sensors`
- `DTS.Common.Interface.DASFactory`
- `DTS.Common.Enums.DASFactory`
- `DTS.Common.Events` / `RegionOfInterest`
- `DTS.Common.Storage`
- `DTS.Common.ISO`
- `DTS.Common.Utilities.Logging`
- `DTS.Common.SharedResource.Strings`
- **DTS.Slice.Users**: User permission types
- **DTS.SensorDB**: `SensorData`, `SensorsCollection`
### Internal Dependencies:
- `DataPROWin7.Common` - `SerializedSettings`, `IPageContent`, `PageButton`, `DataPROPage`, `BrushesAndColors`
- `DataPROWin7.DataModel` - `TestTemplate`, `TestGraph`, `TestTestObject`, `TestObjectTemplate`, `DASHardware`
- `DataPROWin7.DataModel.Classes.Hardware` - `DASHardwareList`
- `DataPROWin7.Strings` - `StringResources`
### Dependents (inferred):
- `EditTestSetupPage` - Referenced in `EditTestSetupSysBuiltObjectsControl.ChannelType_Changed`
- `HomePage` - Referenced for page navigation in event publishing
- `MainWindow` - Referenced for content retrieval
---
## 5. Gotchas
1. **Exception Re-throwing**: `EditTestSetupROIChannelsControl.SetData` catches and re-throws exceptions using `throw ex;`, which destroys the original stack trace. Should use `throw;` instead.
2. **Validation Methods Always Return True**: Multiple `Validate` methods return `true` unconditionally:
- `EditTestSetupChannels.Validate` (both overloads)
- `EditTestSetupGraphControl.Validate`
- `EditTestSetupSysBuiltObjectsControl.Validate`
- `EditTestSetupSysBuiltObjectsTypeControl.Validate`
This may indicate incomplete implementation or that validation is performed elsewhere.
3. **Empty IPageContent Implementations**: Many `IPageContent` methods are empty or return fixed values (`false`), suggesting the interface may be overly broad for some controls.
4. **Commented-Out Code**: Significant blocks of commented-out code exist in:
- `EditTestSetupChannels.OnSetActive`
- `EditTestSetupSysBuiltObjectsTypeControl` (multiple methods)
This suggests incomplete refactoring or feature toggles.
5. **Hard-coded Magic Number**: Graph channel limit of 8 is hard-coded in `EditTestSetupGraphControl.PopulateAvailableChannels` without a named constant.
6. **Dispatcher Check Pattern**: `TimedTriggersTable.UpdateTable` manually checks `Dispatcher.CheckAccess()` and uses `BeginInvoke`. This is a WPF threading pattern that could be simplified with modern async patterns.
7. **Private Constructor Pattern**: Several controls have a private parameterless constructor alongside a public constructor with parameters (e.g., `EditTestSetupChannels`, `EditTestSetupParameters`), likely for XAML designer support.
8. **ISO Visibility Coupling**: `ISOItemVisibility` property is duplicated across `EditTestSetupSysBuiltObjectsControl` and `EditTestSetupSysBuiltObjectsTypeControl` with identical logic.

View File

@@ -0,0 +1,180 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Classes/IValidatorImportingTestSetupTemplate.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/HardwareScanThreadData.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/ISFSensorList.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/ReadFileThreadData.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/ISFSensor.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/LevelTriggerAxes.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/ImportingTestSetupTemplate.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/DataExportsTemplate.cs
- DataPRO/DataPRO/Controls/TestSetups/Classes/LevelTriggerCapableChannel.cs
generated_at: "2026-04-17T15:49:46.578474+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "d01af75c6e262194"
---
# Documentation: DataPRO.Controls.TestSetups.Classes
## 1. Purpose
This module provides data models, interfaces, and thread coordination classes supporting the TestSetups control system in DataPRO. It handles test setup template import validation, sensor information display, hardware scanning thread synchronization, file reading operations, level trigger channel configuration, and data export configuration. The classes serve as ViewModels and data transfer objects that bridge the UI layer with underlying business logic for test setup management workflows.
---
## 2. Public Interface
### IValidatorImportingTestSetupTemplate (Interface)
**File:** `IValidatorImportingTestSetupTemplate.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ValidateList` | `void ValidateList()` | Validates the entire import list; called by child elements when names change. |
| `SetProcessFailedStatus` | `void SetProcessFailedStatus()` | Sets the process status to failed; called after control changes. |
| `CheckForDuplicatesInImport` | `int CheckForDuplicatesInImport(string importingTestSetupName)` | Returns count of duplicates for the given test setup name in the import list. |
---
### HardwareScanThreadData
**File:** `HardwareScanThreadData.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `DoneEvent` | `ManualResetEvent DoneEvent { get; }` | Read-only event for signaling thread completion. |
| Constructor | `HardwareScanThreadData(ManualResetEvent doneEvent)` | Initializes with the specified completion event. |
---
### ISFSensorList
**File:** `ISFSensorList.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Status` | `string Status { get; set; }` | Status label (e.g., "Found", "Missing", "Extra"). |
| `Sort` | `int Sort { get; set; }` | Sort order for UI display. |
| `Error` | `bool Error { get; set; }` | Indicates if this list represents an error condition. |
| `Sensors` | `List<ISFSensor> Sensors { get; set; }` | Collection of sensors in this list. |
---
### ReadFileThreadData
**File:** `ReadFileThreadData.cs`
| Member | Signature | Description |
|--------|-----------|-------------|
| `File` | `string File { get; }` | Read-only file path to read. |
| `DoneEvent` | `ManualResetEvent DoneEvent { get; }` | Read-only event for signaling read completion. |
| `CancelEvent` | `ManualResetEvent CancelEvent { get; }` | Read-only event for signaling cancellation. |
| Constructor | `ReadFileThreadData(string file, ManualResetEvent doneEvent, ManualResetEvent cancelEvent)` | Initializes with file path and synchronization events. |
---
### ISFSensor
**File:** `ISFSensor.cs`
**Base Class:** `DTS.Common.Base.BasePropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Number` | `string Number { get; set; }` | Sensor number with property change notification. |
| `Description` | `string Description { get; set; }` | Sensor description. |
| `SerialNumber` | `string SerialNumber { get; set; }` | Sensor serial number. |
| `Type` | `string Type { get; set; }` | Sensor type. |
| `EID` | `string EID { get; set; }` | Sensor EID (Equipment ID). |
| `Location` | `string Location { get; set; }` | Sensor location. |
| Constructor | `ISFSensor()` | Default constructor; initializes all string fields to empty. |
---
### LevelTriggerAxes
**File:** `LevelTriggerAxes.cs`
**Base Class:** `BasePropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `OutsideValueTextChanged` | `static event EventHandler<Tuple<string, string>> OutsideValueTextChanged` | Static event raised when outside value changes; tuple contains (DasSerial, value). |
| `DasSerial` | `string DasSerial { get; set; }` | DAS serial number identifier. |
| `Units` | `string Units { get; set; }` | Engineering units. |
| `OutsideValueText` | `string OutsideValueText { get; set; }` | Formatted absolute value of outside threshold; setter parses input and raises static event. |
| `ZeroMethodText` | `string ZeroMethodText { get; set; }` | Zero method description. |
| `MaximumRangeText` | `string MaximumRangeText { get; set; }` | Maximum range text. |
| `ChannelName` | `string ChannelName { get; }` | Computed as `"{DasSerial}-{StringResources.Acceleration}"`. |
| `IsCheckBoxAxis1Checked` | `bool IsCheckBoxAxis1Checked { get; set; }` | Axis 1 checkbox state. |
| `IsCheckBoxAxis2Checked` | `bool IsCheckBoxAxis2Checked { get; set; }` | Axis 2 checkbox state. |
| `IsCheckBoxAxis3Checked` | `bool IsCheckBoxAxis3Checked { get; set; }` | Axis 3 checkbox state. |
---
### ImportingTestSetupTemplate
**File:** `ImportingTestSetupTemplate.cs`
**Base Class:** `BasePropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Parent` | `ImportTestSetup Parent { get; set; }` | Reference to parent control for validation callbacks. |
| `IncludedCheckBox` | `bool IncludedCheckBox { get; set; }` | Whether to include this template in import; defaults to `true`. |
| `OverwriteCheckBox` | `bool OverwriteCheckBox { get; set; }` | Whether to overwrite existing template; defaults to `false`. |
| `OriginalTestSetupName` | `string OriginalTestSetupName { get; set; }` | Original name from imported file. |
| `ImportingTestSetupName` | `string ImportingTestSetupName { get; set; }` | Name to use for import (may differ from original). |
| `TestSetupExists` | `bool TestSetupExists { get; set; }` | True if a template with this name already exists in the system. |
| `TestSetupExistsAndIncluded` | `bool TestSetupExistsAndIncluded { get; set; }` | Computed: exists AND included; setter unchecks OverwriteCheckBox when set to false. |
| `TestSetupImportDuplicate` | `bool TestSetupImportDuplicate { get; set; }` | True if this name duplicates another in the import list. |
| `IsValid` | `bool IsValid { get; set; }` | Validation state for this template entry. |
| `ControlChangedCommand` | `DelegateCommand<object> ControlChangedCommand { get; }` | Command handling CheckBox/TextBox changes; routes to `ControlChangedMethod`. |
| `UpdateImportingTestSetupListElement` | `void UpdateImportingTestSetupListElement()` | Recalculates TestSetupExists, TestSetupImportDuplicate, TestSetupExistsAndIncluded, and IsValid. |
| `Validate` | `bool Validate()` | Returns current IsValid state. |
---
### DataExportsTemplate
**File:** `DataExportsTemplate.cs`
**Base Class:** `BasePropertyChanged`
| Member | Signature | Description |
|--------|-----------|-------------|
| `Parent` | `EditTestSetupInfoControl Parent { get; set; }` | Reference to parent control for setting export flags. |
| `ExportType` | `string ExportType { get; set; }` | Export type identifier. |
| `ExportFormat` | `DataModel.SupportedExportFormats ExportFormat { get; set; }` | Export format (csv, xlsx, iso, tsv, tts, hdf, ddas, chapter10, asc, diadem, tdas, rdf, tdms). |
| `UnfilteredEUCheckBox` | `bool UnfilteredEUCheckBox { get; set; }` | Unfiltered engineering units export option; defaults to `true`. |
| `UnfilteredEUExportSupported` | `bool UnfilteredEUExportSupported { get; set; }` | Whether format supports unfiltered EU export. |
| `FilteredEUCheckBox` | `bool FilteredEUCheckBox { get; set; }` | Filtered engineering units export option; defaults to `true`. |
| `FilteredEUExportSupported` | `bool FilteredEUExportSupported { get; set; }` | Whether format supports filtered EU export. |
| `MVCheckBox` | `bool MVCheckBox { get; set; }` | Measured values export option; defaults to `true`. |
| `MVExportSupported` | `bool MVExportSupported { get; set; }` | Whether format supports MV export. |
| `ADCCheckBox` | `bool ADCCheckBox { get; set; }` | ADC values export option; defaults to `true`. |
| `ADCExportSupported` | `bool ADCExportSupported { get; set; }` | Whether format supports ADC export. |
| `ActualPermission` | `DTS.Slice.Users.User.UserPermissionLevels ActualPermission { get; set; }` | Current user's permission level; defaults to `Deny`. |
| `RequiredPermission` | `DTS.Slice.Users.User.UserPermissionLevels RequiredPermission { get; set; }` | Required permission for export; defaults to `Edit`. |
| `Permitted` | `bool Permitted => (int)ActualPermission >= (int)RequiredPermission` | Computed permission check. |
| `PermittedAndUnfilteredEUExportSupported` | `bool PermittedAndUnfilteredEUExportSupported` | Computed: Permitted AND UnfilteredEUExportSupported. |
| `PermittedAndFilteredEUExportSupported` | `bool PermittedAndFilteredEUExportSupported` | Computed: Permitted AND FilteredEUExportSupported. |
| `PermittedAndMVExportSupported` | `bool PermittedAndMVExportSupported` | Computed: Permitted AND MVExportSupported. |
| `PermittedAndADCExportSupported` | `bool PermittedAndADCExportSupported` | Computed: Permitted AND ADCExportSupported. |
| `ControlChangedCommand` | `DelegateCommand<object> ControlChangedCommand { get; }` | Command handling CheckBox changes; updates parent's export flags based on ExportFormat. |
---
### LevelTriggerCapableChannel
**File:** `LevelTriggerCapableChannel.cs`
**Base Class:** `BasePropertyChanged`
**Implements:** `IComparable<LevelTriggerCapableChannel>`
| Member | Signature | Description |
|--------|-----------|-------------|
| `HardwareChannel` | `DataModel.HardwareChannel HardwareChannel { get; }` | Read-only hardware channel reference. |
| `DASOrModuleSerialNumber` | `string DASOrModuleSerialNumber { get; }` | Returns module serial for TDAS_Pro_Rack/TDAS_LabRack; otherwise hardware serial. |
| `ToISOLevelTriggerChannel` | `DTS.Common.ISO.LevelTriggerChannel ToISOLevelTriggerChannel()` | Converts this instance to ISO LevelTriggerChannel; handles TSR AIR High G special cases. |
| `FromISOLevelTriggerChannel` | `void FromISOLevelTriggerChannel(DTS.Common.ISO.LevelTriggerChannel channel)` | Populates this instance from ISO LevelTriggerChannel; handles TSR AIR special cases. |
| `SetTestSetupLevelTriggerChannel` | `void SetTestSetupLevelTriggerChannel(DTS.Common.ISO.LevelTriggerChannel channel)` | Sets and loads from ISO LevelTriggerChannel. |
| `GetSensorCapacity` | `double GetSensorCapacity()` | Returns channel range from GroupChannel or 0. |
| `MaximumRangeText` | `string MaximumRangeText { get; }` | Formatted capacity with units; special handling for TSR AIR. |
| `ZeroMethodText` | `string ZeroMethodText { get; }` | Formatted zero method from calibration. |
| `GroupName` | `string GroupName { get; }` | Display name of associated group. |
| `ChannelName` | `string ChannelName { get; }` | Channel name from GroupChannel. |
| `Selected` | `bool Selected { get; set; }` | Selection state; triggers UI color updates. |
| `BackgroundColor` | `Color BackgroundColor { get; }` | Color based on Selected state. |
| `ForegroundColor` | `Color ForegroundColor { get; }` | Color based on Selected state. |
| `TriggerBetweenBounds` | `bool TriggerBetweenBounds { get; set; }` | Enable trigger between bounds; updates ISO object and page state. |
| `TriggerOutsideBounds` | `bool TriggerOutsideBounds { get; set; }` | Enable trigger outside bounds; updates ISO object and page state. |
| `IsLessThanThresholdEnabled` | `bool IsLessThanThresholdEnabled { get; set; }` | Less-than threshold enable state. |
| `IsGreatherThanThresholdEnabled` | `bool IsGreather

View File

@@ -0,0 +1,40 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Enums/Enums.cs
generated_at: "2026-04-17T16:14:35.888908+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0f021ae27b176de1"
---
# Enums
### Purpose
This module serves as a centralized container for enumeration types used within the TestSetups control subsystem. It represents an initial effort to consolidate enums into a single class location, as indicated by the source comments. Currently, it defines sensor status states for ISF (presumably "In-Service Filter" or similar domain-specific component) sensor tracking.
### Public Interface
**Class: `Enums`**
- Namespace: `DataPROWin7.Controls`
- A static-style container class for enumeration definitions.
**Enum: `Enums.ISFSensors`**
- Values:
- `Found = 2` — Sensor is present as expected
- `Missing = 0` — Sensor is absent when expected
- `Extra = 1` — Sensor is present when not expected
- Underlying type: `int` (default)
### Invariants
- Enum values are explicitly assigned: `Missing = 0`, `Extra = 1`, `Found = 2`. This ordering is intentional and must be preserved for any switch statements or comparisons relying on numeric values.
- The enum values do not follow a sequential 0, 1, 2 pattern semantically (Found is 2, not 1).
### Dependencies
- **Depends on**: `System`, `System.Collections.Generic`, `System.Linq`, `System.Text`, `System.Threading.Tasks` (all imported, though only `System` is actively used).
- **Depended on by**: `ISFSensorsTable<T>` in the ISFImpotTables module.
### Gotchas
- The class XML comment states "first attempt to move Enums into one class," suggesting this may be a work in progress or that other enums may exist elsewhere in the codebase.
- The enum name `ISFSensors` is plural but represents individual sensor states, not a collection.
---

View File

@@ -0,0 +1,43 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/ISFImpotTables/ISFSensorsTable.cs
generated_at: "2026-04-17T16:14:35.891607+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a55cb63c6832cad8"
---
# ISFImpotTables
### Purpose
This module provides a specialized table control for displaying ISF sensor data in the UI. It renders sensor information with visual styling (header colors) that varies based on the sensor status (Extra, Found, Missing). The table is read-only and designed for display purposes within a parent `StackPanel`.
### Public Interface
**Class: `ISFSensorsTable<T>`**
- Namespace: `DataPROWin7.Controls`
- Inherits from: `GenericTable`
**Constructor: `ISFSensorsTable(DataPROPage page, StackPanel parent, string id, string name, List<T> tableData)`**
- Creates a new sensor table instance.
- Parameters:
- `page` — The parent `DataPROPage` context.
- `parent` — The `StackPanel` to which the table and its header label will be added.
- `id` — Unique identifier for the table (assigned to `Uid`).
- `name` — Table name used for display and enum parsing (assigned to `Name`).
- `tableData` — Generic list of data items to populate the table.
### Invariants
- The `name` parameter must match one of the `Enums.ISFSensors` values (`"Extra"`, `"Found"`, or `"Missing"`) to receive custom header styling.
- If `name` does not parse to a valid `ISFSensors` enum value, no custom header colors are applied.
- The table is always created as read-only with `SelectionMode = None`.
- The table and its label are always added to `parent` and `parent.Visibility` is set to `Visible`.
### Dependencies
- **Depends on**:
- `System.ComponentModel`
- `System.Windows` (`Visibility`, `HorizontalAlignment`, `StackPanel`, `Label`, `Control`, `Brushes`)
- `System.Windows.Controls`
- `C1.WPF.DataGrid` (third-party ComponentOne DataGrid)
- `DTS.Common` (provides `GenericTable` base class)
- `Enums.ISFSensors`

View File

@@ -0,0 +1,130 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/WizardHelper.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/StatusUpdater.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ParseImportFactory.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ImportFunctions.cs
generated_at: "2026-04-17T15:54:06.199444+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b4acfe6e33b354f9"
---
# Import Module Documentation
## 1. Purpose
This module provides infrastructure for importing test setup configurations into the DataPRO application. It encompasses UI status updates during import operations, factory-based parser creation for multiple file formats (CSV, E2X, XML), hardware discovery and validation for connected Data Acquisition Systems (DAS), and error reporting utilities. The module serves as the orchestration layer between user import requests, file parsing, hardware validation, and UI feedback during the import workflow.
---
## 2. Public Interface
### WizardHelper (static class)
| Method | Signature | Description |
|--------|-----------|-------------|
| `ReportErrors` | `void ReportErrors(List<string> errors)` | Deduplicates the input error list, joins them with newlines, and displays them via `App.DoMessageBox` with a single OK button. |
### StatusUpdater
| Method | Signature | Description |
|--------|-----------|-------------|
| Constructor | `StatusUpdater(StatusAndProgressBarViewModel statusAndProgressBarViewModel)` | Initializes the updater with a reference to the view model for status/progress binding. |
| `SetProgress` | `void SetProgress(double progressValue)` | Sets the progress bar value. Accepts either decimals (≤1, multiplied by 100) or percentages. Clamps values to 0100 range. |
| `GetStatusString` | `static string GetStatusString(PossibleStatus status, ImportExtraStatus importExtraStatus)` | Retrieves a localized status string from `StringResources` based on the status enums. Appends extra status info in parentheses for specific `ImportExtraStatus` values. |
| `SetStatus` | `void SetStatus(PossibleStatus status, ImportExtraStatus importExtraStatus, string error)` | Sets status text, color, progress visibility based on `PossibleStatus` enum. Updates the view model via `UpdateStatusAndProgress`. |
### ParseImportFactory
| Method | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ParseImportFactory(IImportNotification importNotification, User user, Func<bool> isCancelled)` | Initializes the factory with notification handler, user context, and cancellation check delegate. |
| `CreateParseImport` | `IParseImport CreateParseImport(string fileName)` | Factory method that determines file type by extension and returns the appropriate `IParseImport` implementation. Throws `NotSupportedImportFileException` for unsupported extensions or when ISF import is attempted with ISO code requirements. |
| `CsvImportOptions` | Property: `CsvImportOptions` (get/set) | Configuration options for CSV import. |
| `EqxImportOptions` | Property: `EqxImportOptions` (get/set) | Configuration options for EQX/E2X import. |
### NotSupportedImportFileException
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `NotSupportedImportFileException(string extension)` | Creates exception with message indicating unsupported file extension. |
| Serialization Constructor | `protected NotSupportedImportFileException(SerializationInfo info, StreamingContext context)` | Standard serialization constructor. |
### ImportFunctions (abstract class)
| Method | Signature | Description |
|--------|-----------|-------------|
| `DasSerialToConfigurationData` | `static Dictionary<string, ConfigurationData>` (property) | Maps DAS serial numbers to their configuration data. |
| `Hardware` | `static List<DASHardware>` (property) | List of discovered hardware. |
| `PingSweep` | `static void PingSweep(Dictionary<string, HardwareDiscoveryControl.DASHelper> dasDictionary, bool bDoQueryConfig, SetProgressValueDelegate setProgress, SetStatusTextDelegate setStatus, HardwareDiscoveryTable includedTable, HardwareDiscoveryTable availableTable, List<DASHardware> hardwareList, SetProgressVisibilityDelegate setProgressVisibility, SetStatusColorDelegate setStatusColor, DataPROPage page, HardwareDiscoveryControl.IsCanceledCheckDelegate cancelCheck, ActionCompleteDelegate pingComplete)` | Performs network ping sweep to discover DAS hardware. Populates tables and dictionary with discovered devices. |
| `CheckForArmedAndSafe` | `static bool CheckForArmedAndSafe(HardwareDiscoveryTable includedTable, Action ImportArmedAction, Action factoryChangedAction, DataPROPage page)` | Returns `true` if any connected DAS are armed. Ensures TOM switches are in SAFE position. Shows warnings to user if issues detected. |
| `HardwareScanRun` | `static void HardwareScanRun(DataPROPage page, SetProgressVisibilityDelegate setProgressVisibility, SetStatusColorDelegate setStatusColor, HardwareDiscoveryControl.IsCanceledCheckDelegate cancelCheck, ActionCompleteDelegate pingComplete, SetProgressValueDelegate setProgress, SetStatusTextDelegate setStatus, HardwareDiscoveryTable includedTable, HardwareDiscoveryTable availableTable)` | Main entry point for hardware scanning. Orchestrates ping sweep, armed/safe checks, docking station validation, and hardware population. |
| `PopulateDasSerialToConfigurationData` | `static void PopulateDasSerialToConfigurationData()` | Populates `DasSerialToConfigurationData` from active DAS devices. |
| `GetStatusColor` | `static SolidColorBrush GetStatusColor(string color)` | Converts voltage status color string (`Red`, `Yellow`, `Green`) to corresponding `SolidColorBrush`. |
---
## 3. Invariants
### StatusUpdater
- `SetProgress` always clamps the progress value to the range [0, 100].
- If `progressValue <= 1`, it is treated as a decimal and multiplied by 100; otherwise, it is treated as a percentage.
- `SetStatus` always sets `AggregateStatusText` and `AggregateStatusColor`; progress visibility and error text are conditional.
### ParseImportFactory
- `CreateParseImport` throws `ArgumentNullException` if `fileName` is null or empty.
- `CreateParseImport` throws `ArgumentException` if the file does not exist.
- `CreateParseImport` throws `NotSupportedImportFileException` for unsupported file extensions (not `.csv`, `.e2x`, or `.xml`).
- ISF file import is blocked when `SerializedSettings.UniqueISOCodesRequired` and `SerializedSettings.ShowISOCodes` are both `true`.
### ImportFunctions
- `DasSerialToConfigurationData` is cleared and repopulated by `PopulateDasSerialToConfigurationData`.
- `Hardware` list is populated by `HardwareScanRun`.
- `CheckForArmedAndSafe` returns `true` if any DAS is armed, preventing further import steps.
- `AnySwitchedToArm` returns `true` on exception (fail-safe behavior).
---
## 4. Dependencies
### Direct Dependencies (imports)
| Module | Dependencies |
|--------|--------------|
| **WizardHelper** | `System.Windows.Application`, `App` (application class), `System.Collections.Generic`, `System.Linq` |
| **StatusUpdater** | `StatusAndProgressBarViewModel`, `DTS.Common.Import.Enums.PossibleStatus`, `DTS.Common.Import.Enums.ImportExtraStatus`, `DTS.Common.SharedResource.Strings.StringResources`, `DTS.Common.BrushesAndColors`, `System.Windows`, `System.Windows.Media` |
| **ParseImportFactory** | `IImportNotification`, `User`, `ImportObject`, `IParseImport`, `IParseVariant`, `CsvImportOptions`, `EqxImportOptions`, `DTSXMLParseImport`, `DefaultParseImport`, `DTSCSVSensorsParser`, `DTSCSVTestSetupParser`, `EQXSensorsParser`, `EQXTestSetupParser`, `EquipmentExchange.EQXSensorDatabase`, `CalibrationImport`, `ZeroMethodOptions`, `TestSetupImportData`, `TestSetupDefaults`, `SerializedSettings`, `APILogger`, `App` |
| **ImportFunctions** | `HardwareDiscoveryControl`, `DASHardware`, `ConfigurationData`, `IDASCommunication`, `EthernetTDAS`, `DASFactory`, `DataPROPage`, `ConfigurationService`, `DFConstantsAndEnums`, `BrushesAndColors`, `StringResources`, `APILogger`, `App` |
### External Systems/Modules Referenced
- `DTS.Common.Import` namespace (parsers, interfaces, options)
- `DTS.Slice.Users` (User class, user settings)
- `DTS.DASLib.Service` (ConfigurationService, ServiceBase)
- `DTS.Common.Utilities.Logging` (APILogger)
- `DTS.Common.Settings` (SerializedSettings)
---
## 5. Gotchas
### StatusUpdater.SetProgress Inconsistency
The `SetProgress` method handles both decimal (0.01.0) and percentage (0100) inputs due to inconsistent calling patterns in the codebase. The comment explicitly states: *"some things are apparently calling this with percents and some with decimals"*. This is tech debt that could cause confusion.
### Unreachable Code in CreateParseImport
The `CreateParseImport` method contains unreachable code: after the `switch` statement, there is a `throw new NotSupportedImportFileException(fileExtension)` that will never execute because all code paths in the switch either return or throw.
### ImportFunctions.AnySwitchedToArm Exception Handling
The method catches all exceptions and returns `true`. The comment acknowledges this is a conservative fail-safe: *"This could return True when no DAS is switched to ARM, but it's better than the alternative - returning False when some DAS is switched to ARM!"*
### Hardcoded Resource Key Pattern
`GetStatusString` uses string concatenation for resource keys (`"ExportTestSetup_" + status` and `$"IMPORT_{importExtraStatus}"`). Changes to enum values must be coordinated with resource file keys.
### UI Thread Blocking in PingSweep
`PingSweep` uses `ManualResetEvent.WaitOne()` to block while waiting for dispatcher operations. This could cause deadlocks if called from the UI thread.
### Empty Lambda in CheckForArmedAndSafe
The `ImportArmedAction` callback passed in `HardwareScanRun` is an empty lambda `() => { }`, suggesting incomplete implementation or dead code path.
### File Extension Case Sensitivity
`CreateParseImport` normalizes file extensions to lowercase, but the comparison logic depends on `TrimStart('.')` which could fail if the extension has unexpected formatting.

View File

@@ -0,0 +1,139 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/UserISOUtility.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/DigitalInputPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/SquibPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/AnalogPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/DASPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/DigitalOutputPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/SensorsPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/SummaryRowHelper.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Classes/GroupChannelHelper.cs
generated_at: "2026-04-17T15:49:39.114457+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e9e7933e368dfce9"
---
# Documentation: DataPRO Import Channel Population Module
## 1. Purpose
This module handles the population and synchronization of channel data during test setup imports in DataPRO. It provides classes for different channel types (Analog, Digital Input/Output, Squib) that implement common interfaces (`ISensorsPopulateChannels`, `IDASPopulateChannels`) to populate channel models from hardware configurations and sensor data. The module also includes utility classes for ISO/User code visibility, summary row generation for import results, and group channel management within test templates.
---
## 2. Public Interface
### UserCodeISOUtility (static class)
| Method | Signature | Description |
|--------|-----------|-------------|
| `ShowUserCode` | `public static bool ShowUserCode()` | Returns `true` if `IsoViewMode.ISOAndUserCode` or `IsoViewMode.UserCodeOnly` is set in `Common.SerializedSettings.ISOViewMode`. |
| `ShowISOCode` | `public static bool ShowISOCode()` | Returns `true` if `IsoViewMode.ISOAndUserCode` or `IsoViewMode.ISOOnly` is set in `Common.SerializedSettings.ISOViewMode`. |
### DigitalInputPopulateChannels
| Member | Signature | Description |
|--------|-----------|-------------|
| `HardwareChannelIdToSensorId` | `public Dictionary<string, string> { get; set; }` | Mapping of hardware channel IDs to sensor IDs. |
| `TestSetup` | `public TestTemplate { get; set; }` | The test template being populated. |
| `Sensors` | `public IEnumerable<SensorData> { get; set; }` | Collection of sensor data. |
| `PopulateDASChannels` | `public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates DAS channels filtered by `IHardwareChannel.IsDigitalIn`, delegating to `DASPopulateChannels`. |
| `PopulateSensorsChannels` | `public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates sensor channels filtered by `SensorData.IsDigitalInput()`, delegating to `SensorsPopulateChannels`. |
### SquibPopulateChannels
| Member | Signature | Description |
|--------|-----------|-------------|
| `HardwareChannelIdToSensorId` | `public Dictionary<string, string> { get; set; }` | Mapping of hardware channel IDs to sensor IDs. |
| `TestSetup` | `public TestTemplate { get; set; }` | The test template being populated. |
| `Sensors` | `public IEnumerable<SensorData> { get; set; }` | Collection of sensor data. |
| `PopulateDASChannels` | `public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates DAS channels filtered by `IHardwareChannel.IsSquib`, delegating to `DASPopulateChannels`. |
| `PopulateSensorsChannels` | `public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates sensor channels filtered by `SensorData.IsSquib()`, delegating to `SensorsPopulateChannels`. |
### AnalogPopulateChannels
| Member | Signature | Description |
|--------|-----------|-------------|
| `HardwareChannelIdToSensorId` | `public Dictionary<string, string> { get; set; }` | Mapping of hardware channel IDs to sensor IDs. |
| `TestSetup` | `public TestTemplate { get; set; }` | The test template being populated. |
| `Sensors` | `public IEnumerable<SensorData> { get; set; }` | Collection of sensor data. |
| **Constructor** | `public AnalogPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId)` | Initializes with the hardware-to-sensor mapping. |
| `PopulateDASChannels` | `public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates DAS channels filtered by `IHardwareChannel.IsAnalog`, delegating to `DASPopulateChannels`. |
| `PopulateSensorsChannels` | `public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates sensor channels filtered by `SensorData.IsAnalog()`, delegating to `SensorsPopulateChannels`. |
### DASPopulateChannels
| Member | Signature | Description |
|--------|-----------|-------------|
| `HardwareChannelIdToSensorId` | `public Dictionary<string, string> { get; set; }` | Mapping of hardware channel IDs to sensor IDs. |
| `TestSetup` | `public TestTemplate { get; set; }` | The test template being populated. |
| `Sensors` | `public IEnumerable<SensorData> { get; set; }` | Collection of sensor data. |
| **Constructor** | `public DASPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId, Predicate<IHardwareChannel> hardwareChannelFilter)` | Initializes with mapping and filter predicate. |
| `PopulateDASChannels` | `public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Core implementation that iterates hardware, applies filter, skips SLICE Ethernet controllers, skips odd-numbered Squib channels, creates `DASChannelModel` instances, maps EIDs, and populates the output dictionary. |
### DigitalOutputPopulateChannels
| Member | Signature | Description |
|--------|-----------|-------------|
| `HardwareChannelIdToSensorId` | `public Dictionary<string, string> { get; set; }` | Mapping of hardware channel IDs to sensor IDs. |
| `TestSetup` | `public TestTemplate { get; set; }` | The test template being populated. |
| `Sensors` | `public IEnumerable<SensorData> { get; set; }` | Collection of sensor data. |
| **Constructor** | `public DigitalOutputPopulateChannels(Dictionary<string, string> hardwareChannelIdToSensorId)` | Initializes with the hardware-to-sensor mapping. |
| `PopulateDASChannels` | `public IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Populates digital output channels, sets properties from existing `IGroupChannel` (DigitalOutputMode, DigitalOutputDurationMs, DigitalOutputDelayMs, LimitDuration, UserChannelName, CustomCode, ISOChannelName, ISOCode), subscribes to `DigitalOutputChannelChanged` event. |
### SensorsPopulateChannels
| Member | Signature | Description |
|--------|-----------|-------------|
| **Constructor** | `public SensorsPopulateChannels(Predicate<SensorData> channelTypeFilter)` | Initializes with a sensor filter predicate. |
| `GetSensorToChannels` | `public Dictionary<int, List<IGroupChannel>> GetSensorToChannels(TestTemplate testTemplate, ref List<IGroupChannel> groupChannels)` | Extracts channels from test template, removes entries with `SensorId == 0`, returns dictionary grouped by sensor ID. |
| `BuildHardwareLookup` | `public void BuildHardwareLookup(IEnumerable<DASHardware> hardware, ref List<IGroupChannel> groupChannels)` | Links hardware channels to group channels using `DASId` and `DASChannelIndex`. |
| `PopulateSensorsChannels` | `public IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` | Orchestrates channel population: retrieves group channels, builds hardware lookup, filters sensors, and builds assigned channels. |
### SummaryRowHelper (static class)
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetSummaries` | `public static void GetSummaries(ref List<SummaryRow> found, ref List<SummaryRow> missing, ref List<SummaryRow> extra, List<IDASCommunication> das, ImportObject importObject)` | Main entry point that populates found/missing/extra summary rows for import results. |
| `GetChannelName` | `public static string GetChannelName(IsoViewMode isoViewMode, ISensorData sd)` | Builds channel name using `GroupChannel.BuildChannelName` based on ISO view mode. |
### GroupChannelHelper (static class)
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateGroupChannelsInTestTemplate` | `public static void UpdateGroupChannelsInTestTemplate(IEnumerable<DASChannelModel> analogDasChannels, IEnumerable<DASChannelModel> squibDasChannels, IEnumerable<DASChannelModel> digitalOutputDasChannels, IEnumerable<DASChannelModel> digitalInputDasChannels, ref TestTemplate testTemplate, IEnumerable<SensorData> sensors)` | Synchronizes group channels in the test template with populated DAS channel models. Updates existing channels, creates new ones for newly assigned sensors, and removes channels with no sensor assignment. |
---
## 3. Invariants
1. **Channel Type Filtering**: Each channel populator class filters by a specific channel type property (`IsDigitalIn`, `IsSquib`, `IsAnalog`, `IsDigitalOut`) on `IHardwareChannel` and corresponding methods (`IsDigitalInput()`, `IsSquib()`, `IsAnalog()`, `IsDigitalOutput()`) on `SensorData`.
2. **Squib Odd Channel Skip**: In `DASPopulateChannels.PopulateDASChannels`, Squib channels with odd channel numbers (`ch.ChannelNumber % 2 == 1`) are always skipped (per FB 43723).
3. **SLICE Controller Exclusion**: Hardware with `IsSLICEEthernetController == true` is always skipped in `DASPopulateChannels.PopulateDASChannels`.
4. **SensorId Zero Removal**: In `SensorsPopulateChannels.GetSensorToChannels`, group channels with `SensorId == 0` are removed from the list.
5. **Hardware Channel Index Bounds**: In `SensorsPopulateChannels.BuildHardwareLookup`, the `DASChannelIndex` must be `>= 0` and `< h.Channels.Length` to link hardware channels.
6. **Dictionary Key Uniqueness**: The `channelIdToDASChannel` dictionary uses `HardwareChannel.GetId()` as the key; duplicate keys would cause exceptions.
7. **Null Hardware Handling**: `DASPopulateChannels.PopulateDASChannels` and `DigitalOutputPopulateChannels.PopulateDASChannels` return empty lists if `hardware` is null.
---
## 4. Dependencies
### External Dependencies (Imports)
- **DTS.Common.Enums** - `IsoViewMode` enum
- **DTS.Common.Interface.DataRecorders** - `IDASHardware`, `IHardwareChannel`
- **DTS.Common.Interface.Channels** - `IGroupChannel`
- **DTS.Common.Interface.Sensors.SensorsList** - Sensor interfaces
- **DTS.Common.Import** - `ImportObject`
- **DTS.Common.Classes.Groups** - `GroupChannel`, `GroupList`
- **DTS.Common.SharedResource.Strings** - `StringResources`
- **DTS.Common.Utilities.Logging** - `APILogger`
- **DTS.SensorDB** - `SensorData`, `DASHardware`
- **DTS.DASLib.Service** - `IDASCommunication`, `IDASChannel`, `DASChannel`
- **DataPROWin7.DataModel** - `TestTemplate`
### Internal Dependencies
- **DataPROWin7.Controls.TestSetups.Import.Models** - `DASChannelModel`, `ChannelModel`, `SummaryRow`, `DigitalOutputChannelEventArgs`
- **Common.SerializedSettings** - Static settings access for `ISOViewMode`
### Implementations Provided
- `ISensorsPopulateChannels` - Implemented by `DigitalInputPopulateChannels`, `SquibPopulateChannels`, `AnalogPopulateChannels`,

View File

@@ -0,0 +1,66 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/Events/DisableNavStepsEventArgs.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Events/DigitalOutputChannelEventArgs.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Events/ImportTestSetupEventArgs.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Events/ImportProcessStatusEventArgs.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Events/ReadFileStatusEventArgs.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Events/HardwareScanEventArgs.cs
generated_at: "2026-04-17T16:11:25.308176+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "36c3dec16b172034"
---
# Events
### Purpose
This module defines a collection of `EventArgs`-derived classes used to communicate state changes and outcomes during the test setup import workflow. These event payloads facilitate communication between UI components and import logic, carrying information about navigation state, digital output channel changes, import process status, file reading results, and hardware scan outcomes.
### Public Interface
**DisableNavStepsEventArgs**
- `public bool Status { get; set; }` - Gets or sets a boolean indicating whether navigation steps should be disabled.
**DigitalOutputChannelEventArgs**
- `public bool Removed { get; set; }` - Gets or sets a boolean indicating whether a channel was removed.
- `public bool Added { get; set; }` - Gets or sets a boolean indicating whether a channel was added.
**ImportTestSetupEventArgs**
- `public ImportTestSetupEventArgs(string testSetupName)` - Constructor that initializes the `TestSetupName` property.
- `public string TestSetupName { get; set; }` - Gets or sets the name of the test setup being imported.
**ImportProcessStatusEventArgs**
- `public ImportProcessStatusEventArgs(bool status, string errorMessage = null)` - Constructor that initializes `Status` and optionally `ErrorMessage`.
- `public string ErrorMessage { get; set; }` - Gets or sets an error message; may be null for successful operations.
- `public bool Status { get; set; }` - Gets or sets the success/failure status of the import process.
**ReadFileStatusEventArgs**
- `public ReadFileStatusEventArgs(bool status, ImportObject importObject = null, string errorMessage = null)` - Constructor initializing status, optional `ImportObject`, and optional error message.
- `public ImportObject ImportObject { get; set; }` - Gets or sets the imported object; may be null on failure.
- `public string ErrorMessage { get; set; }` - Gets or sets an error message; may be null for successful operations.
- `public bool Status { get; set; }` - Gets or sets the success/failure status of the file read operation.
**HardwareScanEventArgs**
- `public HardwareScanEventArgs(bool status, List<DASHardware> hardware, ImportObject importObject = null, string erroeMessage = null)` - Constructor initializing all properties. Note: parameter is spelled `erroeMessage` (typo).
- `public List<DASHardware> Hardware { get; set; }` - Gets or sets the list of detected hardware.
- `public ImportObject ImportObject { get; set; }` - Gets or sets the associated import object; may be null.
- `public string ErrorMessage { get; set; }` - Gets or sets an error message; may be null for successful operations.
- `public bool Status { get; set; }` - Gets or sets the success/failure status of the hardware scan.
### Invariants
- All event args classes inherit from `System.EventArgs`.
- For `ImportTestSetupEventArgs`, `TestSetupName` is required at construction time (no default constructor).
- For `ImportProcessStatusEventArgs`, `ReadFileStatusEventArgs`, and `HardwareScanEventArgs`, `Status` is required at construction; `ErrorMessage` and object payloads are optional.
- `HardwareScanEventArgs.Hardware` is expected to be a valid `List<DASHardware>` instance passed at construction.
### Dependencies
- **Depends on**: `System`, `DTS.Common.Import` (for `ImportObject`), `DataPROWin7.DataModel` (for `DASHardware`), `System.Collections.Generic` (for `List<T>`).
- **Depended on by**: Unclear from source alone; likely consumed by event handlers in the TestSetups import subsystem.
### Gotchas
- **Typo in constructor parameter**: `HardwareScanEventArgs` constructor parameter is named `erroeMessage` (misspelled), though the property is correctly named `ErrorMessage`. This does not affect runtime behavior but may cause confusion during code maintenance.
- **Inconsistent namespace**: `ImportTestSetupEventArgs` is in namespace `DataPROWin7.Controls.TestSetups.Import`, while the other event args are in `DataPROWin7.Controls.TestSetups`. This may cause resolution issues if files are moved or refactored.
- **Mutable properties**: All properties have public setters, allowing event handlers to modify the payload after the event is raised.
---

View File

@@ -0,0 +1,54 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/Interfaces/ITestSetupValidation.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Interfaces/ISensorsPopulateChannels.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Interfaces/IDASPopulateChannels.cs
generated_at: "2026-04-17T16:11:16.194355+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a7e6d5f55dfb4ff9"
---
# Interfaces
### Purpose
This module defines three interfaces that establish contracts for test setup import operations, specifically for validating imported test setups and populating channel data for both sensors and Data Acquisition Systems (DAS). These interfaces enable dependency injection and testability of the import pipeline by abstracting the channel population and validation logic.
### Public Interface
**ITestSetupValidation**
- `void ValidateList()` - Validates a list of imported test setups. Behavior details unclear from source alone.
- `void SetProcessFailedStatus()` - Sets a failed status on the import process. Behavior details unclear from source alone.
- `int CheckForDuplicatesInImport(string importingTestSetupName)` - Checks for duplicate test setup names in the import. Returns an `int` (presumably a count or status code, but exact semantics unclear from source).
**ISensorsPopulateChannels**
- `IEnumerable<ChannelModel> PopulateSensorsChannels(TestTemplate testTemplate, IEnumerable<DASHardware> hardware, IEnumerable<SensorData> sensors, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` - Populates channel models for sensors given a test template, hardware collection, and sensor data. Modifies and returns a dictionary mapping channel IDs to DAS channel models via a ref parameter.
**IDASPopulateChannels**
- `Dictionary<string, string> HardwareChannelIdToSensorId { get; set; }` - Dictionary mapping hardware channel IDs to sensor IDs.
- `TestTemplate TestSetup { get; set; }` - The test setup being processed.
- `IEnumerable<SensorData> Sensors { get; set; }` - Collection of sensor data.
- `IEnumerable<DASChannelModel> PopulateDASChannels(TestTemplate testTemplate, IEnumerable<SensorData> sensors, List<DTS.Common.Interface.DataRecorders.IDASHardware> hardware, ref Dictionary<string, DASChannelModel> channelIdToDASChannel)` - Populates DAS channel models given test template, sensors, and hardware. Modifies and returns a dictionary via ref parameter.
### Invariants
- `IDASPopulateChannels` implementations must maintain the `HardwareChannelIdToSensorId` dictionary consistency when populating channels.
- The `ref Dictionary<string, DASChannelModel> channelIdToDASChannel` parameter in both populate methods must be initialized by the caller before invocation.
- `TagIDs` in `TagAwareBase` (from dependent module) never returns null; it defaults to an empty array.
### Dependencies
**Imports:**
- `DataPROWin7.Controls.TestSetups.Import.Models` - Channel model types
- `DataPROWin7.DataModel` - TestTemplate type
- `DTS.SensorDB` - SensorData, DASHardware types
- `DTS.Common.Import` - Import-related types
- `DTS.Common.Interface.DataRecorders` - IDASHardware interface
- `System.Collections.Generic` - Generic collections
**Dependents:** Cannot be determined from source alone, but likely consumed by test setup import service classes or presenters.
### Gotchas
- The return value semantics of `CheckForDuplicatesInImport` are not documented in source—could be a count, index, or boolean-equivalent code.
- `IDASPopulateChannels` has mutable properties (`HardwareChannelIdToSensorId`, `TestSetup`, `Sensors`) which suggests implementations may require property initialization before calling `PopulateDASChannels`.
- The dual existence of `ISensorsPopulateChannels` and `IDASPopulateChannels` suggests a separation of concerns, but the relationship between them (e.g., ordering, shared state) is unclear from source alone.
---

View File

@@ -0,0 +1,249 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/TestSetupModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/SummaryChannelModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/ChannelSummaryRow.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/SummaryRow.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/DASRow.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/DASSummaryRow.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/ChannelModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Models/DASChannelModel.cs
generated_at: "2026-04-17T15:50:43.967114+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "df352e2972417537"
---
# Documentation: DataPRO Test Setup Import Models
## 1. Purpose
This module provides the data model layer for the Test Setup Import feature in DataPRO. It contains model classes that represent channels, DAS (Data Acquisition System) hardware configurations, and summary statistics used during test setup import and configuration workflows. These models serve as intermediaries between raw sensor/hardware data and the WPF UI, implementing `INotifyPropertyChanged` and extending `BasePropertyChanged` to support data binding. The models encapsulate sensor calibration data, hardware channel assignments, squib/digital output configuration, and import validation state.
---
## 2. Public Interface
### TestSetupModel
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `DTS.Common.Base.BasePropertyChanged`
Root container model for test setup import data.
| Property | Type | Description |
|----------|------|-------------|
| `Channels` | `List<ChannelModel>` | Collection of channel models |
| `DASChannels` | `ObservableCollection<DASChannelModel>` | Observable collection of DAS channel models |
---
### SummaryChannelModel
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `DTS.Common.Base.BasePropertyChanged`
Model for channel type summary statistics (FB 34459).
| Property | Type | Description |
|----------|------|-------------|
| `ChannelType` | `string` | Type identifier for the channel |
| `Assigned` | `int` | Count of assigned channels |
| `Unassigned` | `string` | String representation of unassigned count |
---
### ChannelSummaryRow
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `BasePropertyChanged`
Row model for channel summary tables with validation coloring.
**Constructor:**
```csharp
public ChannelSummaryRow(string channelType, int requested, int assigned, int unassigned)
```
| Property | Type | Description |
|----------|------|-------------|
| `ChannelType` | `string` | Channel type identifier (read-only, set via constructor) |
| `Requested` | `int` | Total requested channel count |
| `Assigned` | `int` | Count of successfully assigned channels |
| `Unassigned` | `int` | Count of unassigned channels |
| `UnassignedColor` | `SolidColorBrush` | Returns `Brush_ApplicationStatus_Failed` if `Unassigned > 0`, otherwise `Brush_ApplicationStatus_Complete` |
| Method | Description |
|--------|-------------|
| `void AddCount(bool assigned)` | Increments `Requested`; if `assigned` is true increments `Assigned`, otherwise increments `Unassigned` |
---
### SummaryRow
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `DTS.Common.Base.BasePropertyChanged`
Record class for rows in Extra/Found/Missing tables in sensor import summary.
**Constructor:**
```csharp
public SummaryRow(int number, string description, string serialNumber, string sensorTag, string eid, string location)
```
| Property | Type | Description |
|----------|------|-------------|
| `Number` | `int` | Channel number (not index) if available |
| `Description` | `string` | Channel description if available |
| `SerialNumber` | `string` | Serial number of the sensor on the channel |
| `SensorTag` | `string` | Sensor tag identifier (e.g., CF, P4) |
| `EID` | `string` | Electronic ID on the sensor |
| `Location` | `string` | Physical hardware location of the sensor |
---
### DASRow
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `BasePropertyChanged`
Row model for DAS hardware information including voltage status and EID count.
**Constructor:**
```csharp
public DASRow(IDASCommunication das)
```
| Property | Type | Description |
|----------|------|-------------|
| `SerialNumberFamily` | `string` | Serial number from wrapped DASHardware |
| `EIDFound` | `int` | Count of valid EIDs found in module channels |
| `InputVoltageStatus` | `string` | Input voltage status string |
| `InputVoltageColor` | `SolidColorBrush` | Color brush for input voltage status |
| `BatteryVoltageStatus` | `string` | Battery voltage status string |
| `BatteryVoltageColor` | `SolidColorBrush` | Color brush for battery voltage status |
---
### DASSummaryRow
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `BasePropertyChanged`
Aggregates DAS hardware summary with channel type counts and hardware display ordering.
| Property | Type | Description |
|----------|------|-------------|
| `Analog` | `int` | Count of analog channels |
| `Squib` | `int` | Count of squib channels |
| `DigitalIn` | `int` | Count of digital input channels |
| `DigitalOut` | `int` | Count of digital output channels |
| `StreamOut` | `int` | Count of stream output channels |
| `StreamIn` | `int` | Count of stream input channels |
| `UART` | `int` | Count of UART channels |
| `CAN` | `int` | Count of CAN channels |
| Method | Signature | Description |
|--------|-----------|-------------|
| `AddDAS` | `void AddDAS(DataModel.DASHardware das)` | Adds DAS hardware to internal collection if not already present; updates channel counts |
| `GetRelevantDAS` | `HardwareTypes[] GetRelevantDAS()` | Returns array of hardware types that have at least one DAS present |
| `GetHardwareTypeOrder` | `int GetHardwareTypeOrder(HardwareTypes a)` | Returns display order for hardware type; uses predefined order or falls back to `count + enum value` |
| `GetDASCount` | `int GetDASCount(HardwareTypes dasType)` | Returns count of DAS units for specified type |
| `Clear` | `void Clear()` | Resets all counts and clears internal DAS dictionary |
---
### ChannelModel
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `DTS.Common.Base.BasePropertyChanged`
Comprehensive model for channel configuration including sensor data, calibration, and output settings.
**Constructors:**
```csharp
public ChannelModel()
public ChannelModel(SensorData sd)
```
| Method | Signature | Description |
|--------|-----------|-------------|
| `InitializeFromGroupChannel` | `void InitializeFromGroupChannel(IGroupChannel groupChannel)` | Populates model from group channel interface; catches and logs exceptions |
| Property | Type | Description |
|----------|------|-------------|
| `Sensor` | `SensorData` | Associated sensor data object |
| `HardwareChannel` | `IHardwareChannel` | Associated hardware channel interface |
| `IsModified` | `bool` | Tracks whether the model has been modified |
| `IsEmptyRecord` | `bool` | Returns true if `ChannelCode == "None"` and `SensorSerialNumber` is whitespace/null |
| `IsChannelCodeValid` | `bool` | Indicates whether channel code is valid (non-empty and not "None") |
| `ChannelCode` | `string` | User channel code/identifier |
| `CustomCodeDescription` | `string` | Custom code description |
| `SensorSerialNumber` | `string` | Sensor serial number |
| `SensorEID` | `string` | Sensor electronic ID |
| `SensorSensitivity` | `double` | Sensor sensitivity value |
| `SensorCapacity` | `double` | Sensor capacity |
| `SensorPolarity` | `bool` | Sensor polarity (true = positive/do not invert) |
| `SensorExcitationVolts` | `double` | Excitation voltage from first supported excitation option |
| `ChannelRange` | `double` | Channel range value |
| `ChannelRangeString` | `string` | String representation of channel range; parses to update `ChannelRange` and `IsRangeValid` |
| `IsRangeValid` | `bool` | True if range is valid (not NaN and > 0) |
| `FilterClass` | `IFilterClass` | Filter class configuration (FB 45051) |
| `BridgeResistance` | `double` | Bridge resistance value |
| `CableMultiplier` | `double` | Cable multiplier (defaults to 1.0) |
| `Disabled` | `bool` | Whether channel is disabled (exists in setup but not used during run) |
| `RemoveOffset` | `bool` | Whether to remove offset |
| `ProportionalToExcitation` | `bool` | Whether calibration is proportional to excitation |
| `InitialOffsetVoltage` | `double` | Initial offset voltage |
| `InitialOffsetVoltageTolerance` | `double` | Initial offset voltage tolerance |
| `SensorEU` | `string` | Engineering units string |
| `ISOCode` | `string` | ISO code identifier |
| `ISODescription` | `string` | ISO channel description |
| `ISOPolarity` | `string` | ISO polarity |
| `IsSquib` | `bool` | Whether this is a squib channel |
| `IsDigitalInput` | `bool` | Whether this is a digital input channel |
| `IsDigitalOutput` | `bool` | Whether this is a digital output channel |
| `InitialEUInMV` | `double` | Initial engineering units in mV |
| `InitialEUInEU` | `double` | Initial engineering units |
| `IRTraccExponent` | `double` | IRTracc linearization exponent |
| `DASChannelString` | `string` | String representation of hardware channel |
| `ChannelEID` | `string` | Channel electronic ID |
| `SquibFireMode` | `SquibFireMode` | Squib fire mode (CAP or CONSTANT) |
| `SquibFireDelayMs` | `double` | Delay in ms between trigger and squib fire |
| `SquibFireCurrent` | `double` | Current limit in amps |
| `SquibFireDurationMs` | `double` | Duration of squib fire in ms (clamped to min/max bounds) |
| `SquibFireResistanceLowOhm` | `double` | Low resistance tolerance in ohms |
| `SquibFireResistanceHighOhm` | `double` | High resistance tolerance in ohms |
| `LimitDuration` | `bool` | Whether to limit squib fire duration |
| `DigitalInputMode` | `DigitalInputModes` | Digital input mode |
| `DigitalOutputMode` | `DigitalOutputModes` | Digital output mode |
| `DigitalOutputDelay` | `double` | Delay between trigger and output in ms |
| `DigitalOutputDuration` | `double` | Duration of output in ms |
---
### DASChannelModel
**Namespace:** `DataPROWin7.Controls.TestSetups.Import.Models`
**Base Class:** `DependencyObject`, implements `INotifyPropertyChanged`
Wrapper model for hardware channels with WPF dependency property support.
**Constructor:**
```csharp
public DASChannelModel(IHardwareChannel channel)
```
| Event | Type | Description |
|-------|------|-------------|
| `DigitalOutputChannelChanged` | `EventHandler<DigitalOutputChannelEventArgs>` | Raised when digital output mode changes between NONE and active mode |
| Method | Signature | Description |
|--------|-----------|-------------|
| `SetChannelModel` | `void SetChannelModel(ChannelModel channel)` | Assigns/removes channel model to this hardware channel; updates all property notifications |
| `SetProperty<T>` | `bool SetProperty<T>(ref T storage, T value, string propertyName = null)` | Generic property setter with change notification |
| `OnPropertyChanged` | `void OnPropertyChanged(string propertyName = null)` | Raises PropertyChanged event |
| Property | Type | Description |
|----------|------|-------------|
| `HardwareChannel` | `IHardwareChannel` | The wrapped hardware channel (read-only) |
| `Channel` | `ChannelModel` | Associated channel model (can be null) |
| `DASChannelString` | `string` | String representation of hardware channel |
| `Disabled` | `bool` | DependencyProperty for disabled state |
| `IsActive` | `bool` | True if channel has associated record; for digital out, true if mode is not NONE |
| `CustomCode` | `string` | Custom code from channel model |
| `EID` | `string` | Electronic ID on physical channel |
| `UserChannelName` | `string` | User channel name from channel model |
| `ISOCode` | `string`

View File

@@ -0,0 +1,319 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/HardwareScanViewModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/StatusAndProgressBarViewModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/DigitalOutputChannelsViewModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/ChannelDetailViewModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/ImportTestSetupTemplate.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/ReadFileViewModel.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/ViewModels/HardwareViewModel.cs
generated_at: "2026-04-17T15:48:15.550501+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c0197dc8ed945eac"
---
# Test Setup Import ViewModels Documentation
## 1. Purpose
This module provides the ViewModel layer for the Test Setup Import wizard in DataPRO. It orchestrates the import workflow including: file browsing and parsing (`ReadFileViewModel`), hardware discovery and scanning (`HardwareViewModel`, `HardwareScanViewModel`), channel assignment and display (`DigitalOutputChannelsViewModel`, `ChannelDetailViewModel`), test setup template validation and conflict resolution (`ImportTestSetupTemplate`), and status/progress UI updates (`StatusAndProgressBarViewModel`). The module follows MVVM patterns with property change notification and command binding for WPF views.
---
## 2. Public Interface
### HardwareScanViewModel
```csharp
public class HardwareScanViewModel : DTS.Common.Base.BasePropertyChanged
```
- **Inherits from**: `DTS.Common.Base.BasePropertyChanged`
- **Public members**: None defined (empty class, appears to be a placeholder or stub)
---
### StatusAndProgressBarViewModel
```csharp
public class StatusAndProgressBarViewModel : INotifyPropertyChanged
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `AlertVisibility` | `Visibility` | `Visibility.Hidden` | Controls visibility of alert UI element |
| `AggregateStatusText` | `string` | `"---"` | Main status text displayed to user |
| `AggregateStatusColor` | `Color` | `Colors.AliceBlue` | Color of status text |
| `ProgressBarVisibility` | `Visibility` | `Visibility.Hidden` | Controls progress bar visibility |
| `ProgressBarValue` | `int` | `0` | Current progress bar value |
**Methods:**
```csharp
protected void OnPropertyChanged(string propertyName = null)
public bool SetProperty<T>(ref T storage, T value, string propertyName = null)
```
**Events:**
```csharp
public event PropertyChangedEventHandler PropertyChanged;
```
---
### DigitalOutputChannelsViewModel
```csharp
public class DigitalOutputChannelsViewModel : DTS.Common.Base.BasePropertyChanged
```
**Constructor:**
```csharp
public DigitalOutputChannelsViewModel(HardwareViewModel hardwareViewModel, IDASPopulateChannels dasPopulateChannels)
```
- Subscribes to `HardwareScanFinished` event from `hardwareViewModel`
- Stores `IDASPopulateChannels` for channel population
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `DASChannels` | `ObservableCollection<DASChannelModel>` | Collection of DAS channel models |
| `SelectedDASChannel` | `DASChannelModel` | Currently selected channel |
| `EnableOrDisableText` | `string` | Returns localized "Enable" or "Disable" text based on `SelectedDASChannel.Channel.Disabled` |
**Event Handlers:**
```csharp
private void HardwareViewModel_HardwareScanFinished(object sender, HardwareScanEventArgs e)
```
- Extracts hardware list from `ImportObject`
- Calls `OnHardwareScanComplete()` and `OnAssignedChannelsChangedEvent()`
---
### ChannelDetailViewModel
```csharp
public class ChannelDetailViewModel : DTS.Common.Base.BasePropertyChanged
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `ExtraSummaryVisible` | `bool` | `true` | Controls visibility of extra summaries section |
| `ShowSummaryDetails` | `bool` | `true` | Controls visibility of summary details |
| `ExtraSummaries` | `SummaryRow[]` | empty | Array of extra (unmatched) summary rows |
| `FoundSummaries` | `SummaryRow[]` | empty | Array of found summary rows |
| `MissingSummaries` | `SummaryRow[]` | empty | Array of missing summary rows |
| `ExtraHeight` | `GridLength` | `0, Auto` | Height for extra summaries section |
| `SummaryDetailHeight` | `GridLength` | `1, Star` | Height for summary details section |
**Methods:**
```csharp
public void GetSummaries(List<IDASCommunication> das, ImportObject importObject)
```
- Validates that `importObject` exists, has exactly one test setup, and DAS list is non-empty
- Delegates to `SummaryRowHelper.GetSummaries()` to compute found/missing/extra summaries
- Updates all summary properties via `SetSummaries()`
---
### ImportTestSetupTemplate
```csharp
public class ImportTestSetupTemplate : BasePropertyChanged
```
**Properties:**
| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `TestSetupImportFileFormat` | `ImportFileFormat` | - | Format of import file |
| `TestSetupValidation` | `ITestSetupValidation` | - | Validation service reference |
| `IncludedCheckBox` | `bool` | `true` | Whether test setup is included in import |
| `OverwriteCheckBox` | `bool` | `false` | Whether to overwrite existing test setup |
| `OriginalTestSetupName` | `string` | `""` | Original name from import file |
| `ImportingTestSetupName` | `string` | `""` | Name to use for import (editable) |
| `TestSetupExists` | `bool` | `false` | Whether a test setup with this name exists |
| `TestSetupExistsAndIncluded` | `bool` | `false` | Exists AND included checkbox is checked |
| `TestSetupImportDuplicate` | `bool` | `false` | Whether name is duplicated within import list |
| `IsValid` | `bool` | `false` | Overall validation state |
**Commands:**
```csharp
public ICommand ControlChangedCommand // RelayCommand bound to ControlChangedMethod
```
**Events:**
```csharp
public event EventHandler<ImportTestSetupEventArgs> TestSetupNameChanged
```
**Methods:**
```csharp
public void UpdateImportTestSetupListElement()
```
- Checks for existing test setups (different logic for checkout mode vs. normal)
- Sets `TestSetupExists`, `TestSetupImportDuplicate`, `TestSetupExistsAndIncluded`, `IsValid`
- Empty name with `IncludedCheckBox=true` marks as invalid
```csharp
public bool Validate()
```
- Returns `IsValid` property value
---
### ReadFileViewModel
```csharp
public class ReadFileViewModel : INotifyPropertyChanged
```
**Constructor:**
```csharp
public ReadFileViewModel(DataPROPage page, StatusAndProgressBarControl statusAndProgressBarView, StatusAndProgressBarViewModel statusAndProgressBarViewModel)
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `BrowseEnabled` | `bool` | Whether browse button is enabled |
| `StatusAndProgressBarView` | `StatusAndProgressBarControl` | Reference to status view control |
| `AutoConnectToHardware` | `bool` | Gets/sets `SerializedSettings.AutoConnectHardwareScan` |
| `ImportFile` | `string` | Path to file being imported |
**Commands:**
```csharp
public ICommand BrowseClicked // RelayCommand bound to BrowseMethod
```
**Events:**
```csharp
public event EventHandler<ReadFileStatusEventArgs> ReadFileFinished
public event EventHandler<DisableNavStepsEventArgs> DisableNavSteps
public event PropertyChangedEventHandler PropertyChanged
```
**Methods:**
```csharp
public void SetImportStatus(ImportStatus importStatus)
public void SetStatus(PossibleStatus status)
public void BrowseMethod(object obj) // Opens file dialog, starts async Parse()
```
---
### HardwareViewModel
```csharp
public class HardwareViewModel : DTS.Common.Base.BasePropertyChanged
```
**Constructor:**
```csharp
public HardwareViewModel(DataPROPage page, StatusAndProgressBarControl statusAndProgressBarView,
StatusAndProgressBarViewModel statusAndProgressBarViewModel, ReadFileViewModel readFileViewModel,
ChannelDetailViewModel channelDetailViewModel)
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `IncludedTable` | `HardwareDiscoveryTable` | Table of included hardware |
| `ChannelDetailViewContext` | `ChannelDetailViewModel` | Accessor for channel detail VM |
| `StatusAndProgressBarView` | `StatusAndProgressBarControl` | Status bar control reference |
| `OnDone` | `Action` | Callback when scan completes |
| `OnClear` | `Action` | Callback when tables cleared |
**Events:**
```csharp
public event EventHandler<HardwareScanEventArgs> HardwareScanFinished
```
**Methods:**
```csharp
public DASSummaryRow GetTestSummary() // Returns _setupHardware
public DASSummaryRow GetConnectedSummary() // Returns _connectedHardware
public void ClearTables() // Clears UI tables and summaries
public void Scan(bool bConnect) // Initiates hardware scan
public void PopulateTables() // Populates setup/connected hardware summaries
public ChannelSummaryRow[] GetChannelSummary() // Returns analog/squib/digital channel counts
public HardwareTypes[] GetRelevantHardwareTypes() // Returns sorted unique hardware types
public void ClearHardwareTables() // Clears internal hardware lists
```
---
## 3. Invariants
1. **Single Test Setup Requirement**: `ChannelDetailViewModel.GetSummaries()` only displays summaries when `importObject.TestSetups().Count() == 1`. Multiple or zero test setups result in empty summaries.
2. **Thread Affinity**: `DigitalOutputChannelsViewModel.OnAssignedChannelsChangedEvent()` must execute on the UI thread. It uses `Application.Current.Dispatcher.BeginInvoke()` to marshal calls when necessary.
3. **Hardware Scan Prerequisites**: `HardwareViewModel.Scan()` will not execute hardware connection when:
- Import file format is `MultipleTestSetup` or `NoTestSetup`
- `ReadFileStatusEventArgs.Status` is `false` (read failed)
4. **Validation State Consistency**: `ImportTestSetupTemplate.IsValid` is `false` when:
- `IncludedCheckBox` is `true` AND (`TestSetupExists` OR `TestSetupImportDuplicate`) AND NOT `OverwriteCheckBox`
- `ImportingTestSetupName` is whitespace/empty AND `IncludedCheckBox` is `true`
5. **Property Change Notification**: All ViewModels implement property change notification either via `INotifyPropertyChanged` directly or through `BasePropertyChanged` base class.
6. **CSV File Validation**: `ReadFileViewModel.Parse()` checks:
- File is not in use by another process (via `CSVFile.IsInUse()`)
- File is a valid test setup import file (via `CSVFile.IsCSVFileForTestSetupImport()`)
---
## 4. Dependencies
### This module depends on:
**External Libraries:**
- `Prism.Ioc` - `IEventAggregator`, `ContainerLocator`
- `Prism.Events` - Event aggregation pattern
- `System.Windows` - WPF core types, `Application`, `Visibility`
- `System.Windows.Media` - `Color` type
- `System.Windows.Forms` - `OpenFileDialog`
- `System.Windows.Input` - `ICommand`
**DTS.Common Namespace:**
- `DTS.Common.Base.BasePropertyChanged` - Base class for property change notification
- `DTS.Common.Enums` - `HardwareTypes`, sensor type enums
- `DTS.Common.Import` - `ImportObject`, `ImportNotification`, `ParseImportFactory`, `IParseImport`
- `DTS.Common.Import.Enums` - `ImportFileFormat`, `PossibleStatus`, `ImportExtraStatus`, `ImportSeverityError`
- `DTS.Common.Interface.Channels` - `IGroupChannel`
- `DTS.Common.Interface.DataRecorders` - `IDASHardware`, `IDASCommunication`
- `DTS.Common.Interface.Sensors` - `ISensorData`
- `DTS.Common.Classes.Viewer.Commands` - `RelayCommand`
- `DTS.Common.SharedResource.Strings` - Localized string resources
**Internal DataPRO Modules:**
- `DataPROWin7.Common` - `SerializedSettings`, `WizardHelper`
- `DataPROWin7.Controls.DAS.HardwareDiscovery` - `HardwareDiscoveryTable`, `HardwareDiscoveryControl`
- `DataPROWin7.Controls.TestSetups.Import.Models` - `DASChannelModel`, `DASSummaryRow`, `ChannelSummaryRow`, `SummaryRow`
- `DataPROWin7.Controls.TestSetups.Import.Classes` - `SummaryRowHelper`, `CSVFile`
- `DataPROWin7.Controls.TestSetups.Import.Views` - `StatusAndProgressBarControl`, `DataPROPage`
- `DataPROWin7.DataModel` - `TestTemplate`, `TestTemplateList`
- `DataModel.TestTemplateList.TestTemplatesList` - Template lookup service
### What depends on this module:
- **Unclear from source alone** - The ViewModels appear to be consumed by Views in the `DataPROWin7.Controls.TestSetups.Import.Views` namespace, but the specific view bindings are not shown in these files.
---
## 5. Gotchas
1. **FB Tracking Comments**: Multiple comments reference "FB" followed by numbers (e.g., `//FB 39054`, `//FB 36854`). These appear to be bug/feature tracking references. When modifying related code, consult the tracking system for historical context.
2. **Empty HardwareScanViewModel**: `HardwareScanViewModel` is an empty class inheriting from `BasePropertyChanged`. It may be a stub for future implementation or legacy artifact. **Do not assume it has functionality.**
3. **Dispatcher Marshaling Inconsistency**:
- `DigitalOutputChannelsViewModel` uses `BeginInvoke` (async)
- `HardwareViewModel` uses `Invoke` (sync) with `ManualResetEvent` for blocking
This difference in threading approach may cause timing issues.
4. **Hidden State Dependency**: `ImportTestSetupTemplate.UpdateImportTestSetupListElement()` has different behavior based on `Common.SerializedSettings.ShowCheckoutButton` and `Properties.Settings.Default.DeleteTestSetupsOnWizardImport`. Test coverage must account for these configuration states.
5. **Cancel Check Timing**: `ReadFileViewModel.CancelCheck()` returns `_page?.IsCancelled() ?? false`. If `_page` is null, cancellation is silently ignored (returns `false`).
6. **Level Trigger Warning**: `ReadFileViewModel.WarnOnLevelTriggerPresentWithNoUI()` issues a warning when imported test setups contain level triggers but `SerializedSettings.AllowLevelTriggerUI` is `false`. This warning appears in errors but doesn't block import.
7. **Hardware ID Normalization**: `HardwareViewModel.AddAnyMissingDAS()` assigns negative IDs to connected hardware not in the import file. This is an internal convention to avoid ID collisions but could cause confusion when debugging.
8. **Test-Specific Sensor Filtering**: `HardwareViewModel.ParseImportObject()` explicitly skips sensors with serial numbers matching `TEST_SPECIFIC_SQUIB_SERIAL`, `TEST_SPECIFIC_ANALOG_SERIAL`, `TEST_SPECIFIC_DIGITAL_IN_SERIAL`, `TEST_SPECIFIC_DIGITAL_OUT_SERIAL`. These are not counted in channel summaries.
9. **Duplicate Channel Counting**: The `sensorCounter` dictionary in `ParseImportObject()` prevents counting duplicate sensor assignments, but only up to one duplicate per sensor (counter check is `>= 1`). Multiple reassignments of the same sensor may still be undercounted.

View File

@@ -0,0 +1,154 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/StatusAndProgressBarControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/SummaryControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/ReadFileControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/SquibChannelsControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/AnalogChannelsControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/DigitalInputChannelsControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/DigitalOutputChannelsControl.xaml.cs
- DataPRO/DataPRO/Controls/TestSetups/Import/Views/HardwareScanControl.xaml.cs
generated_at: "2026-04-17T15:50:08.947322+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "3145b9d8c3358fd9"
---
# Documentation: DataPRO Import Views
## 1. Purpose
This module contains WPF UserControl views for a Test Setup Import wizard within the DataPRO application. Each control represents a step or component in the import workflow, including file reading, hardware scanning, channel configuration (Analog, Squib, Digital Input, Digital Output), summary display, and progress indication. These views follow a Model-View-ViewModel (MVVM) pattern, binding to corresponding ViewModels and implementing the `IPageContent` interface to integrate with a page-based navigation system.
---
## 2. Public Interface
### StatusAndProgressBarControl
A minimal UserControl for displaying status and progress during import operations.
```csharp
public StatusAndProgressBarControl()
```
- Default constructor that calls `InitializeComponent()`. No additional logic or public members beyond the inherited `UserControl`.
---
### SummaryControl
Displays a summary of the import configuration. Implements `IPageContent`.
```csharp
public SummaryControl(SummaryViewModel summaryViewModel)
```
- Sets `DataContext` to the provided `summaryViewModel` before initialization.
**IPageContent Implementation:**
| Method | Behavior |
|--------|----------|
| `void IPageContent.SetPermissions(User.UserPermissionLevels actualPermission, User.UserPermissionLevels requiredPermission)` | Sets `IsEnabled` to `true` if `(int)actualPermission >= (int)requiredPermission` |
| `bool IPageContent.KeyDown(object sender, KeyEventArgs arg)` | Returns `false` (no handling) |
| `void IPageContent.StartSearch(string term)` | No-op |
| `bool IPageContent.OnButtonPress(PageButton button)` | Returns `false` (no handling) |
| `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Returns `true` unconditionally |
| `void OnSetActive()` | Calls `Validate()` with empty lists and `displayWindow=false` |
| `void IPageContent.UnSet(Action OnComplete = null)` | No-op |
| `object GetPageContent()` | Returns `this` |
---
### ReadFileControl
Handles the file reading step of the import workflow. Implements `IPageContent`.
```csharp
public ReadFileControl(ReadFileViewModel readFileViewModel)
```
- Sets `DataContext` to the provided `readFileViewModel` before initialization.
**IPageContent Implementation:** Identical to `SummaryControl` (same stub implementations).
---
### SquibChannelsControl
Configures squib channel imports. Implements `IPageContent`.
```csharp
public SquibChannelsControl(SquibChannelsViewModel squibChannelsViewModel)
```
- Sets `DataContext` to the provided `squibChannelsViewModel` before initialization.
**IPageContent Implementation:** Identical to `SummaryControl`.
---
### AnalogChannelsControl
Configures analog channel imports. Implements `IPageContent`.
```csharp
public AnalogChannelsControl(AnalogChannelsViewModel analogChannelsViewModel)
```
- Sets `DataContext` to the provided `analogChannelsViewModel` before initialization.
**IPageContent Implementation:** Identical to `SummaryControl`.
---
### DigitalInputChannelsControl
Configures digital input channel imports. Implements `IPageContent`.
```csharp
public DigitalInputChannelsControl(DigitalInputChannelsViewModel digitalInputChannelsViewModel)
```
- Sets `DataContext` to the provided `digitalInputChannelsViewModel` before initialization.
**IPageContent Implementation:** Identical to `SummaryControl`.
---
### DigitalOutputChannelsControl
Configures digital output channel imports. Implements `IPageContent`.
```csharp
public DigitalOutputChannelsControl(DigitalOutputChannelsViewModel digitalOutputChannelsViewModel)
```
- Sets `DataContext` to the provided `digitalOutputChannelsViewModel` before initialization.
**IPageContent Implementation:** Identical to `SummaryControl`.
---
### HardwareScanControl
The most complex control; handles hardware scanning and displays DAS (Data Acquisition System) device summaries and channel mappings. Implements `IPageContent`.
```csharp
protected HardwareScanControl()
```
- Protected parameterless constructor for designer/inheritance use.
```csharp
public HardwareScanControl(HardwareViewModel model, DataPROPage page)
```
- Primary constructor. Sets `DataContext` to `model`, stores references to `_page` and `_hardwareViewModel`, and wires up `OnDone` and `OnClear` callbacks on the ViewModel.
```csharp
public void Scan()
```
- Initiates a hardware scan by calling `_hardwareViewModel.Scan(true)`.
**Private Methods:**
| Method | Purpose |
|--------|---------|
| `void ViewModelClear()` | Clears `ItemsSource` on `lvChannelSummary`, `lvDASSummary`, and `dgDASCount`. Uses `Dispatcher.BeginInvoke` if not on UI thread. |
| `void ViewModelDone()` | Called when ViewModel completes; populates data tables and list views with scan results. |
| `void CreateDataTable()` | Builds a `DataTable` for `dgDASCount` with columns for hardware types and channel counts. |
| `void PopulateListView()` | Populates `lvDASSummary` with active DAS devices from `((App)Application.Current).DASFactory.GetActiveDevices()`. |
| `void CreateChannelsSummary()` | Populates `lvChannelSummary` with `_hardwareViewModel.GetChannelSummary()`. |
| `void AddNewColumn(string header, ref int colIdx)` | Adds a column to `_dt` and `dgDASCount`. |
| `void PopulateRow(ref DataRow row, Models.DASSummaryRow summary, HardwareTypes[] dasTypes, string title)` | Populates a DataRow with DAS counts for each hardware type and channel category. |
**Fields:**
| Field | Type | Purpose |
|-------|------|---------|
| `_page` | `DataPROPage` | Reference to parent page |
| `_hardwareViewModel` | `HardwareViewModel` | Bound ViewModel |
| `_dt` | `DataTable` | Backing data for `dgDASCount` |
| `_hardwareTypeToDisplayString` | `Dictionary<HardwareTypes, string>`

View File

@@ -0,0 +1,14 @@
---
source_files:
- DataPRO/DataPRO/Controls/TestSetups/ImportTTSHelpers/TestSetupHelper.cs
- DataPRO/DataPRO/Controls/TestSetups/ImportTTSHelpers/SensorGroupHelper.cs
generated_at: "2026-04-17T16:12:45.541370+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "b4344912a6b1cf92"
---
# ImportTTSHelpers
### Purpose
This module provides helper classes designed to wrap data model objects (`TestTemplate` and `TestObject`) for use in UI lists, specifically facilitating import preview functionality. It adds UI-specific state management, such as an `

View File

@@ -0,0 +1,55 @@
---
source_files:
- DataPRO/DataPRO/DataModel/VisibilityConverter.cs
- DataPRO/DataPRO/DataModel/SysBuiltObjectType.cs
- DataPRO/DataPRO/DataModel/UIProperties.cs
generated_at: "2026-04-17T15:54:39.527259+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "6af7c00863964c37"
---
# DataPRO DataModel Module Documentation
## 1. Purpose
This module provides data model components for the DataPRO application, serving as a bridge between the application's business logic and its presentation layer. It contains a WPF value converter for UI binding (`VisibilityConverter`), a domain entity for ISO test object types (`SysBuiltObjectType`), and a centralized settings facade (`UIProperties`) that exposes user-configurable display and behavior preferences. The module abstracts access to serialized settings and ISO database lookups, enabling consistent UI behavior across the application.
---
## 2. Public Interface
### VisibilityConverter (DataPROWin7.DataModel)
A WPF `IValueConverter` implementation for converting integer values to `Visibility` enum values in XAML bindings.
| Member | Signature | Description |
|--------|-----------|-------------|
| `Convert` | `public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)` | Converts the input `value` to an integer via `System.Convert.ToInt32()`, then casts directly to `System.Windows.Visibility`. |
| `ConvertBack` | `public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)` | Always returns `null`. Does not support two-way binding. |
**Attribute:** `[ValueConversion(typeof(int), typeof(Visibility))]`
---
### SysBuiltObjectType (DataPROWin7.DataModel)
A container class representing all Dynamic Groups of a given test object type (e.g., Vehicle 1, Vehicle 2, Sled).
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public SysBuiltObjectType(string testObjectType)` | Initializes the instance with a test object type identifier string. |
| `TestObject` | `public ISODll.MMETestObjects TestObject { get; set; }` | Gets or sets the test object via ISO database lookup. Getter retrieves from `(App.Current as App).IsoDb.GetTestObjectByIso(_testObject)`. Setter updates internal `_testObject` field with `value.Test_Object` if non-null. |
| `ISOTestObjectType` | `public string ISOTestObjectType { get; }` | Returns `TestObject.Text_L1`. |
| `ToString` | `public override string ToString()` | Returns `TestObject.Text_L1`. |
---
### UIProperties (DataPROWin7.DataModel)
A property-change-notifying facade for user interface settings, extending `DTS.Common.Base.BasePropertyChanged`. All properties delegate to `Common.SerializedSettings`.
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public UIProperties(bool bReset = false)` | If `bReset` is `true`, resets all settings to their default values. Otherwise, performs no initialization. |
| `ShowGraphsSetupStep` | `public bool ShowGraphsSetupStep { get; set; }` | Gets/sets whether graphs setup step is shown. Raises `On

View File

@@ -0,0 +1,104 @@
---
source_files:
- DataPRO/DataPRO/DataModel/Classes/Hardware/ATDArmStatus.cs
generated_at: "2026-04-17T16:01:50.083542+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "5d7b47b08fb8d993"
---
# Documentation: ATDArmStatus.cs
## 1. Purpose
This module provides a hierarchical status tracking system for ATD (Airborne Test Device) hardware components used in data acquisition systems. It models the relationship between ATDs, Distributors, and individual Devices, tracking their armed states, diagnostic health, voltage levels, and connectivity status. The module aggregates status from individual devices upward through the hierarchy to provide an overall system health view, supporting real-time monitoring of hardware readiness for test operations.
---
## 2. Public Interface
### `DbParentInfo` (internal class)
Simple data container for database-retrieved parent information.
| Property | Type | Description |
|----------|------|-------------|
| `SerialNumber` | `string` | Device serial number |
| `ParentDAS` | `string` | Parent DAS identifier |
| `PositionOnDistributor` | `int` | Position on distributor |
| `PositionOnChain` | `int` | Position in chain |
| `Port` | `int` | Port number |
**Constructor:** `DbParentInfo(string serial, string parentDAS, int positionDb, int positionChain, int port)`
---
### `AllATDStatus` (public class)
Implements `IAllATDStatus`. Root container for all ATD status tracking.
| Property/Method | Signature | Description |
|-----------------|----------|-------------|
| `OverallStatus` | `AllATDStatuses` (get) | Aggregate status across all ATDs |
| `ATDs` | `IATDStatus[]` (get) | Array of all ATD status objects |
| `PopulateFromHardware` | `void PopulateFromHardware(IDASHardware[] hardware)` | Populates the hierarchy from a hardware array; SLICE Ethernet controllers are added first as distributors |
| `AddDevice` | `void AddDevice(IDeviceArmStatus device, string parent = null)` | Adds a device to the appropriate ATD/distributor based on parent relationship |
---
### `ATDStatus` (public class)
Implements `IATDStatus`. Represents a single ATD unit containing one or more distributors.
| Property/Method | Signature | Description |
|-----------------|----------|-------------|
| `Status` | `AllATDStatuses` (get) | Aggregate status for this ATD |
| `Distributors` | `IDistributorArmStatus[]` (get) | Array of distributors belonging to this ATD |
| `IP` | `IPAddress` (get) | IP address of the ATD |
| `AddDistributor` | `void AddDistributor(IDistributorArmStatus distributor)` | Adds a distributor if not already present |
| `SetIP` | `void SetIP(IPAddress ip)` | Sets the IP address |
| `UpdateAggregateStatus` | `void UpdateAggregateStatus()` | Recalculates status based on all distributor states |
---
### `DistributorArmStatus` (public class)
Implements `IDistributorArmStatus`. Represents a distributor device with attached devices.
| Property/Method | Signature | Description |
|-----------------|----------|-------------|
| `SerialNumber` | `string` (get/set) | Serial number; returns `Distributor.SerialNumber` if set, otherwise internal field |
| `EmptyDistributor` | `bool` (get) | Returns `true` if serial number is null or empty |
| `LastSeen` | `DateTime?` (get/set) | Last communication timestamp |
| `InputVoltage` | `float?` (get/set) | Input voltage reading |
| `BackupVoltage` | `float?` (get/set) | Backup voltage reading |
| `AggregateStatus` | `AllATDStatuses` (get/set) | Aggregate status of distributor and devices |
| `DistributorStatus` | `DistributorStatuses` (get) | Status specific to the distributor |
| `Distributor` | `IDeviceArmStatus` (get) | The device acting as distributor |
| `Devices` | `IDeviceArmStatus[]` (get) | Array of devices attached to this distributor |
| `AddDevice` | `void AddDevice(IDeviceArmStatus device)` | Adds a device if not already present |
| `SetDistributor` | `void SetDistributor(IDeviceArmStatus distributor)` | Sets the distributor device |
| `SetSerialNumber` | `void SetSerialNumber(string serial)` | Sets serial number |
| `SetDistributorStatus` | `void SetDistributorStatus(DistributorStatuses status)` | Sets distributor status |
| `UpdateStatusFromQATS` | `void UpdateStatusFromQATS(IUDPQATSEntry qats)` | Updates voltage and status from QATS entry |
| `UpdateAggregateStatus` | `void UpdateAggregateStatus()` | Recalculates aggregate status; marks devices as `MissingNotBooted` if not seen within `QATSMaxExpectedTimeMS` |
---
### `DeviceArmStatus` (public class)
Implements `IDeviceArmStatus`. Represents an individual device with diagnostic tracking.
| Property/Method | Signature | Description |
|-----------------|----------|-------------|
| `SerialNumber` | `string` (get) | Returns from `DASCommunication.SerialNumber`, `Hardware.SerialNumber`, or internal field (in that order) |
| `IPAddress` | `string` (get) | Returns `Hardware.Connection` if set, otherwise internal field |
| `DASStatus` | `DASStatuses` (get) | Current DAS status |
| `HasArmed` | `bool` (get/set) | Whether device has ever armed |
| `DiagStatus` | `DiagStatuses` (get) | Diagnostic status flags |
| `Distributor` | `IDistributorArmStatus` (get) | Parent distributor |
| `Hardware` | `IDASHardware` (get) | Associated hardware object |
| `DASCommunication` | `IDASCommunication` (get) | Associated DAS communication object |
| `LastSeen` | `DateTime?` (get/set) | Last communication timestamp |
| `InputVoltage` | `float?` (get/set) | Input voltage |
| `BackupVoltage` | `float?` (get/set) | Backup voltage |
| `Triggered` | `bool` (get/set) | Whether device has triggered |
| `ShuntResults` | `string` (get/set) | Shunt diagnostic results string |
| `OffsetResults` | `string` (get/set) | Offset diagnostic results string |
| `TiltX`, `TiltY`, `TiltZ` | `double?` (get/set) | Tilt sensor readings |
| `SetSerialNumber

View File

@@ -0,0 +1,181 @@
---
source_files:
- DataPRO/DataPRO/DataModel/Classes/TabPage/TabPageCommon.cs
- DataPRO/DataPRO/DataModel/Classes/TabPage/TabPage.cs
generated_at: "2026-04-17T15:57:48.499704+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "95304fe7032ff1d8"
---
# Documentation: TabPage Module
## 1. Purpose
This module provides the data model for a tile-based navigation system in a WPF application. It defines an abstract base class `TabPageCommon` with permission-aware visibility and enablement, concrete implementations `TabPageItem` (individual navigation tiles) and `TabPageItemGroup` (grouped tile collections), and a singleton `TabPageSource` that registers all application navigation items. The system integrates with a role-based permission model to control UI element visibility and interactivity based on user roles.
---
## 2. Public Interface
### TabPageCommon (Abstract Base Class)
**Constructor:**
```csharp
public TabPageCommon(string uniqueId, string title, string subtitle, string imagePath, string description, DTS.Slice.Users.User.UserPermissionLevels requiredPermission)
```
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetID` | `long GetID()` | Returns the internal ID value. |
| `SetID` | `void SetID(long id)` | Sets the internal ID value. |
| `GetDefaultRolePermission` | `virtual DTS.Slice.Users.User.UserPermissionLevels GetDefaultRolePermission(DTS.Slice.Users.User.DefaultRoles role)` | Returns the default permission level for a given role. Defaults to `Read` for unhandled cases. |
| `SetEnabled` | `void SetEnabled(bool bEnable)` | Sets `IsEnabled` based on permission comparison with current user. No-op if `((App)Application.Current).CurrentUser` is null. |
| `GetDefaultRoleVisibility` | `virtual bool GetDefaultRoleVisibility(DTS.Slice.Users.User.DefaultRoles role)` | Returns visibility flag based on role and `_requiredPermission`. |
| `GetName` | `virtual string GetName()` | Returns `UniqueId`. |
| `SetVisible` | `void SetVisible(bool bShow)` | Sets `Visibility` property; checks `CurrentUser.IsShowTabFlagSet(this)` when showing. |
| `GetRequiredPermission` | `DTS.Slice.Users.User.UserPermissionLevels GetRequiredPermission()` | Returns the stored `_requiredPermission` value. |
| `SetImage` | `void SetImage(string path)` | Clears cached image and sets new path; raises `OnPropertyChanged("Image")`. |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `IsEnabled` | `bool` | Backed by `_isEnabled`; uses `SetProperty` for notification. |
| `Visibility` | `Visibility` | Backed by `_visibility`; uses `SetProperty`. |
| `UniqueId` | `string` | Backed by `_uniqueId`. |
| `Title` | `string` | Getter attempts localization via `StringResources.ResourceManager.GetString(_title)`; returns `"#stringnotfound# " + _title` if not found. |
| `SubTitle` | `string` | Backed by `_subtitle`. |
| `Description` | `string` | Backed by `_description`. |
| `Image` | `ImageSource` | Lazily loads `BitmapImage` from `_imagePath` relative to `_baseUri`. |
---
### TabPageItem (Concrete Class)
**Constructor:**
```csharp
public TabPageItem(string uniqueid, string title, string subtitle, string imagepath, string description, UserControl content, TabPageItemGroup group, DTS.Slice.Users.User.UserPermissionLevels requiredPermission)
```
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetSubPage` | `DataPROPage GetSubPage(string id)` | Returns first matching subpage by `UniqueId`; throws `NullReferenceException` if not found. |
| `SetCurrentItem` | `virtual void SetCurrentItem(object o)` | Virtual, empty by default. |
| `SetContent` | `virtual void SetContent()` | Virtual, empty by default. |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `TileHeight` | `double` | Backed by `_tileHeight`. |
| `TileWidth` | `double` | Backed by `_tileWidth`. |
| `TileFontSize` | `double` | Backed by `_tileFontSize`; initialized to `12.0`. |
| `FontSize` | `double` | Alias for `TileFontSize` (getter/setter redirect). |
| `Content` | `UserControl` | Backed by `_content`. |
| `SubPages` | `DataPROPage[]` | Backed by `_subPages`; getter returns array copy. |
| `Group` | `TabPageItemGroup` | Backed by `_group`. |
---
### TabPageItemGroup (Concrete Class)
**Constructor:**
```csharp
public TabPageItemGroup(string uniqueid, string title, string subtitle, string imagepath, string description, Color selectedColor, Color hoverColor, DTS.Slice.Users.User.UserPermissionLevels requiredPermission)
```
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateTopItems` | `void UpdateTopItems()` | Raises `OnPropertyChanged("TopItems")`. |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `Items` | `ObservableCollection<TabPageItem>` | Returns readonly `_items` collection. |
| `TopItems` | `IEnumerable<TabPageItem>` | Returns `_items.Take(_items.Count)` (effectively all items). |
| `SelectedColor` | `Color` | Backed by `_selectedColor`. |
| `HoverColor` | `Color` | Backed by `_hoverColor`. |
---
### TabPageSource (Singleton)
**Static Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `GetGroups` | `static IEnumerable<TabPageItemGroup> GetGroups(string uniqueid)` | Returns `_source.AllGroups` if `uniqueid` equals `"AllGroups"`; otherwise throws `ArgumentException`. |
| `TurnOffISOTiles` | `static void TurnOffISOTiles()` | Calls `_prepareGroup.UpdateTopItems()`. |
| `TurnOnISOTiles` | `static void TurnOnISOTiles()` | Calls `AddAllPrepareTileGroups()` then `UpdateTopItems()`. |
| `GetGroup` | `static TabPageItemGroup GetGroup(string uniqueid)` | Returns matching group or `null` if zero or multiple matches. |
| `GetItem` | `static TabPageItem GetItem(string uniqueid)` | Searches all groups' items; returns match or `null` if zero or multiple matches. |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `AllGroups` | `ObservableCollection<TabPageItemGroup>` | Instance property containing all registered groups. |
**Enums:**
- `TileUniqueIDs` — Enumeration of tile identifiers (e.g., `Hardware_SensorModels`, `CollectData`, `Admin_Users`, etc.)
- `TileGroupUniqueIDs` — Enumeration of group identifiers: `Hardware`, `Prepare`, `Diagnostics`, `Record`, `Review`, `Admin`
**Nested Item Classes:**
All inherit from `TabPageItem` and override `SetContent()`:
- `SensorModelsItem`, `DASItem`, `SensorsItem`, `AdditionalDetailsItem`, `TestSetupsItem`, `TestObjectsItem`, `UserDetailsItem`, `SystemSettingsItem`, `RealtimeItem`, `QuickSensorCheckItem`, `StatusLineItem`, `CollectDataItem`, `DownloadVerifyViewExportItem`, `DataReviewItem`, `DataExportItem`
---
## 3. Invariants
1. **ID Initialization**: `_id` is always initialized to `-1` before any `SetID` call.
2. **Permission Hierarchy**: Permission comparison in `SetEnabled` uses integer comparison: `(int)_requiredPermission > (int)permission`.
3. **Title Localization Fallback**: `Title` getter always returns a string; if localization fails, returns `"#stringnotfound# " + _title`.
4. **Image Lazy Loading**: `_image` is only created when `Image` getter is called and both `_image` is null and `_imagePath` is not null.
5. **GetGroups Constraint**: `GetGroups` only accepts `"AllGroups"` as valid `uniqueid` argument.
6. **GetSubPage Exception**: `GetSubPage` throws `NullReferenceException` (not `KeyNotFoundException`) when subpage not found.
7. **TopItems Semantics**: `TopItems` returns all items in the collection (uses `Take(_items.Count)`).
---
## 4. Dependencies
**This module depends on:**
- `System.Windows``Visibility` enum, `Application` class
- `System.Windows.Media``Color`, `ImageSource`, `BitmapImage`
- `System.Windows.Media.Imaging``BitmapImage`
- `System.Windows.Controls``UserControl`
- `System.Collections.ObjectModel``ObservableCollection<T>`
- `DTS.Common.Base``BasePropertyChanged` (assumed to provide `SetProperty`, `OnPropertyChanged`)
- `DTS.Common.SharedResource.Strings``StringResources`
- `DTS.Common``BrushesAndColors` (referenced in `TabPageSource` constructor)
- `DTS.Slice.Users``IUIItems` interface, `User.DefaultRoles`, `User.UserPermissionLevels`
- `DataPROWin7.DataModel``DataPROPage` (referenced in `SubPages`)
- Various page classes (e.g., `HardwareSensorModels`, `DataRecordersPage`, `RunTestPage`, etc.) — referenced in nested item class constructors
**What depends on this module:**
- Unclear from source alone; likely consumed by navigation/UI layer and XAML bindings.
---
## 5. Gotchas
1. **Unused Variable in Visibility Setter**: In `TabPageCommon.SetVisible`, `var name = GetName()` is assigned but never used. Same pattern in `Visibility` setter.
2. **TopItems Implementation Quirk**: `TopItems` returns `_items.Take(_items.Count)`, which returns all items. The name suggests pagination or filtering, but the implementation does neither.
3. **FontSize vs TileFontSize**: The `FontSize` property exists solely to resolve binding errors, with a FIXME comment questioning whether bindings should use `TileFontSize` instead. This is tech debt.
4. **GetItem Ambiguity Handling**: `GetItem` returns `null` if there are zero OR multiple matches, making it impossible to distinguish "not found" from "duplicate IDs."
5. **GetGroup Same Ambiguity**: Same issue as `GetItem` — returns `null` for both zero and multiple matches.
6. **Hardcoded Base URI**: `_baseUri` is hardcoded to `"pack://application:,,,/ResourceFile.xaml"` with a commented-out alternative.
7. **NullReferenceException for Missing SubPage**: `GetSubPage` throws `NullReferenceException` with a message, which is semantically incorrect for "item not found" scenarios.
8. **SetEnabled Silent Failure**: `SetEnabled` silently returns without action if `((App)Application.Current).CurrentUser` is null.
9. **TestSetupsItem Conditional Page Creation**: `GetTestSetupPage()` creates different page types based on `Properties.Settings.Default.ShowTestSetupWizard`, which could cause inconsistent behavior across sessions.
10. **StatusLineItem Conditional Step**: The `StatusLineCheckStep` value depends on `Common.SerializedSettings.TriggerCheckPostRealtime`, affecting which enum flag is used.

View File

@@ -0,0 +1,60 @@
---
source_files:
- DataPRO/DataPRO/HelpStrings/HelpStringResources.Designer.cs
generated_at: "2026-04-17T16:46:01.484429+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "822e2c5e0ae86d3b"
---
# Documentation: HelpStringResources.Designer.cs
## 1. Purpose
This module provides a strongly-typed, auto-generated resource accessor class for localized help strings within the DataPRO application. It serves as the programmatic interface to a `.resx` resource file containing user-facing help text, enabling the application to retrieve localized strings (such as UI element help text) in a type-safe manner. This class acts as the generated half of a standard .NET resource localization pattern.
---
## 2. Public Interface
### Class: `HelpStringResources`
- **Kind**: `internal class`
- **Namespace**: `DataPROWin7.HelpStrings`
- **Description**: Auto-generated strongly-typed resource class for looking up localized strings.
#### Constructor
| Signature | Description |
|-----------|-------------|
| `internal HelpStringResources()` | Parameterless constructor. Marked with `SuppressMessageAttribute` for "AvoidUncalledPrivateCode". |
#### Properties
| Signature | Description |
|-----------|-------------|
| `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Returns the cached `ResourceManager` instance. Lazily initializes a new `ResourceManager` pointing to the resource name `"DataPROWin7.HelpStrings.HelpStringResources"` within the current assembly on first access. |
| `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the `CultureInfo` used for resource lookups. Overrides the current thread's `CurrentUICulture` for all lookups via this class. |
| `internal static string HelpTextNotFound { get; }` | Looks up a localized string. Default value (from comments): "Help text not found in resource file". |
| `internal static string SensorDatabaseModelComboBox { get; }` | Looks up a localized string. Default value (from comments): "Sensor Model combo box help from HelpStringResources". |
---
## 3. Invariants
- **Thread-safety of ResourceManager**: The `ResourceManager` property uses a lazy initialization pattern with a null check via `object.ReferenceEquals(resourceMan, null)`. The pattern reads `resourceMan` into a local `temp` variable before assigning, but **does not appear to use locking**, which could be a race condition in multi-threaded scenarios (though the result would still produce a valid `ResourceManager`).
- **Resource name binding**: The `ResourceManager` is permanently bound to the resource name `"DataPROWin7.HelpStrings.HelpStringResources"` and the executing assembly at the time of first access.
- **Culture fallback**: If `Culture` is not explicitly set (`resourceCulture` remains `null`), `ResourceManager.GetString()` will use the current thread's `CurrentUICulture`.
- **Auto-generated constraint**: This file is auto-generated by `System.Resources.Tools.StronglyTypedResourceBuilder` version `16.0.0.0`. Manual changes will be overwritten if the tool regenerates the file.
---
## 4. Dependencies
### This module depends on:
- `System` (namespace)
- `System.Resources.ResourceManager` (type)
- `System.Globalization.CultureInfo` (type)
- An associated `.resx` file (likely `HelpStringResources.resx`) containing the actual string resources, which must be embedded in the assembly.
### What depends on this module:
- **Unclear from source alone.** As an `internal` class, it is only accessible within the same assembly. Other components within `DataPROWin7` (or the assembly containing this namespace) likely reference `HelpStringResources.HelpTextNotFound` and `HelpStringResources

View File

@@ -0,0 +1,37 @@
---
source_files:
- DataPRO/DataPRO/Licensing/LicenseProperty.cs
- DataPRO/DataPRO/Licensing/ClientLicense.cs
generated_at: "2026-04-17T15:56:29.097706+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "3e86a62ee8449d94"
---
# Documentation: DataPRO Licensing Module
## 1. Purpose
This module provides license validation and type classification for the DataPRO application. It consists of two components: `LicenseProperty`, an auto-generated configuration class that stores build-time license properties (public key, key GUID, and build mode), and `ClientLicense`, a utility class that validates license files against hardware identifiers, product versions, and expiration dates while providing helper methods to classify license types (Standard, Enterprise, Site licenses, and TSRAir). The module enforces licensing constraints by verifying signatures, matching machine hardware fingerprints for non-site licenses, and ensuring version compatibility.
---
## 2. Public Interface
### LicenseProperty (static class)
**Namespace:** `DataPROWin7`
**Accessibility:** `internal static`
| Property | Type | Description |
|----------|------|-------------|
| `PublicKey` | `string` | Auto-generated public key, defaults to `"00000000-0000-0000-0000-000000000000"` |
| `KeyGuid` | `string` | Auto-generated key GUID, defaults to `"00000000-0000-0000-0000-000000000000"` |
| `BuildMode` | `string` | Build mode indicator, defaults to `"Debug"` |
### ClientLicense (static class)
**Namespace:** `DataPROWin7.Licensing`
**Accessibility:** `internal static`
| Method | Signature | Description |
|--------|-----------|-------------|
| `IsSiteLicense` | `bool IsSiteLicense(DataProLicensingEnums.LicenseType licenseType)` | Returns `true` if `licenseType` is `EnterpriseSite`, `StandardSite`, or `TSRAir` |

View File

@@ -0,0 +1,49 @@
---
source_files:
- DataPRO/DataPRO/ModuleCatalog/AggregateModuleCatalog.cs
generated_at: "2026-04-17T16:14:19.171251+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "df0afddd9c0d4a5d"
---
# ModuleCatalog
### Purpose
This module provides an `AggregateModuleCatalog` class that implements the Prism `IModuleCatalog` interface to aggregate multiple module catalogs into a single unified catalog. It enables the application to combine modules from different catalog sources (e.g., configuration-based, directory-based, or dynamically loaded catalogs) while presenting them through a single interface to the Prism modularity system.
### Public Interface
**Class: `AggregateModuleCatalog`** (implements `IModuleCatalog`)
- **`AggregateModuleCatalog()`** - Constructor that initializes the aggregate catalog with a default `Microsoft.Practices.Prism.Modularity.ModuleCatalog` as the first catalog.
- **`void AddCatalog(IModuleCatalog catalog)`** - Adds a module catalog to the aggregate. Throws `ArgumentNullException` if `catalog` is null.
- **`IEnumerable<ModuleInfo> Modules`** (property) - Returns all `ModuleInfo` instances across all aggregated catalogs via `SelectMany`.
- **`IEnumerable<ModuleInfo> GetDependentModules(ModuleInfo moduleInfo)`** - Returns dependent modules for the given `moduleInfo` by locating the owning catalog and delegating the call. Uses `Single()` to find the catalog containing the module.
- **`IEnumerable<ModuleInfo> CompleteListWithDependencies(IEnumerable<ModuleInfo> modules)`** - Returns a complete list of modules including all dependencies. Groups modules by their owning catalog and delegates to each catalog's `CompleteListWithDependencies`.
- **`void Initialize()`** - Initializes all aggregated catalogs by calling `Initialize()` on each.
- **`void AddModule(ModuleInfo moduleInfo)`** - Adds a `ModuleInfo` to the first catalog in the list (`_catalogs[0]`).
### Invariants
- The `_catalogs` list is never null; it is initialized in the constructor and always contains at least one catalog (the default `ModuleCatalog`).
- The first catalog (`_catalogs[0]`) is always an instance of `Microsoft.Practices.Prism.Modularity.ModuleCatalog`.
- `AddCatalog` will throw `ArgumentNullException` if passed a null catalog.
- `GetDependentModules` assumes each `ModuleInfo` exists in exactly one catalog; behavior is undefined if a module appears in multiple catalogs.
### Dependencies
**Depends on:**
- `Microsoft.Practices.Prism.Modularity` - `IModuleCatalog`, `ModuleCatalog`, `ModuleInfo`
**Depended on by:**
- Not determinable from source alone; likely consumed by application bootstrapping/initialization code.
### Gotchas
- **`AddModule` always adds to the first catalog only** (`_catalogs[0]`), not to all catalogs or a user-specified catalog. This may cause confusion if developers expect modules to be distributed across catalogs.
- **`GetDependentModules` uses `Single()`** which will throw `InvalidOperationException` if the module is not found in any catalog or exists in multiple catalogs.
- The XML documentation comments reference `DataPro.Main.ModuleCatalog` which appears to be a stale/incorrect reference; the actual class is

View File

@@ -0,0 +1,263 @@
---
source_files:
- DataPRO/DataPRO/Pages/ATDMonitorStatusPage.cs
- DataPRO/DataPRO/Pages/CopyAndTrimPage.cs
- DataPRO/DataPRO/Pages/RenameTestPage.cs
- DataPRO/DataPRO/Pages/DownloadAndView.cs
- DataPRO/DataPRO/Pages/TimedWaitControl.xaml.cs
- DataPRO/DataPRO/Pages/ModalPage.xaml.cs
- DataPRO/DataPRO/Pages/SplashScreen.xaml.cs
- DataPRO/DataPRO/Pages/AddGraphPage.cs
- DataPRO/DataPRO/Pages/StatusLinePage.cs
- DataPRO/DataPRO/Pages/EditGraphPage.cs
- DataPRO/DataPRO/Pages/RealtimePage.cs
- DataPRO/DataPRO/Pages/DownloadDataPage.cs
- DataPRO/DataPRO/Pages/ChangeView.xaml.cs
- DataPRO/DataPRO/Pages/EditUserDetailsPage.cs
- DataPRO/DataPRO/Pages/LoginControl2.xaml.cs
- DataPRO/DataPRO/Pages/UsersPage.cs
generated_at: "2026-04-17T15:46:52.496358+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ddb7d9cc557ee4d9"
---
# DataPRO Pages Module Documentation
## 1. Purpose
This module contains the page definitions and UI controls that comprise the main interface of the DataPRO application. It provides specialized pages for user management (authentication, user editing), test configuration and monitoring (ATD Monitor Status, Status Line Check, Realtime diagnostics), data export operations (Copy and Trim, Rename Test, Download and View), and graph management (Add/Edit Graph). All page classes inherit from a common `DataPROPage` base class (or `RunTestBase` for wizard-style pages) and implement a consistent pattern for navigation, button handling, and lifecycle management via `OnSetActive()` and `UnSet()` methods.
---
## 2. Public Interface
### ATDMonitorStatusPage
```csharp
public class ATDMonitorStatusPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ATDMonitorStatusPage(DataModel.TabPageItem item)` | Initializes with transparent background, search control enabled, and creates an embedded `Controls.TestSetups.ATDMonitorStatus` control |
| CurrentTest | `DataModel.TestTemplate` (setter only) | Forwards the test template to the internal `_statusControl` |
| UniqueId | `string` | Returns constant `"TestSetups_ATDMonitorStatusPage"` |
| UnSet | `void UnSet()` | Overrides base implementation (calls base only) |
### CopyAndTrimPage
```csharp
public class CopyAndTrimPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `CopyAndTrimPage(DataModel.TabPageItem item)` | Initializes with `UsesModifyEnhancements = true`, no save/next buttons |
| UniqueId | `string` | Returns `"Review_ExportData_CopyAndTrim"` |
| DownloadFolder | `string` | Gets/sets download folder path (default: `string.Empty`) |
| IsROI | `bool` | Gets/sets ROI flag (default: `false`) |
| TestItem | `string` | Gets/sets test item identifier |
| AvailableTestIds | `List<string>` | Gets/sets list of available test IDs |
| DTSFilePath | `string` | Gets/sets DTS file path |
### RenameTestPage
```csharp
public class RenameTestPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RenameTestPage(DataModel.TabPageItem item)` | Initializes similarly to `CopyAndTrimPage` with `UsesModifyEnhancements = true` |
| UniqueId | `string` | Returns `"Review_ExportData_Rename"` |
| AvailableTestNames | `List<string>` | Gets/sets list of available test names (in addition to IDs from `CopyAndTrimPage`) |
### DownloadAndView
```csharp
public class DownloadAndView : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DownloadAndView(DataModel.TabPageItem item)` | Basic constructor |
| Constructor | `DownloadAndView(DataModel.TabPageItem item, int possibleSteps)` | Constructor with step count for wizard navigation |
| UniqueId | `string` | Returns constant `"Record_DownloadAndView"` |
| NavigateToROIDownload | `void NavigateToROIDownload()` | Sets current step to `_downloadROIControlNavStep` |
| OnSetActive | `void OnSetActive()` | Resets `ROINext_OK` and `ALLNext_OK` flags, subscribes to `AutomaticModeStatusEvent` via `IEventAggregator` |
| UnSet | `void UnSet()` | Clears search term and calls `StartSearch(string.Empty)` on `_downloadROIControl` |
### TimedWaitControl
```csharp
public partial class TimedWaitControl : UserControl, INotifyPropertyChanged
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TimedWaitControl()` | Parameterless constructor |
| Constructor | `TimedWaitControl(MainWindow MainWindow)` | Constructor with main window reference |
| ManualResetEvent | `System.Threading.ManualResetEvent` | Gets/sets synchronization primitive |
| MarkDone | `void MarkDone()` | Signals the `ManualResetEvent` and sets it to null |
| SetValuePercent | `void SetValuePercent(double d)` | Updates progress bar via `ctrlStatusRibbon.SetProgressValue()` |
| SetActive | `void SetActive()` | Empty implementation |
| SetStatusMessage | `void SetStatusMessage(string msg)` | Sets status text via `ctrlStatusRibbon.SetStatusTextNoTranslate()` |
| CancelButtonVisibility | `Visibility` | Bindable property for cancel button visibility |
| PropertyChanged | `event PropertyChangedEventHandler` | INotifyPropertyChanged implementation |
### ModalPage
```csharp
public partial class ModalPage : UserControl, INotifyPropertyChanged
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ModalPage()` | Parameterless constructor |
| Constructor | `ModalPage(MainWindow MainWindow)` | Constructor with main window reference |
| SetContent | `void SetContent(IModalContent content)` | Sets modal content, calls `OnSetActive()`, assigns `CloseFunction` |
| OnCloseDelegate | `delegate void OnCloseDelegate()` | Delegate type for close callbacks |
#### IModalContent Interface
```csharp
public interface IModalContent
```
| Member | Signature | Description |
|--------|-----------|-------------|
| DialogResult | `System.Windows.Forms.DialogResult` | Gets the dialog result |
| CloseFunction | `OnCloseDelegate` | Gets/sets the close callback |
| OnSetActive | `void OnSetActive()` | Called when content becomes active |
| PromptString | `string` | Gets/sets prompt text |
| ReusableMessageBox | `bool` | Flag for reusable message box scenarios |
| SetButtons | `void SetButtons(PageButton[] buttons)` | Sets page buttons |
| DefaultButton | `PageButton` | Gets/sets the default button |
### SplashScreen
```csharp
public partial class SplashScreen : Window
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `SplashScreen()` | Initializes with Xceed license key, `ShowInTaskbar = false`, `ResizeMode = NoResize` |
| Version | `string` (setter) | Sets `txt_VersionString.Text` |
| DbVersion | `string` (setter) | Sets `txt_DbVersionString.Text` |
| LicensedTo | `string` (setter) | Sets `txt_LicensedTo.Text` |
| LicenseType | `DataProLicensingEnums.LicenseType` | Gets/sets license type; setter calls `SetBackgroundImage()` |
| Copyright | `string` (setter) | Sets `txt_Copyright.Text` |
| SetBackgroundImage | `void SetBackgroundImage()` | Updates banner image based on `RunTestVariables.IsTSRAIRGo` and `LicenseType` |
### AddGraphPage
```csharp
public class AddGraphPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `AddGraphPage(DataModel.TabPageItem item)` | Initializes with no search/select controls, no next/back buttons |
| UniqueId | `string` | Returns `"Review_ViewData_AddGraph"` |
| saveButton | `Controls.PageButton` | Public field for Save button |
| saveAsButton | `Controls.PageButton` | Public field for Save As button |
| saveAndAddAnotherButton | `Controls.PageButton` | Public field for Save and Add Another button |
| AddPageButtons | `void AddPageButtons()` | Creates Cancel, Save, SaveAs, SaveAndAddAnother, View buttons |
| OnButtonPress | `bool OnButtonPress(Controls.PageButton button)` | Handles button presses; View and Cancel navigate to previous page |
### StatusLinePage
```csharp
public class StatusLinePage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `StatusLinePage(DataModel.TabPageItem item)` | Creates `Controls.TestSetupsControl` with `Color_ApplicationTileCalibration` |
| UniqueId | `string` | Returns constant `"Diagnostics_StatusLineCheck"` |
| OnSetActive | `void OnSetActive()` | Calls `SetRunButtonEnabled()` |
| OnButtonPress | `bool OnButtonPress(Controls.PageButton button)` | Handles `Record_StatusLineCheckRunButton` to call `SetNewTest()` |
### EditGraphPage
```csharp
public class EditGraphPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `EditGraphPage(DataModel.TabPageItem item)` | Initializes similarly to `AddGraphPage` |
| UniqueId | `string` | Returns `"Review_ViewData_EditGraph"` |
| IsSingleChannelGraph | `bool` | Setter disables `saveButton` when `true` |
| saveButton, saveAsButton, saveAndEditAnotherButton | `Controls.PageButton` | Public button fields |
| OnButtonPress | `bool OnButtonPress(Controls.PageButton button)` | Handles button presses; SaveAndEditAnother, View, and Cancel navigate to previous page |
### RealtimePage
```csharp
public class RealtimePage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RealtimePage(DataModel.TabPageItem item)` | Creates `Controls.TestSetupsControl` with `Color_ApplicationTileCalibration` |
| UniqueId | `string` | Returns constant `"Diagnostics_Realtime"` |
| OnButtonPress | `bool OnButtonPress(Controls.PageButton button)` | Handles `Record_RealtimeRunButton`, logs user action via `APILogger.Log()` |
### DownloadDataPage
```csharp
public class DownloadDataPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DownloadDataPage(DataModel.TabPageItem item)` | Creates `Controls.TestSetupsControl` with `Color_ApplicationTileCollectData` |
| UniqueId | `string` | Returns constant `"Record_DownloadAndView"` |
| OnButtonPress | `bool OnButtonPress(Controls.PageButton button)` | Handles `Record_DownloadData_RunButton`, logs user action via `APILogger.Log()` |
### ChangeView
```csharp
public partial class ChangeView : Window, INotifyPropertyChanged
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ChangeView()` | Subscribes to `Activated` and `Deactivated` events |
| AvailableUsers | `User[]` | Gets/sets all available users for selection |
| FilteredUsers | `User[]` | Gets filtered users based on `tbSearch.Text` (searches `UserName` and `Name` fields) |
| OK_Click | `void OK_Click(object sender, RoutedEventArgs e)` | Calls `App.ChangeView()` and `MainWindow.CloseChangeView()` |
| Cancel_Click | `void Cancel_Click(object sender, RoutedEventArgs e)` | Calls `MainWindow.CloseChangeView()` |
| Window_Closing | `void Window_Closing(object sender, CancelEventArgs e)` | Cancels close and calls `CloseChangeView()` instead |
### EditUserDetailsPage
```csharp
public class EditUserDetailsPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `EditUserDetailsPage(DataModel.TabPageItem item)` | Creates three NavSteps with `EditUserInfoControl`, `EditUserPermissionsControl`, `EditUserVisibilityControl` |
| UniqueId | `string` | Returns `"Admin_Users_EditUserDetails_Page"` |
| IsAddPage | `bool` | Controls add/edit mode; setter updates `IsAdd` and `_userInfoControl.IsAdd` |
| CurrentUser | `DTS.Slice.Users.User` | Gets/sets current user; propagates to all child controls |
| OnSetActive | `void OnSetActive()` | Sets modified state to `Unmodified`, resets nav to first step |
| SaveAndExitButtonPress | `void SaveAndExitButtonPress()` | Validates, commits via `UserCollection.UsersList.Commit()`, navigates to previous page |
| SaveButtonPress | `void SaveButtonPress()` | Validates and commits without navigation |
| Validate | `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Aggregates validation from all three child controls |
### LoginControl2
```csharp
public partial class LoginControl2 : UserControl, INotifyPropertyChanged
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `LoginControl2()` | Parameterless constructor, sets version string |
| Constructor | `LoginControl2(MainWindow MainWindow)` | Constructor with main window reference |
| Users | `UserData[]` | Gets sorted, filtered user list from `UserCollection.GetAllUsers()` |
| RememberPassword | `bool` | Gets/sets remember password flag |
| SetActive | `void SetActive()` | Navigates to home page if current user matches default |
| UpdateUsers | `void UpdateUsers()` | Raises `PropertyChanged` for `Users` |
| button_Click | `void button_Click(object sender, RoutedEventArgs e)` | Handles login via `App.LoginUser()`, optionally saves credentials, shows license prompts |
### UsersPage
```csharp
public class UsersPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `UsersPage(DataModel.TabPageItem item)` | Creates `Controls.UserListControl` with transparent background |
| UniqueId | `string` | Returns `"Admin_Users"` |
| OnSetActive | `void OnSetActive()` | Updates user list, publishes `ProgressBarEvent` |
| OnButtonPress | `bool OnButtonPress(Controls.PageButton button)` | Handles Add, Edit, Delete buttons |
| ChallengeUserDelete | `void ChallengeUserDelete(User[] users)` | Shows confirmation dialog, performs deletion via `UserCollection.UsersList.Delete()` |
| SetPagePermissions | `void SetPagePermissions()` | Restricts buttons based on admin status and license type (TSRAIR, Standard, StandardSite disable Add) |
---
## 3. Invariants
1. **UniqueId Consistency**: Every page must return a constant string from `UniqueId` property. This is used for page identification and navigation.
2. **Constructor Pattern**: All `DataPROPage`-derived classes must accept a `DataModel.TabPageItem` parameter passed to the base constructor.
3. **Button Handling Pattern**: Button presses are handled via `OnButtonPress(PageButton button)` with `Enum.TryParse` to match button IDs defined in nested `ButtonIds` enums.
4. **User Deletion Rules** (UsersPage):
- Default users (Admin, PowerUser, User, Guest) cannot be deleted unless they are duplicates without default IDs
- Users cannot delete themselves
- Delete button visibility is controlled by `IsADefault

View File

@@ -0,0 +1,251 @@
---
source_files:
- DataPRO/DataPRO/Pages/DAS/ImportDASRecordPage.cs
- DataPRO/DataPRO/Pages/DAS/EditDASRecordPage.cs
- DataPRO/DataPRO/Pages/DAS/ExportDASRecordPage.cs
- DataPRO/DataPRO/Pages/DAS/DASUsageReportPage.cs
- DataPRO/DataPRO/Pages/DAS/AutoDetectDASPage.cs
- DataPRO/DataPRO/Pages/DAS/ReplaceHardwarePage.cs
- DataPRO/DataPRO/Pages/DAS/DataRecordersPage.cs
- DataPRO/DataPRO/Pages/DAS/HardwareDiscovery.cs
generated_at: "2026-04-17T15:51:14.119637+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "097cccef928406b7"
---
# DAS Pages Module Documentation
## 1. Purpose
This module provides the user interface pages for managing Data Acquisition System (DAS) hardware within the DataPRO application. It encompasses functionality for importing, exporting, editing, auto-detecting, and replacing DAS hardware records, as well as generating usage reports and discovering hardware on the network. These pages inherit from `DataPROPage` and serve as containers for their respective controls, orchestrating navigation, validation, and persistence workflows for DAS hardware management.
---
## 2. Public Interface
### ImportDASRecordPage
**Signature:** `public ImportDASRecordPage(DataModel.TabPageItem item)`
A page for importing DAS records from external sources. Configured with save functionality but no next button. On save, delegates to `Controls.ImportDASRecordControl.Import()` and sets the page state to `Saved`.
- `UniqueId` → Returns `DataRecordersPage.ImportDASPageId`
- `OnSetActive()` → Sets `ModifyStates.Unmodified` and calls base
- `SaveAndExitButtonPress()` → Calls `Import()` then base method
- `SaveButtonPress()` → Calls `Import()` then base method
---
### EditDASRecordPage
**Signature:** `public EditDASRecordPage(DataModel.TabPageItem item)`
A page for editing or adding individual DAS hardware records. Supports both add and edit modes via `IsAdd` property.
- `UniqueId` → Returns `DataRecordersPage.EditDASDetailsPageId`
- `SetHardware(DataModel.DASHardware hardware, bool isAdd)` → Passes hardware context to `_editDASControl`
- `Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` → Delegates to `_editDASControl.Validate()`
- `SaveAndExitButtonPress()` → Validates, saves via `_editDASControl.Save()`, reports errors, navigates to previous page
- `SaveButtonPress()` → Validates and saves without navigation
- `_requiredPermission` → Returns `User.UserPermissionLevels.Edit`
---
### ExportDASRecordPage
**Signature:** `public ExportDASRecordPage(DataModel.TabPageItem item)`
A page for exporting DAS records. Does not use save button; export is triggered via a custom page button.
- `UniqueId` → Returns `DataRecordersPage.ExportDASPageId`
- `OnSetActive()` → Calls base and `_exportDASControl.OnSetActive()`
- `OnButtonPress(Controls.PageButton button)` → Handles `ButtonIDs.ExportDASRecordPage_ExportButton`, validates, and calls `_exportDASControl.Export()`
**Private enum:**
```csharp
private enum ButtonIDs { ExportDASRecordPage_ExportButton }
```
---
### DASUsageReportPage
**Signature:** `public DASUsageReportPage(DataModel.TabPageItem item)`
A page for generating DAS usage reports. Uses a custom "Run" button instead of save.
- `UniqueId` → Returns `DataRecordersPage.DASUsageReportPageId`
- `OnSetActive()` → Calls base and `_dasUsageReportControl.OnSetActive()`
- `OnButtonPress(Controls.PageButton button)` → Handles `ButtonIDs.DASUsageReportRecordPage_RunButton`, validates, and calls `_dasUsageReportControl.Run()`
**Private enum:**
```csharp
private enum ButtonIDs { DASUsageReportRecordPage_RunButton }
```
---
### AutoDetectDASPage
**Signature:** `public AutoDetectDASPage(DataModel.TabPageItem item)`
A page for auto-detecting DAS hardware on the network.
- `UniqueId` → Returns `DataRecordersPage.AutoDetectDASPageId`
- `AutoMode` (property) → Gets/sets `_autoDetectControl.AutoMode`
- `Hardware` (property) → Gets/sets `DataModel.DASHardware`
- `RequeryConfig()` → Delegates to `_autoDetectControl.RequeryConfig()`
- `SaveAndExitButtonPress()` → Calls `_autoDetectControl.Save()` and navigates to previous page
- `SaveButtonPress()` → Calls `_autoDetectControl.Save()` and sets state to `Saved`
- `OnSetActive()` → Sets `ModifyStates.Unmodified` and calls base
---
### ReplaceHardwarePage
**Signature:** `public ReplaceHardwarePage(DataModel.TabPageItem item)`
A page for replacing DAS hardware within a test template context. Uses event aggregation for hardware replacement operations.
- `UniqueId` → Returns `"Prepare_TestSetups_EditTestSetup_Page_ReplaceHardware"`
- `TestTemplate` (property) → The `DataModel.TestTemplate` context for replacement
- `OnSetActive()` → Initializes viewmodels, subscribes to events, configures hardware list
- `DoneButtonPress()` → Propagates modification state to `_referringPage` based on `_bModificationsWereMade`
- `UnSet()` → Unsubscribes from events and calls base
- `Validate(...)` → Always returns `true`
- `_requiredPermission` → Returns `User.UserPermissionLevels.Edit`
**Private methods:**
- `OnReplaceEvent(Tuple<IHardware, IHardware> tuple)` → Handles `HardwareReplaceEvent`, updates `TestTemplate`
- `InitializeVMsIfNeeded()` → Resolves `IUnityContainer`, `IEventAggregator`, `IHardwareListViewModel`
---
### DataRecordersPage
**Signature:** `public DataRecordersPage(DataModel.TabPageItem item)`
The main landing page for DAS management, displaying a tile-based interface for navigating to sub-functions.
- `UniqueId` → Returns `"Hardware_DataRecorders"`
**Public constants:**
```csharp
public const string EditDASDetailsPageId = "Hardware_DataRecorders_EditDASDetails";
public const string ExportDASPageId = "Hardware_DataRecorders_ExportDAS";
public const string ImportDASPageId = "Hardware_DataRecorders_ImportDAS";
public const string AutoDetectDASPageId = "Hardware_DataRecorders_AutoDetectDAS";
public const string DASUsageReportPageId = "Hardware_DataRecorders_DASUsageReport";
```
**Public methods:**
- `RefreshButtonPressed()` → Reloads `DASHardwareList` and updates control
- `EditSelectedHardware()` → Navigates to `EditDASRecordPage` with selected hardware
- `DeleteConfirmationWindow()` → Shows modal delete confirmation (handles dispatcher invocation)
- `OnButtonPress(Controls.PageButton button)` → Handles all tile navigation and delete operations
**Private enum ButtonIDs:**
```csharp
Hardware_DataRecorders_Page_AddButton,
Hardware_DataRecorders_Page_EditButton,
Hardware_DataRecorders_Page_DeleteButton,
Hardware_DataRecorders_Page_ConfirmDelete_YesButton,
Hardware_DataRecorders_Page_ConfirmDelete_NoButton,
Hardware_DataRecorders_Page_AutoDetectButton,
Hardware_DataRecorders_Page_ExportButton,
Hardware_DataRecorders_Page_ImportButton,
Hardware_DataRecorders_Page_DASUsageReportButton,
Hardware_DataRecorders_Page_DeleteAllButton
```
---
### HardwareDiscovery
**Signature:** `public HardwareDiscovery(DataModel.TabPageItem item, Location location)`
A multi-purpose page for hardware discovery, usable from multiple application contexts.
**Public enum:**
```csharp
public enum Location { RunTest, EditTestSetup, EditObject, DataRecorders, CheckHardware, TestSetups }
```
- `UniqueId` → Returns `"Hardware_DataRecorders_HardwareDiscovery"`
- `ExistingSelections` (property) → Pre-selects hardware in the control
- `TestSetup` (property) → `DataModel.TestTemplate` context
- `SetHardwareFunc` (property) → Callback for setting hardware after discovery
- `SetChannelAssignments(IGroup[] groups, Dictionary<IGroup, IGroupChannel[]> groupToGroupChannel)` → Configures channel assignments
- `BuildAndOrRun(bool runTestAfterBuild)` → Switches to `_buildTestSetupControl` for quick build
- `ShowBusy(bool busy)` → Sets wait cursor
- `CancelButtonPress()` → Calls `_control.CancelRequest()`
- `DoneButtonPress()` → Handles state propagation for quick build scenarios
- `SaveAndExitButtonPress()` → Saves hardware, sets hardware/sensors, navigates back
- `SaveButtonPress()` → Saves hardware, updates assignments, publishes `PageModifiedEvent`
---
## 3. Invariants
1. **Page Configuration Consistency:** All DAS pages inherit from `DataPROPage` and must call the base constructor with a `DataModel.TabPageItem`.
2. **Unique IDs:** Each page must return a constant, unique `UniqueId` string used for page registration and navigation.
3. **Permission Requirements:** `EditDASRecordPage` and `ReplaceHardwarePage` require `User.UserPermissionLevels.Edit` permission.
4. **Event Subscription Lifecycle:** `ReplaceHardwarePage` must unsubscribe from `HardwareReplaceEvent` in `UnSet()` to prevent memory leaks.
5. **Delete Cascade Behavior:** When deleting DAS hardware, associated SLICE Bridge, SLICE IEPE, and embedded sensor ICs are automatically included in the deletion list via `GetAnySLICEBridges()` and `GetAnyEmbeddedSensorICs()`.
6. **State Propagation:** Pages that modify data must propagate `ModifyStates.Modified` to their `_referringPage` on save/done actions.
7. **Dispatcher Affinity:** `DataRecordersPage.DeleteConfirmationWindow()` explicitly checks `Dispatcher.CheckAccess()` and uses `BeginInvoke` for thread-safe modal display.
---
## 4. Dependencies
### External Dependencies (from imports):
- `System.Windows` - WPF UI framework
- `System.Collections.Generic` - Generic collections
- `Prism.Events` - `IEventAggregator`, event publishing
- `Prism.Ioc` - `ContainerLocator`
- `Unity` - `IUnityContainer` for DI
- `DTS.Slice.Users` - `User.UserPermissionLevels`
- `DTS.Common.Utilities.Logging` - `APILogger`
- `DTS.Common.Events` - `ProgressBarEvent`, `PageModifiedEvent`
- `DTS.Common.Events.Hardware.HardwareList` - `HardwareReplaceEvent`
- `DTS.Common.Interface.DASFactory.Diagnostics.HardwareList` - `IHardware`, `IHardwareListViewModel`
- `DTS.Common.Interface.Channels` - `IGroupChannel`
- `DTS.Common.Interface.Groups.GroupList` - `IGroup`
- `DTS.Common.Enums.Hardware` - `HardwareTypes`
- `DTS.Common.SharedResource.Strings` - `StringResources`
### Internal Dependencies:
- `DataPROPage` (base class)
- `Controls.ImportDASRecordControl`, `Controls.EditDASRecordControl`, `Controls.ExportDASRecordControl`, `Controls.DASUsageReportControl`, `Controls.AutoDetectDASControl`, `Controls.HardwareDiscoveryControl`, `Controls.BuildTestSetupControl`
- `Controls.DAS.DataRecodersTileControl`
- `Controls.PageButton`, `Controls.PageButtons`
- `Controls.ModalUserPrompt`
- `DataModel.DASHardware`, `DataModel.TestTemplate`, `DataModel.TabPageItem`
- `DataModel.Classes.Hardware.DASHardwareList`
- `MainWindow`, `App`
- `PageHeaderRibbon`, `BrushesAndColors`
- `Strings.StringResources`
### Dependents (inferred):
- `EditTestSetupPage` - referenced in `HardwareDiscovery.DoneButtonPress()`
- `EditObjectPage` - referenced in `HardwareDiscovery.SetSensorsIfNeeded()`
- `IEditObjectSensorsControlPage` - interface used for sensor propagation
---
## 5. Gotchas
1. **Double Assignment in EditDASRecordPage Constructor:** `UsesSearchControl` is assigned twice in the constructor—first `true`, then `false`. The effective value is `false`. This may be unintentional or legacy code.
2. **Commented-Out Code in AutoDetectDASPage:** The constructor contains commented-out lines referencing FB 5314:
```csharp
//HasBackButton = false; // set to false per FB 5314; prev page is now handled by 'cancel' pagebutton
// okay, now put it back [DTM 2015-11-03]
HasBackButton = true;
```
This indicates historical back-and-forth on navigation behavior.
3. **ReplaceHardwarePage.Validate Always Returns True:** The `Validate` method returns `true` unconditionally with commented-out code:
```csharp
return true;
//return _vm.Validate(ref errors, ref warnings, displayWindow);
```
Validation logic may have been intentionally disabled or is pending implementation.
4. **Redundant Base Call in OnButtonPress:** In `ExportDASRecordPage.OnButtonPress()` and `DASUsageReportPage.OnButtonPress()`, `base.OnButtonPress(button)` is called multiple times in the same method flow (at the beginning, in a nested `if`, and at the end). This could lead to unexpected behavior if the base implementation has side effects.
5. **Delete All Button Behavior:** `Hardware_DataRecorders_Page_DeleteAllButton` selects all hardware before showing the delete confirmation, meaning "Delete

View File

@@ -0,0 +1,314 @@
---
source_files:
- DataPRO/DataPRO/Pages/Sensors And Models/DiagnosticsTrackingPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/TestHistoryPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/SensorUsageReportPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/ImportSensorModelsPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/ExportSensorsPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/BulkEditPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/MeasureBridgeReadIDPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/HardwareSensorsAndSquibs.cs
- DataPRO/DataPRO/Pages/Sensors And Models/EditSensorModelDetailsPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/ImportSensorsPage.cs
- DataPRO/DataPRO/Pages/Sensors And Models/HardwareSensorModels.cs
generated_at: "2026-04-17T15:48:41.029845+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "7a408ffe49003c47"
---
# Sensors and Models Pages Documentation
## 1. Purpose
This module contains the page definitions for the Sensors and Models section of the DataPRO application. Each page serves as a container/wrapper for specialized WPF user controls, handling page lifecycle, button management, navigation, and user interaction routing. The pages follow a consistent pattern where they inherit from `DataPROPage`, configure UI chrome elements (navigation, search, save buttons), delegate content rendering to child controls, and handle button press events. This module exists to separate page-level concerns (navigation, permissions, button handling) from control-level concerns (data display, user input).
---
## 2. Public Interface
### DiagnosticsTrackingPage
```csharp
public class DiagnosticsTrackingPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DiagnosticsTrackingPage(DataModel.TabPageItem item)` | Initializes page with disabled NAV, search, select controls, and no next button. Creates `Controls.Sensors_and_models.DiagnosticsTracking` as main content. |
| `UniqueId` | `override string UniqueId => MY_ID` | Returns `"Hardware_Sensors_DiagnosticsTracking"`. |
| `MY_ID` | `const string MY_ID = "Hardware_Sensors_DiagnosticsTracking"` | Constant unique identifier. |
| `OnButtonPress` | `override bool OnButtonPress(PageButton button)` | Delegates to `_diagnosticsTracking.OnButtonPress(button)` or falls back to base. |
---
### TestHistoryPage
```csharp
internal class TestHistoryPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TestHistoryPage(DataModel.TabPageItem item)` | Initializes with disabled NAV, search, select, modify enhancements, and save button. Creates `SensorTestHistoryControl` as main content. |
| `UniqueId` | `override string UniqueId => MyId` | Returns `"Hardware_Sensors_TestHistory"`. |
| `MyId` | `const string MyId = "Hardware_Sensors_TestHistory"` | Constant unique identifier. |
| `DisplaySensorHistory` | `void DisplaySensorHistory(string serialNumber)` | Delegates to `_control.DisplaySensorTestHistory(serialNumber)`. |
| `OnSetActive` | `override void OnSetActive()` | Calls base and `_control.OnSetActive()`. |
---
### SensorUsageReportPage
```csharp
public class SensorUsageReportPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `SensorUsageReportPage(DataModel.TabPageItem item)` | Initializes with search control enabled, NAV/select disabled, no next button. Creates `Controls.Sensors_and_models.SensorUsageReportControl`. |
| `UniqueId` | `override string UniqueId => MY_ID` | Returns `"Hardware_Sensors_UsageReport"`. |
| `MY_ID` | `const string MY_ID = "Hardware_Sensors_UsageReport"` | Constant unique identifier. |
| `Run` | `void Run()` | Validates page and calls `_sensorUsageReportControl.Run()`. Uses dispatcher for thread affinity. |
| `OnButtonPress` | `override bool OnButtonPress(Controls.PageButton button)` | Handles `Hardware_Sensors_UsageReport_Page_Run` button, logs user action, calls `Run()`. |
**Private enum:** `ButtonIds` with value `Hardware_Sensors_UsageReport_Page_Run`
---
### ImportSensorModels
```csharp
public class ImportSensorModels : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ImportSensorModels(DataModel.TabPageItem item)` | Initializes with NAV/search/select disabled, no back button. Creates `Controls.ImportSensorModelsControl`. |
| `UniqueId` | `override string UniqueId => MyId` | Returns `"Hardware_SensorModels_ImportSensorModels"`. |
| `MyId` | `const string MyId = "Hardware_SensorModels_ImportSensorModels"` | Constant unique identifier. |
| `OnSetActive` | `override void OnSetActive()` | Calls base and `_importControl.OnSetActive()`. |
| `UnSet` | `override void UnSet()` | Calls `_importControl.UnSet()`. |
| `OnButtonPress` | `override bool OnButtonPress(Controls.PageButton button)` | Handles `Hardware_SensorModels_ImportSensorModels_Page_CloseButton`, navigates to previous page via `MainWindow.GoToPreviousPage()`. |
**Private enum:** `ButtonIds` with value `Hardware_SensorModels_ImportSensorModels_Page_CloseButton`
---
### ExportSensorsPage
```csharp
public class ExportSensorsPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ExportSensorsPage(DataModel.TabPageItem item)` | Initializes with NAV/search/select disabled, no next button. Creates `Controls.Sensors_and_models.ExportSensorsControl`. |
| `UniqueId` | `override string UniqueId => MY_ID` | Returns `"Hardware_Sensors_ExportSensors"`. |
| `MY_ID` | `const string MY_ID = "Hardware_Sensors_ExportSensors"` | Constant unique identifier. |
| `RunExportOnStartup` | `bool RunExportOnStartup { get; set; }` | Property with `SetProperty` notification. When true, auto-exports on `OnSetActive()` after 100ms delay. |
| `Export` | `void Export()` | Sets `RunExportOnStartup` to false, validates, calls `_exportControl.Export()`. Uses dispatcher. |
| `SetFilename` | `void SetFilename(string fullfilepath)` | Sets `_exportControl.FullFilePath`. |
| `ExportFormat` | `new SupportedExportFormats ExportFormat { get; set; }` | Property for export format (defaults to `TDCSensorDatabaseCSV`). Note: `new` keyword hides base member. |
| `OnSetActive` | `override void OnSetActive()` | Auto-exports if `RunExportOnStartup` is true. |
| `OnButtonPress` | `override bool OnButtonPress(Controls.PageButton button)` | Handles `Hardware_Sensors_ExportSensors_Page_Export` button. |
**Public enum:** `SupportedExportFormats` with value `TDCSensorDatabaseCSV`
**Private enum:** `ButtonIds` with value `Hardware_Sensors_ExportSensors_Page_Export`
---
### BulkEditPage
```csharp
internal class BulkEditPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `BulkEditPage(DataModel.TabPageItem item)` | Initializes with NAV/search/select disabled, modify enhancements enabled, save button enabled. Creates `Controls.Sensors_and_models.BulkEdit`. Sets Add/Edit ID strings. |
| `UniqueId` | `override string UniqueId => MyId` | Returns `"Hardware_Sensors_BulkEdit"`. |
| `MyId` | `const string MyId = "Hardware_Sensors_BulkEdit"` | Constant unique identifier. |
| `SetSelectedSensors` | `void SetSelectedSensors(SensorData[] sensors)` | Creates `SensorAggregate` from sensors, assigns to control, hooks `PropertyChanged` event for modification tracking. |
| `OnSetActive` | `override void OnSetActive()` | Calls base and `((IPageContent)_control).OnSetActive()`. |
| `SaveButtonPress` | `override void SaveButtonPress()` | Commits all sensors via `SensorsCollection.SensorsList.Commit()`, sets state to Saved. |
| `SaveAndExitButtonPress` | `override void SaveAndExitButtonPress()` | Commits sensors, sets state to Saved, navigates to previous page. |
---
### MeasureBridgeReadIDPage
```csharp
internal class MeasureBridgeReadIDPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `MeasureBridgeReadIDPage(DataModel.TabPageItem item)` | Initializes with search enabled, modify enhancements enabled, save button enabled. Creates `Controls.MeasureBridgeControl`. |
| `UniqueId` | `override string UniqueId => MyId` | Returns `"Hardware_Sensors_MeasureBridgeReadID"`. |
| `MyId` | `const string MyId = "Hardware_Sensors_MeasureBridgeReadID"` | Constant unique identifier. |
| `_modalExcessiveResistanceChangePage` | `public Controls.ModalUserPrompt` | Modal for excessive resistance change warning. |
| `_modalDuplicateSensorPage` | `public Controls.ModalUserPrompt` | Modal for duplicate sensor warning. |
| `_modalTooManySensorsPage` | `public Controls.ModalUserPrompt` | Modal for too many sensors warning. |
| `_modalIncompatibleSensorsPage` | `public Controls.ModalUserPrompt` | Modal for incompatible sensors warning. |
| `DuplicateSensorWindow` | `void DuplicateSensorWindow(string warningMessage)` | Shows duplicate sensor modal via `MainWindow.DoModalWindow()`. Uses dispatcher. |
| `IncompatibleSensorsWindow` | `void IncompatibleSensorsWindow(string warningMessage)` | Shows incompatible sensors modal. Uses dispatcher. |
| `TooManySensorsWindow` | `void TooManySensorsWindow(string warningMessage)` | Shows too many sensors modal. Uses dispatcher. |
| `ExcessiveResistanceChangeWindow` | `void ExcessiveResistanceChangeWindow(string warningMessage)` | Shows excessive resistance change modal. Uses dispatcher. |
| `OnButtonPress` | `override bool OnButtonPress(Controls.PageButton button)` | Chains to base then `_measureBridgeControl.OnButtonPress()`. |
| `OnSetActive` | `override void OnSetActive()` | Sets `MainContent = _measureBridgeControl`. |
| `SaveButtonPress` | `override void SaveButtonPress()` | Calls `_measureBridgeControl.SaveButtonPress(false)`. |
| `SaveAndExitButtonPress` | `override void SaveAndExitButtonPress()` | Calls `_measureBridgeControl.SaveButtonPress(true)`. |
---
### HardwareSensorsAndSquibs
```csharp
public class HardwareSensorsAndSquibs : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `HardwareSensorsAndSquibs(DataModel.TabPageItem item)` | Initializes with search enabled (500ms delay), modify enhancements enabled, save/refresh buttons enabled. Creates `SensorsDatabaseControl`. |
| `UniqueId` | `override string UniqueId => MY_ID` | Returns `"Hardware_Sensors"`. |
| `MY_ID` | `const string MY_ID = "Hardware_Sensors"` | Constant unique identifier. |
| `SetSelection` | `void SetSelection(IGroupChannel channel)` | Filters to sensor on given channel via serial number search. |
| `SetSelection` | `void SetSelection(ISensorData sensor)` | Filters to given sensor via serial number search. |
| `ImportSensor` | `void ImportSensor()` | Navigates to `ImportSensorsPage`, sets `SensorsControl` reference. |
| `AddSensor` | `void AddSensor()` | Calls `_sensorsControl.AddNewSensor()`. |
| `BridgeUpdated` | `void BridgeUpdated()` | Propagates bridge update to `_sensorsControl`. |
| `OnPageModified` | `override void OnPageModified()` | Calls `_sensorsControl?.PageModified()`. |
| `RefreshButtonPressed` | `override void RefreshButtonPressed()` | Reloads `SensorsList` and `SensorCalibrationList`, calls `_sensorsControl.PostRefresh()`. |
| `UnSet` | `override void UnSet()` | Calls `((IPageContent)_sensorsControl).UnSet()`. |
| `FormClosing` | `override void FormClosing(Action OnComplete = null)` | Unsets control, calls base. |
| `OnButtonPress` | `override bool OnButtonPress(PageButton button)` | Chains base and `_sensorsControl.OnButtonPress()`. |
| `OnSetActive` | `override void OnSetActive()` | Sets `MainContent = _sensorsControl`. |
| `SetCurrentItem` | `override void SetCurrentItem(object o)` | If `SensorData`, calls `_sensorsControl.SetCurrentItem()`. |
| `AdvanceButtonPress` | `override bool AdvanceButtonPress(string id)` | Parses button ID and routes to appropriate action. |
| `SaveAndProgressButtonPress` | `override void SaveAndProgressButtonPress(string id)` | Saves sensors then advances. |
| `DontSaveAndProgressButtonPress` | `override void DontSaveAndProgressButtonPress(string id)` | Advances without saving. |
| `SaveButtonPress` | `override void SaveButtonPress()` | Calls `_sensorsControl.SaveSensorsButtonPress(null)`. |
| `SaveAndExitButtonPress` | `override void SaveAndExitButtonPress()` | Saves and navigates to previous page or saved state. |
| `_requiredPermission` | `override User.UserPermissionLevels _requiredPermission` | Returns `Edit`. |
---
### EditSensorModelDetailsPage
```csharp
public class EditSensorModelDetailsPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `EditSensorModelDetailsPage(DataModel.TabPageItem item)` | Initializes with add mode, modify enhancements enabled, save button enabled. Creates `Controls.ModelDatabaseControl`. |
| `UniqueId` | `override string UniqueId` | Returns `"Hardware_SensorModels_EditSensorModelDetails"`. |
| `_requiredPermission` | `override User.UserPermissionLevels _requiredPermission` | Returns `Edit`. |
| `CurrentModel` | `DTS.SensorDB.SensorModel CurrentModel { get; set; }` | Gets/sets model being edited. Hooks `PropertyChanged` for modification tracking. |
| `BridgeUpdated` | `void BridgeUpdated()` | Propagates to `_sensorModelInfoControl`. |
| `ModelSeparator` | `const string ModelSeparator = "_axis_"` | Separator for multi-axis model naming. |
| `OnSetActive` | `override void OnSetActive()` | Wraps base call with `_bIgnorePropertyChange` flag. |
| `SaveButtonPress` | `override void SaveButtonPress()` | Validates, saves model via `SensorModelCollection.SensorModelList.Commit()`, refreshes control. |
| `SaveAndExitButtonPress` | `override void SaveAndExitButtonPress()` | Validates, saves, navigates to previous page. |
---
### ImportSensorsPage
```csharp
public class ImportSensorsPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ImportSensorsPage(DataModel.TabPageItem item)` | Initializes with NAV control enabled (wizard-style), search/select disabled. |
| `UniqueId` | `override string UniqueId => MyId` | Returns `"Hardware_Sensors_ImportSensors"`. |
| `MyId` | `const string MyId = "Hardware_Sensors_ImportSensors"` | Constant unique identifier. |
| `SensorsControl` | `Controls.SensorsDatabaseControl SensorsControl { get; set; }` | Reference to sensors control for lock management. |
| `ImportPreviewOnStartup` | `bool ImportPreviewOnStartup { get; set; }` | When true, skips to preview step on activation if validation passes. |
| `ImportOptions` | `Controls.ImportSensorsOptionsControl.ImportOptions ImportOptions` | Returns `_optionsControl.CurrentOptions`. |
| `Files` | `string[] Files` | Returns `_optionsControl.Files`. |
| `ImportFormat` | `SupportedExportFormats ImportFormat { get; set; }` | Gets/sets format, persists to `Properties.Settings.Default.EditSensorsDefaultImportType`. |
| `MoveToImport` | `void MoveToImport()` | Navigates to import step via dispatcher. |
| `SetFilename` | `void SetFilename(string filename)` | Sets file and format for import, defaults to `TDCSensorDatabase` format. |
| `SetImportAnotherVisible` | `void SetImportAnotherVisible()` | Shows the "Import Another" button. |
| `GoToNextStep` | `void GoToNextStep()` | Advances to next wizard step. |
| `OnSetActive` | `override void OnSetActive()` | Sets current step, handles `ImportPreviewOnStartup` logic. |
| `OnButtonPress` | `override bool OnButtonPress(Controls.PageButton button)` | Handles `Hardware_Sensors_ImportSensors_Page_ImportAnotherButton`. |
**Public enum:** `SupportedExportFormats` with values: `CSV`, `SIF`, `XML`, `EQX`, `TDCSensorDatabase`, `TDMCSVExport`, `CS3`, `DataPROXML`, `MODSensorFile`, `THFDatabaseFile`
**Private enum:** `NavSteps` with values for wizard steps
**Private enum:** `ButtonIds` with value `Hardware_Sensors_ImportSensors_Page_ImportAnotherButton`
---
### HardwareSensorModels
```csharp
public class HardwareSensorModels : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `HardwareSensorModels(DataModel.TabPageItem item)` | Initializes with refresh button enabled, transparent background. |
| `UniqueId` | `override string UniqueId` | Returns `"Hardware_SensorModels"`. |
| `RefreshButtonPressed` | `override void RefreshButtonPressed()` | Reloads all sensor models via `SensorModelCollection.SensorModelList.ReloadAll()`. |
| `DeleteConfirmationWindow` | `void DeleteConfirmationWindow()` | Shows delete confirmation modal via dispatcher. |
| `OnSetActive` | `override void OnSetActive()` | Activates control, updates buttons, publishes `ProgressBarEvent`. |
| `OnButtonPress` | `override bool OnButtonPress(Controls.PageButton button)` | Handles Add, Edit, Delete, and delete confirmation buttons. |
**Private enum:** `ButtonIds` with values: `Hardware_SensorModels_Page_AddButton`, `Hardware_SensorModels_Page_EditButton`, `Hardware_SensorModels_Page_DeleteButton`, `Hardware_SensorModels_Page_ConfirmDelete_YesButton`, `Hardware_SensorModels_Page_ConfirmDelete_NoButton`
---
## 3. Invariants
1. **Page Identification**: Every page must have a unique `UniqueId` property and a corresponding `const string` identifier (e.g., `MY_ID` or `MyId`).
2. **Thread Affinity**: Methods that interact with UI elements (e.g., `Export()`, `Run()`, modal dialogs) must check `Dispatcher.CheckAccess()` and use `Dispatcher.BeginInvoke()` when called from non-UI threads.
3. **Button Handling Chain**: `OnButtonPress` implementations must return `true` if the button was handled, `false` otherwise. Most pages chain to `base.OnButtonPress()` first or last.
4. **Control Lifecycle**: Pages must call their child control's lifecycle methods (`OnSetActive()`, `UnSet()`) when corresponding page lifecycle methods are invoked.
5. **Modification Tracking**: Pages with edit functionality must call `SetModifiedState()` with appropriate `PageHeaderRibbon.ModifyStates` values (`Unmodified`, `Modified`, `Saved`).
6. **Validation Before Save**: Pages that persist data (e.g., `SensorUsageReportPage.Run()`, `ExportSensorsPage.Export()`, `EditSensorModelDetailsPage.SaveButtonPress()`) must call `Validate(ref errors, ref warnings, true)` before proceeding.
7. **Permission Requirements**: Pages with `_requiredPermission` override must enforce the specified permission level (e.g., `Edit` for `HardwareSensorsAndSquibs`, `EditSensorModelDetailsPage`).
8. **Wizard Navigation**: `ImportSensorsPage` requires validation before proceeding from preview step (`RequiresValidationBeforeProceeding = true` on `_previewStep`).
---
## 4. Dependencies
### External Dependencies (Imports)
| Namespace | Purpose |
|-----------|---------|
| `System` | Core .NET types, `Action`, `Func`, `IDisposable` |
| `System.Collections.Generic` | `List<T>`, `IEnumerable<T>` |
| `System.Windows` | WPF core types, `Application`, `DependencyObject`, `Dispatcher` |
| `System.Linq` | LINQ extension methods |
| `System.ComponentModel` | `PropertyChangedEventArgs`, `INotifyPropertyChanged` |
| `DTS.Common.SharedResource.Strings` | Localized string resources (`StringResources`) |
| `DTS.Common.Utilities.Logging` | `APILogger` for logging |
| `DTS.Common.Interface.Channels` | `IGroupChannel` interface |
| `DTS.Common.Interface.Sensors` | `ISensorData` interface |
| `DTS.Common.Events` | Event aggregation support |
| `DTS.SensorDB` | Sensor database types: `SensorData`, `SensorModel`, `SensorsCollection`, `SensorModelCollection`, `SensorCalibrationList` |
| `DTS.Slice.Users.User` | `UserPermissionLevels` enum |
| `Prism.Events` | `IEventAggregator` |
| `Prism.Ioc` | `ContainerLocator` |
| `DataPROWin7.Controls` | Various UI controls |
| `DataPROWin7.Controls.Sensors_and_models` | Sensor-specific controls |
| `DataModel` | `TabPageItem` for page configuration |
### Internal Dependencies (Inferred)
| Page | Depends On (Controls) |
|------|----------------------|
| `DiagnosticsTrackingPage` | `Controls.Sensors_and_models.DiagnosticsTracking` |
| `TestHistoryPage` | `SensorTestHistoryControl` |
| `SensorUsageReportPage` | `Controls.Sensors_and_models.SensorUsageReportControl` |
| `ImportSensorModels` | `Controls.ImportSensorModelsControl` |
| `ExportSensorsPage` | `Controls.Sensors_and_models.ExportSensorsControl` |
| `BulkEditPage` | `Controls.Sensors_and_models.BulkEdit`, `Controls.Sensors_and_models.Classes.SensorAggregate` |
| `MeasureBridgeReadIDPage` | `Controls.MeasureBridgeControl`, `Controls.ModalUserPrompt` |
| `HardwareSensorsAndSquibs` | `SensorsDatabaseControl`, `ImportSensorsPage` |
| `EditSensorModelDetailsPage` | `Controls.ModelDatabaseControl` |
| `ImportSensorsPage` | `Controls.ImportSensorsOptionsControl`, `Controls

View File

@@ -0,0 +1,163 @@
---
source_files:
- DataPRO/DataPRO/Pages/Settings/ExportSettingsPage.cs
- DataPRO/DataPRO/Pages/Settings/ImportSettingsPage.cs
- DataPRO/DataPRO/Pages/Settings/SettingsPage.cs
generated_at: "2026-04-17T15:55:31.847145+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "da2e7d36de0e919b"
---
# Settings Pages Documentation
## 1. Purpose
This module contains three page classes that manage application settings within the DataPRO system:
- **ExportSettingsPage**: Provides a UI for exporting application settings to an external file. Validates settings before export and delegates the actual export operation to `Controls.Settings.ExportSettings`.
- **ImportSettingsPage**: Provides a multi-step wizard UI for importing settings from an external file. Manages navigation through Read File, Edit File, and Summary steps, and coordinates the import process with optional return-to-home behavior upon completion.
- **SettingsPage**: The main administrative settings hub that aggregates multiple settings categories (Realtime, ISO/Channel Code, UI, Test, QA, Power/Battery, User Settings, Software Filters, Sensor Settings, Database, Advanced, Test History). Implements a distributed locking mechanism to prevent concurrent modifications and manages navigation between settings sections.
---
## 2. Public Interface
### ExportSettingsPage
| Member | Signature | Description |
|--------|-----------|-------------|
| `UniqueId` | `public override string UniqueId => MyId` | Returns the constant identifier `"Prepare_Settings_Export"`. |
| `MyId` | `public const string MyId = "Prepare_Settings_Export"` | Constant unique identifier for this page type. |
| Constructor | `public ExportSettingsPage(DataModel.TabPageItem item)` | Initializes the page with an `ExportSettings` control, sets page properties (no search/select/nav controls), and assigns `MainContent`. |
| `OnSetActive` | `public override void OnSetActive()` | Calls base implementation and forwards to `_infoControl.OnSetActive()`. |
| `UnSet` | `public override void UnSet()` | Calls base implementation and forwards to `_infoControl.UnSet()`. |
| `OnButtonPress` | `public override bool OnButtonPress(Controls.PageButton button)` | Handles the export button by validating and calling `_infoControl.Export()` if valid. Returns `true` if handled. |
| `Validate` | `public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Delegates validation to `_infoControl.Validate()` and reports errors if `displayWindow` is true and validation fails. |
### ImportSettingsPage
| Member | Signature | Description |
|--------|-----------|-------------|
| `UniqueId` | `public override string UniqueId => MyId` | Returns the constant identifier `"Prepare_Settings_Import"`. |
| `MyId` | `public const string MyId = "Prepare_Settings_Import"` | Constant unique identifier for this page type. |
| Constructor | `public ImportSettingsPage(TabPageItem item)` | Initializes the page with an `ImportSettings` control, sets up three `NavStep` instances for the wizard, and configures page properties. |
| `StartImport` | `public void StartImport()` | Validates settings and calls `_infoControl.Import()` if valid. Uses dispatcher for thread-safe invocation. |
| `DoneImporting` | `public void DoneImporting()` | Called after import completes. If `_bReturnToHomePage` is true, navigates to the previous page via `MainWindow.GoToPreviousPage()`. |
| `OnButtonPress` | `public override bool OnButtonPress(PageButton button)` | Forwards button press to `_infoControl` and base class. |
| `Validate` | `public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Delegates validation to `_infoControl.Validate()` and reports errors if applicable. |
### SettingsPage
| Member | Signature | Description |
|--------|-----------|-------------|
| `UniqueId` | `public override string UniqueId => MyId` | Returns the constant identifier `"Admin_SystemSettings"`. |
| `MyId` | `public const string MyId = "Admin_SystemSettings"` | Constant unique identifier for this page type. |
| Constructor | `public SettingsPage(DataModel.TabPageItem item)` | Initializes all settings controls, navigation steps, page buttons, and the modal restore confirmation dialog. |
| `GetNavSteps` | `public override IUIItems[] GetNavSteps()` | Returns the array of navigation steps for the settings sections. Lazily initializes on first call. |
| `OnSetActive` | `public override void OnSetActive()` | Subscribes to events, acquires page lock, refreshes settings, builds navigation step list (varies based on `QAMode` and `DBType`), and sets the first visible step. |
| `UnSet` | `public override void UnSet()` | Unsubscribes from events, calls base unset, handles ISO control cleanup, stops the lock update thread, and releases the lock via `LockManager.FreeLock()`. |
| `OnButtonPress` | `public override bool OnButtonPress(Controls.PageButton button)` | Handles button presses for Restore Settings (with confirmation modal), DB Import/Export, and navigation to ImportSettingsPage/ExportSettingsPage. |
| `FormClosing` | `public override void FormClosing(Action OnComplete = null)` | Handles cleanup for ISO and SensorSettings controls before closing. |
| `DoneButtonPress` | `public override void DoneButtonPress()` | Validates sensor settings before allowing done action. |
| `SetPagePermissions` | `protected override void SetPagePermissions()` | Sets permissions on all navigation steps and their associated controls based on current user permissions. |
| `RestoreConfirmationWindow` | `public void RestoreConfirmationWindow()` | Displays the restore confirmation modal dialog. |
---
## 3. Invariants
### ExportSettingsPage
- The `_infoControl` is initialized in the constructor and never reassigned.
- The export button requires `User.UserPermissionLevels.Edit` permission.
- Validation must pass before `Export()` is called.
### ImportSettingsPage
- The `_infoControl` is initialized in the constructor and never reassigned.
- `_bReturnToHomePage` defaults to `false` and is only set to `true` via `SaveAndExitButtonPress()`.
- `StartImport()` and `DoneImporting()` use dispatcher to ensure UI thread execution.
- Validation must pass before `Import()` is called.
### SettingsPage
- The page must acquire a lock via `LockManager.LockItem()` before the user can edit settings.
- The lock is updated every `UPDATE_INTERVAL_SECONDS` (15 seconds) via a background thread.
- If the lock cannot be updated or is stolen, the user is navigated to the home page.
- `_existingLock` must be non-null for the update thread to run.
- `LockUpdateRunning` is a volatile flag coordinating the update thread lifecycle.
- `StopUpdatingEvent` signals the update thread to terminate.
- Navigation steps visibility and enabled state are controlled by user permissions.
- QAMode determines whether QA settings step is included in navigation.
- `DBType == 2` determines whether Database settings step is included.
---
## 4. Dependencies
### Direct Dependencies (Imports)
**ExportSettingsPage:**
- `DTS.Common.SharedResource.Strings` (localized strings via `StringResources`)
- `DataPROPage` (base class, inferred)
- `Controls.Settings.ExportSettings` (settings export control)
- `Controls.PageButton` (button control)
- `DTS.Slice.Users.User.UserPermissionLevels` (permission enumeration)
**ImportSettingsPage:**
- `DTS.Common.SharedResource.Strings`
- `DataPROWin7.Controls` (`PageButton`, `NavStep`)
- `DataPROWin7.Controls.CustomUIElements`
- `DataPROWin7.DataModel` (`TabPageItem`)
- `Prism.Events` (`IEventAggregator`)
- `Controls.Settings.ImportSettings` (settings import control)
**SettingsPage:**
- `DTS.Common.Events` (`AppStatusEvent`, `AppStatusArg`, `PageErrorEvent`, `PageErrorArg`, `LogoutUserEvent`, `LogoutUserArg`, `ProgressBarEvent`, `ProgressBarEventArg`)
- `DTS.Common.Utilities.Logging` (`APILogger`)
- `DTS.Common.Settings` (`SettingsDB`)
- `Prism.Events` (`IEventAggregator`)
- `Prism.Ioc` (`ContainerLocator`)
- `DTS.Slice.Users` (`User.UserPermissionLevels`)
- `DTS.Common.Storage` (inferred for lock management)
- `DTS.Common.Classes.Locking` (`LockManager`, `LockRecord`, `LockError`)
- `DTS.Common.SharedResource.Strings`
- `Controls.Settings.*` (multiple settings controls)
- `Controls.ModalUserPrompt`, `Controls.PageButton`
- `Xceed.Wpf.Toolkit.PropertyGrid` (referenced but not directly used in visible code)
### Inferred Dependencies (What depends on this module)
- `MainWindow` - calls `GoToNewPage()`, `GoToPreviousPage()`, `GoToHomePage()`, `DoModalWindow()`
- `App` - provides `CurrentUser`, `CurrentView`, `DoMessageBox()`
- `DataPROPage` - base class providing page infrastructure
- `PageNavControl` - navigation control with `CurrentNavStep` and `PropertyChanged` events
---
## 5. Gotchas
### Critical Issues
1. **Unimplemented Methods in ImportSettingsPage**: Both `CanNavigateFromEditFile(NavStep)` and `NavControl_PropertyChanged(object, PropertyChangedEventArgs)` throw `NotImplementedException`. Navigation between EditFile step and other steps will crash the application.
2. **Thread Safety in SettingsPage**: The `LockUpdateRunning` flag is volatile but the check-and-act pattern in `UpdateFunc()` and `UnSet()` has potential race conditions. The `LockLock` object is used for some synchronization but not consistently.
3. **Potential Null Reference in CheckLocks()**: The method checks `_existingLock == null` after acquiring `LockLock`, but the error handling path creates a `LockError` that is never used:
```csharp
if (_existingLock == null)
{
APILogger.Log("_existingLock is null");
lockUpdated = false;
var error = new LockError(4, StringResources.SettingPage_UpdateLock); // unused
}
```
4. **Modal Button Field Inconsistency**: `modalConfirmRestoreYesButton` and `modalConfirmRestoreNoButton` are private fields without the conventional underscore prefix used elsewhere in the codebase.
5. **Hardcoded Lock Timeout Logic**: In `LockPageOrCancel()`, the stranded lock timeout uses `Properties.Settings.Default.StrandedLockTimeoutMinutes` but the comparison logic allows lock theft if the timeout has passed OR if the same user/machine holds it—this could allow unintended lock theft in terminal server scenarios.
6. **Event Subscription Lifecycle**: `OnLogoutUserEvent` is a static method that sets `StopUpdatingEvent`, but if multiple `SettingsPage` instances existed (unlikely but possible), this would affect all instances.
7. **ISO Control Special Handling**: The `_iso` control requires explicit `UnSet()` calls in both `UnSet()` and `FormClosing()` with different conditional logic—a potential maintenance burden and source of bugs if one path is missed.
8. **QAMode and DBType Configuration Dependencies**: The navigation step list is dynamically built based on `Properties.Settings.Default.QAMode` and `Properties.Settings.Default.DBType`. Changes to these settings require application restart to take effect on the settings page.

View File

@@ -0,0 +1,212 @@
---
source_files:
- DataPRO/DataPRO/Pages/TestObjects/EditCustomChannelsPage.cs
- DataPRO/DataPRO/Pages/TestObjects/ExportGroupPage.cs
- DataPRO/DataPRO/Pages/TestObjects/ExportTestSetupPage.cs
- DataPRO/DataPRO/Pages/TestObjects/ExportCustomChannelsPage.cs
- DataPRO/DataPRO/Pages/TestObjects/ImportGroupPage.cs
- DataPRO/DataPRO/Pages/TestObjects/ImportCustomChannelsPage.cs
- DataPRO/DataPRO/Pages/TestObjects/RunTestEditSensor.cs
- DataPRO/DataPRO/Pages/TestObjects/CustomChannelsPage.cs
- DataPRO/DataPRO/Pages/TestObjects/ImportTestObjects.cs
generated_at: "2026-04-17T15:46:45.685686+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2ab45c198154fde5"
---
# Documentation: DataPRO Page Modules (TestObjects)
## 1. Purpose
This module contains page classes for the DataPRO application's "Prepare" and "Record" workflows, specifically handling import/export operations for Groups, Test Setups, and Custom Channels, as well as sensor editing during test runs. Each page inherits from `DataPROPage` and follows a consistent pattern of delegating UI rendering to child controls while managing page lifecycle events (activation, validation, button handling, save operations). The `ImportTestObjects` class serves as a utility for constructing and committing group/channel data during import operations.
---
## 2. Public Interface
### EditCustomChannelsPage
```csharp
public EditCustomChannelsPage(DataModel.TabPageItem item)
public override string UniqueId => MyId // "Prepare_CustomChannels_EditCustomChannels"
public const string MyId = "Prepare_CustomChannels_EditCustomChannels"
public bool IsAddPage { get; set; } // Toggles between Add/Edit mode, updates PageName
public override void OnSetActive()
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
```
### ExportGroupPage
```csharp
public ExportGroupPage(DataModel.TabPageItem item)
public override string UniqueId => MyId // "Prepare_Group_Export"
public const string MyId = "Prepare_Group_Export"
public override void OnSetActive()
public override void UnSet()
public override bool OnButtonPress(Controls.PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
```
### ExportTestSetupPage
```csharp
public ExportTestSetupPage(DataModel.TabPageItem item)
public override string UniqueId => MyId // "Prepare_TestSetups_Export"
public const string MyId = "Prepare_TestSetups_Export"
public override void OnSetActive()
public override void UnSet()
public override bool OnButtonPress(Controls.PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
```
### ExportCustomChannelsPage
```csharp
public ExportCustomChannelsPage(DataModel.TabPageItem item)
public override string UniqueId => MyId // "Prepare_CustomChannels_Export"
public const string MyId = "Prepare_CustomChannels_Export"
public override void OnSetActive()
public override void UnSet()
public override bool OnButtonPress(Controls.PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
```
### ImportGroupPage
```csharp
public ImportGroupPage(DataModel.TabPageItem item)
public override string UniqueId => MyId // "Prepare_Group_Import"
public const string MyId = "Prepare_Group_Import"
public override void OnSetActive()
public override void UnSet()
public override bool OnButtonPress(Controls.PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
public void DoneImporting() // Handles post-import navigation if _bReturnToHomePage is true
```
### ImportCustomChannelsPage
```csharp
public ImportCustomChannelsPage(TabPageItem item)
public override string UniqueId => MyId // "Prepare_CustomChannels_Import"
public const string MyId = "Prepare_CustomChannels_Import"
public override void OnSetActive()
public override void UnSet()
public override bool OnButtonPress(Controls.PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
private static void OnCustomChannelImportEvent(CustomChannelImportEventArgs args) // Refreshes data after import
```
### RunTestEditSensor
```csharp
public RunTestEditSensor() // Parameterless constructor
public override string UniqueId => "Record_EditSensor"
public DataModel.TestTemplate CurrentTest { get; set; }
public DTS.SensorDB.SensorData CurrentSensor { set; } // Write-only, sets up calibration and model
public override void OnSetActive()
public override bool OnButtonPress(Controls.PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
public static void SaveSensors(Controls.EditSensorOrTemplateControl ctrl) // Commits sensor data to DB
```
### CustomChannelsPage
```csharp
public CustomChannelsPage(TabPageItem item)
public const string MY_ID = "Prepare_CustomChannels"
public override string UniqueId => MY_ID
public override void RefreshButtonPressed()
public override void OnSetActive()
public override void UnSet()
public override bool OnButtonPress(PageButton button)
public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)
protected override void SetPagePermissions()
protected override void SaveButtonPress()
protected override void SaveAndExitButtonPress()
```
### ImportTestObjects (Utility Class)
```csharp
public void CreateGroup(string serialNumber, string tags)
public void CommitGroups(string[] serialNumbers, Action<string, Color> setStatusAction)
public void AddChannelToGroup(string groupSerialNumber, GroupGRPImportChannel importChannel, IChannelSetting[] channelDefaults)
```
---
## 3. Invariants
### Page Configuration Invariants
- **EditCustomChannelsPage**: `UsesNAVControl = false`, `UsesSearchControl = false`, `HasNextButton = false`, `HasSaveButton = true`, `UsesModifyEnhancements = true`
- **ExportGroupPage/ExportTestSetupPage**: `UsesSearchControl = false`, `UsesSelectControl = false`, `HasNextButton = false`, `UsesNAVControl = false`
- **ExportCustomChannelsPage**: `HasBackButton = true`, all search/select/nav controls disabled
- **ImportGroupPage**: `HasSaveButton = true` (re-asserted in `OnSetActive`)
- **ImportCustomChannelsPage**: `HasBackButton = true`
- **RunTestEditSensor**: `HasBackButton = false`, `HasNextButton = false`, all search/select/nav controls disabled
- **CustomChannelsPage**: `HasRefreshButton = true`, `HasSaveButton = true`, `UsesModifyEnhancements = true`
### Validation Behavior
- **EditCustomChannelsPage**, **ExportCustomChannelsPage**, **ImportCustomChannelsPage**: `Validate()` always returns `true` (no actual validation performed)
- **ExportGroupPage**, **ExportTestSetupPage**, **ImportGroupPage**, **RunTestEditSensor**, **CustomChannelsPage**: Validation delegates to child control's `Validate()` method
### ViewModel Initialization
- **ExportCustomChannelsPage**, **ImportCustomChannelsPage**, **CustomChannelsPage**: ViewModels are lazily initialized via `InitializeVMsIfNeeded()` on first access
### Locking (ImportTestObjects)
- Group commits use an "all or nothing" locking strategy via `LockManager`
- Locks are always released in `finally` block during `CommitGroupsFunc`
---
## 4. Dependencies
### External Dependencies (from imports)
- `DTS.Common.SharedResource.Strings` - Localized string resources
- `DTS.Common.Interface.CustomChannels` - Custom channel interfaces (`ICustomChannelsViewModel`, `ICustomChannelsExportView`, `ICustomChannelsImportView`)
- `DTS.Common.Interface.Channels.ChannelCodes` - `IChannelCodesListViewModel`, `IChannelCodesListView`
- `DTS.Common.Events` / `DTS.Common.Events.GroupTemplates.CustomChannels` - Event aggregation (`PageSelectionChanged`, `CustomChannelImportEvent`, `ProgressBarEvent`, `PageErrorEvent`)
- `Microsoft.Practices.Prism.Events` / `Prism.Events` - `IEventAggregator`
- `Microsoft.Practices.ServiceLocation` / `Prism.Ioc` - Service location
- `Microsoft.Practices.Unity` / `Unity` - Dependency injection (`IUnityContainer`)
- `DTS.SensorDB` - `SensorData`, `SensorCalibration`, `SensorsCollection`
- `DTS.Common.Storage` - `DbOperations`
- `DTS.Common.Classes.Locking` - `LockManager`, `LockRecord`, `LockError`
- `DTS.Common.Enums` - `DigitalInputModes`, `SquibFireMode`
### Internal Dependencies
- `DataPROPage` (base class - not shown but referenced)
- `DataModel.TabPageItem`, `DataModel.TestTemplate`
- `Controls.ExportGroup`, `Controls.ImportGroup`, `Controls.ExportTestSetup`, `Controls.EditSensorOrTemplateControl`, `Controls.PageButton`
- `PageHeaderRibbon.ModifyStates`
- `MainWindow` - for navigation (`GoToPreviousPage()`)
- `App` - for current user, message boxes, ISO database access
---
## 5. Gotchas
### Validation Stub Methods
**EditCustomChannelsPage**, **ExportCustomChannelsPage**, and **ImportCustomChannelsPage** have `Validate()` methods that unconditionally return `true`. This may indicate incomplete implementation or validation handled elsewhere.
### Duplicate Code Comment
In `RunTestEditSensor.SaveSensors()`, there is a comment: `/// To be deleted later - duplicate code from SensorsDatabaseControl`. This indicates known technical debt.
### Commented-Out Code in ImportGroupPage.Save()
```csharp
//_infoControl.RemoveNonIncludedTestSetups();
//_infoControl.ModifyTestSetupsIfNeeded();
//_infoControl.CheckOverwriteAndThenImport();
```
These lines are commented out, suggesting changed requirements or incomplete refactoring.
### Thread Affinity in ImportGroupPage.DoneImporting()
The method explicitly checks `Dispatcher.CheckAccess()` and uses `BeginInvoke` to marshal calls to the UI thread. This indicates the method may be called from background threads.
### ISO Code Handling in ImportTestObjects.AddChannelToGroup()
There is special handling for 14-character ISO codes (inserting "??" prefix), referencing a FogBugz case (15621). This is a historical workaround that may need documentation for future maintainers.
### Inconsistent Constructor Signatures
- Most pages take `DataModel.TabPageItem item` as constructor parameter
- `RunTestEditSensor` has a parameterless constructor
- `ImportCustomChannelsPage` and `CustomChannelsPage` take `TabPageItem item` (without `DataModel.` prefix)
### Button Handling Pattern Inconsistency
- **ExportGroupPage/ExportTestSetupPage**: Call `base.OnButtonPress(button)` after `_infoControl.OnButtonPress(button)` returns true
- **ExportCustomChannelsPage/ImportCustomChannelsPage**: Return `false` directly if button ID doesn't match, never call `base.OnButtonPress()` in the success path
### Static Event Handler in ImportCustomChannelsPage
`OnCustomChannelImportEvent` is static and accesses `Application.Current` and `CustomChannelList.List`. This could cause issues if multiple instances exist or during testing.

View File

@@ -0,0 +1,262 @@
---
source_files:
- DataPRO/DataPRO/Pages/TestSetups And RunTest/RunTestPageCheckHardware.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/RunTestPageDiagnostics.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/RunTestPageRealtime.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/RunTestPage.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/RunTestPageExport.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/DiagnosticsPage.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/RunTestPageStatusCheck.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/CollectDataPage.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/TestSetupsChangePage.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/QuickSensorCheckPage.cs
- DataPRO/DataPRO/Pages/TestSetups And RunTest/TestSetupEditAddHardwarePage.cs
generated_at: "2026-04-17T15:47:07.283406+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "07eaa0ac5878fa50"
---
# Documentation: Test Setups and RunTest Pages
## 1. Purpose
This module contains the page classes for the test execution workflow in DataPRO, a WPF-based data acquisition and testing application. These pages handle the complete test lifecycle: test setup selection, hardware configuration and verification, diagnostics execution, real-time data collection, and data export. The module follows a wizard-style navigation pattern where each page represents a distinct step in the test process, inheriting from either `RunTestBase` or `DataPROPage` base classes to provide consistent navigation, state management, and UI framework integration.
---
## 2. Public Interface
### RunTestPageCheckHardware
```csharp
public class RunTestPageCheckHardware : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RunTestPageCheckHardware(DataModel.TabPageItem item)` | Initializes with tab page item only. |
| Constructor | `RunTestPageCheckHardware(DataModel.TabPageItem item, int possibleSteps)` | Initializes with tab page item and step count; stores `_item` field. |
| OnSetActive | `public override void OnSetActive()` | Calls base, sets `PageName` to `_item.Title`. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Diagnostics_CheckHardware"` | Constant identifier for this page. |
---
### RunTestPageDiagnostics
```csharp
public class RunTestPageDiagnostics : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RunTestPageDiagnostics(DataModel.TabPageItem item)` | Initializes with tab page item only. |
| Constructor | `RunTestPageDiagnostics(DataModel.TabPageItem item, int possibleSteps)` | Initializes with tab page item and step count; stores `_item` field. |
| OnSetActive | `public override void OnSetActive()` | Calls `((App)Application.Current).StartTest()`, then base, then sets `PageName`. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Diagnostics"` | Constant identifier for this page. |
---
### RunTestPageRealtime
```csharp
public class RunTestPageRealtime : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RunTestPageRealtime(DataModel.TabPageItem item)` | Initializes with tab page item only. |
| Constructor | `RunTestPageRealtime(DataModel.TabPageItem item, int possibleSteps)` | Initializes with tab page item and step count; stores `_item` field. |
| QuickCheckout | `public bool QuickCheckout { get; set; } = false` | Property controlling strictness level. |
| OnSetActive | `public override void OnSetActive()` | Subscribes to `AutomaticModeStatusEvent` if not already subscribed, calls base, starts test, sets `PageName`. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Diagnostics_Realtime"` | Constant identifier for this page. |
| PageStricknessLevel | `protected override StrictLevel PageStricknessLevel` | Returns `StrictLevel.QuickCheckout` if `QuickCheckout` is true, otherwise `StrictLevel.Strict`. |
---
### RunTestPage
```csharp
public class RunTestPage : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RunTestPage(DataModel.TabPageItem item)` | Initializes with `HasBackButton = false`. |
| Constructor | `RunTestPage(DataModel.TabPageItem item, int possibleSteps)` | Initializes with step count and `HasBackButton = false`. |
| OnSetActive | `public override void OnSetActive()` | Subscribes to `AutomaticModeStatusEvent` if not already subscribed, calls base. |
| StopDiagnosticsPrepareOnEntry | `public bool StopDiagnosticsPrepareOnEntry { get; set; } = false` | Used by TTS import to prevent diagnostics from running on entry. |
| UniqueId | `public override string UniqueId` | Returns `"Record"`. |
---
### RunTestPageExport
```csharp
public class RunTestPageExport : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RunTestPageExport(DataModel.TabPageItem item)` | Initializes with tab page item only. |
| Constructor | `RunTestPageExport(DataModel.TabPageItem item, int possibleSteps)` | Initializes with tab page item and step count; stores `_item` field. |
| OnSetActive | `public override void OnSetActive()` | Calls base, sets `PageName` to `_item.Title`. |
| UnSet | `public override void UnSet()` | Releases files on export controls, resets export step completion, clears `DTSFile`. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Review_ExportData"` | Constant identifier for this page. |
| DownloadFolder | `public string DownloadFolder { get; set; } = string.Empty` | Download folder path. |
| DTSFile | `public string DTSFile { get; set; } = string.Empty` | Path to selected test DTS file. |
| SelectedEventList | `public BindingList<DTS.Common.Interface.ITestEvent> SelectedEventList { get; set; }` | Events selected for export. |
| ResetCurrentStep | `public void ResetCurrentStep()` | Sets navigation step index to 0. |
| ShowUploadStep | `public void ShowUploadStep(bool bShow)` | Shows or hides the upload navigation step. |
| DoneButtonPress2 | `public override bool DoneButtonPress2(DataPROPage nextPage, HomePage homePage, DataPROTabItem nextTab)` | Returns `true`. |
---
### DiagnosticsPage
```csharp
public class DiagnosticsPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `DiagnosticsPage(DataModel.TabPageItem item)` | Initializes `TestSetupsControl`, sets up event handlers, configures page properties. |
| OnSetActive | `public override void OnSetActive()` | Calls base, then `SetRunButtonEnabled()`. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Diagnostics"` | Constant identifier for this page. |
| OnButtonPress | `public override bool OnButtonPress(Controls.PageButton button)` | Handles `Record_DiagnosticsRunButton` by calling `SetNewTest()`. |
---
### RunTestPageStatusCheck
```csharp
public class RunTestPageStatusCheck : RunTestBase
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `RunTestPageStatusCheck(DataModel.TabPageItem item)` | Initializes with tab page item only. |
| Constructor | `RunTestPageStatusCheck(DataModel.TabPageItem item, int possibleSteps)` | Initializes with tab page item and step count; stores `_item` field. |
| OnSetActive | `public override void OnSetActive()` | Complex logic: resets navigation if not on Hardware step, subscribes to `AutomaticModeStatusEvent`, modifies `AllowedSteps` based on settings, calls base, starts test. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Diagnostics_StatusLineCheck"` | Constant identifier for this page. |
---
### CollectDataPage
```csharp
public class CollectDataPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `CollectDataPage()` | Parameterless constructor calling `Initialize()`. |
| Constructor | `CollectDataPage(DataModel.TabPageItem item)` | Constructor with tab page item. |
| OnSetActive | `public override void OnSetActive()` | Calls base, then `SetRunButtonEnabled()`. |
| UniqueId | `public override string UniqueId` | Returns `"CollectData"`. |
| OnButtonPress | `public override bool OnButtonPress(Controls.PageButton button)` | Handles `Record_CollectDataRunButton` by calling `SetNewTest()`. |
---
### TestSetupsChangePage
```csharp
public class TestSetupsChangePage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `TestSetupsChangePage(DataModel.TabPageItem tabPageItem)` | Initializes with test setups control, sets page name and image. |
| OnSetActive | `public override void OnSetActive()` | Calls base, `SetPagePermissions()`, `ChangeEditVisibility()`. |
| UniqueId | `public override string UniqueId` | Returns `"Prepare_ChangeTestSetups"`. |
| OnButtonPress | `public override bool OnButtonPress(Controls.PageButton button)` | Handles `Prepare_TestSetups_Page_MakeCurrentButton` by calling `SetNewTest()`. |
---
### QuickSensorCheckPage
```csharp
public class QuickSensorCheckPage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `QuickSensorCheckPage(DataModel.TabPageItem item)` | Configures page with no search/select controls, no next button, no NAV control. |
| OnSetActive | `public override void OnSetActive()` | Initializes `_quickSensorCheck` if null, calls base, starts test. |
| UnSet | `public override void UnSet()` | Calls `((App)Application.Current).EndTest()`, then base. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| MY_ID | `public const string MY_ID = "Diagnostics_QuickSensorCheck"` | Constant identifier for this page. |
| ScanButtonEnabled | `public bool ScanButtonEnabled { get; set; }` | Gets/sets scan button enabled state. |
| RunButtonEnabled | `public bool RunButtonEnabled { get; set; }` | Gets/sets run/check button enabled state. |
| OnButtonPress | `public override bool OnButtonPress(PageButton button)` | Handles `Diagnostics_QuickSensorCheck_Page_CheckButton`, `Diagnostics_QuickSensorCheck_Page_RunButton`, `Diagnostics_QuickSensorCheck_Page_ScanButton`. |
| DoneButtonPress2 | `public override bool DoneButtonPress2(DataPROPage nextPage, HomePage homePage, DataPROTabItem nextTab)` | Calls `_quickSensorCheck.DoneButtonPress()`, returns `true`. |
---
### TestSetupEditAddHardwarePage
```csharp
public class TestSetupEditAddHardwarePage : DataPROPage
```
| Member | Signature | Description |
|--------|-----------|-------------|
| TestTemplate | `public DataModel.TestTemplate TestTemplate { get; set; }` | Gets/sets test template; updates `_vm.TestId` when set. |
| Constructor | `TestSetupEditAddHardwarePage(DataModel.TabPageItem item)` | Configures page with save button, modify enhancements, tile color. |
| UniqueId | `public override string UniqueId` | Returns `MY_ID`. |
| OnSetActive | `public override void OnSetActive()` | Subscribes to events, initializes VM, sets modification state. |
| UnSet | `public override void UnSet()` | Unsubscribes from events, calls base. |
| SetHardware | `public void SetHardware(IDASHardware hw, IISOHardware isoHW)` | Initializes hardware in the viewer, sets `IsAdd` flag and `PageName`. |
| OnButtonPress | `public override bool OnButtonPress(PageButton button)` | Handles `AddNewDevice` button. |
| Validate | `public override bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)` | Validates hardware configuration. |
| ReportErrors | `public override void ReportErrors(List<string> errors)` | Shows message box with errors. |
| DoneButtonPress | `public override void DoneButtonPress()` | Handles modification state propagation to referring page. |
---
## 3. Invariants
1. **Unique ID Consistency**: Each page class defines a `MY_ID` constant and returns it via the `UniqueId` property override. This ID must be unique across all pages.
2. **Event Subscription Guard**: Pages that subscribe to `AutomaticModeStatusEvent` (`RunTestPageRealtime`, `RunTestPage`, `RunTestPageStatusCheck`) use a `_subscribed` boolean flag to prevent duplicate subscriptions.
3. **Base Call Ordering**:
- `OnSetActive()` implementations must call `base.OnSetActive()` at appropriate points (typically after page-specific setup).
- `UnSet()` implementations must call `base.UnSet()` after cleanup.
4. **Test Lifecycle**: Pages that start tests via `((App)Application.Current).StartTest()` should ensure proper test termination. `QuickSensorCheckPage.UnSet()` explicitly calls `EndTest()`.
5. **Hardware Page State**: `TestSetupEditAddHardwarePage` tracks `_entryState` and `_bModificationsWereMade` to properly propagate modification state to the referring page.
6. **Navigation Step Management**: `RunTestPageStatusCheck.OnSetActive()` enforces that if the current step is not `PossibleSteps.Hardware`, navigation resets to the first step in `navStepList`.
7. **AllowedSteps Bitwise Operations**: `RunTestPageStatusCheck` uses bitwise operations to modify `AllowedSteps`, requiring that `AllowedSteps` be treated as a flags enum bitmask.
---
## 4. Dependencies
### External Dependencies (from imports)
- **Prism.Ioc** - `ContainerLocator`, `IEventAggregator` for dependency resolution and event aggregation
- **Prism.Events** - Event subscription patterns
- **DTS.Common.Events** - `AutomaticModeStatusEvent`, `HardwareSavedEvent`
- **DTS.Common.Enums** - `RecordingModes`, hardware/sensor enums
- **DTS.Common.Interface** - `IDASHardware`, `IISOHardware`, `ITestEvent`, `IAddEditHardwareViewModel`, `IAddEditHardwareView`
- **DTS.Slice.Users** - `User.UserPermissionLevels` for permission checks
- **Unity** - `IUnityContainer` for DI in `TestSetupEditAddHardwarePage`
### Internal Dependencies
- **DataModel.TabPageItem** - Constructor parameter for all pages
- **DataModel.TestTemplate** - Used by `TestSetupEditAddHardwarePage`
- **Controls.TestSetupsControl** - Used by `DiagnosticsPage`, `CollectDataPage`, `TestSetupsChangePage`
- **Controls.QuickSensorCheck** - Used by `QuickSensorCheckPage`
- **BrushesAndColors** - Color constants for UI theming
- **Common.SerializedSettings** - Configuration settings for behavior toggles
- **CommonFunctions** - Helper methods for channel creation
### Downstream Dependencies (Inferred)
- **RunTestBase** - Base class for `RunTestPage*` classes
- **DataPROPage** - Base class for standalone pages
- **App** - Application singleton accessed via `Application.Current`
- **MainWindow** - Main window accessed for navigation and test setup changes
---
## 5. Gotchas
1. **Duplicate Constructor Pattern**: Multiple classes define two constructors where the simpler constructor does NOT initialize the `_item` field, but the constructor with `possibleSteps` does. This means

View File

@@ -0,0 +1,57 @@
---
source_files:
- DataPRO/DataPRO/Properties/AssemblyInfo.cs
- DataPRO/DataPRO/Properties/Resources.Designer.cs
generated_at: "2026-04-17T16:22:17.009458+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "218b8182eb0f50af"
---
# Documentation: DataPRO Assembly Properties
## 1. Purpose
This module contains assembly-level metadata and strongly-typed resource access for the DataPRO WPF application, which is software for DTS data recorders developed by Diversified Technical Systems, Inc. The `AssemblyInfo.cs` file defines assembly identity, versioning, COM visibility, DPI awareness settings, and WPF theme configuration, while `Resources.Designer.cs` provides auto-generated, strongly-typed access to localized string resources used throughout the application for UI elements such as window titles, version formatting, and edition labels.
---
## 2. Public Interface
### Assembly Attributes (AssemblyInfo.cs)
| Attribute | Value |
|-----------|-------|
| `AssemblyTitle` | `"DataPRO"` |
| `AssemblyDescription` | `"DataPRO software for DTS data recorders"` |
| `AssemblyCompany` | `"Diversified Technical Systems, Inc."` |
| `AssemblyProduct` | `"DataPRO"` |
| `AssemblyCopyright` | `"© 2023"` |
| `AssemblyVersion` | `"1.0.0.0"` |
| `AssemblyFileVersion` | `"1.0.0.0"` |
| `ComVisible` | `false` |
| `DisableDpiAwareness` | Applied (no parameters) |
### Resources Class (Resources.Designer.cs)
**Namespace:** `DataPROWin7.Properties`
**Class:** `internal class Resources`
| Member | Signature | Description |
|--------|-----------|-------------|
| `ResourceManager` | `internal static global::System.Resources.ResourceManager ResourceManager { get; }` | Returns cached ResourceManager instance, initialized with resource base name `"DataPROWin7.Properties.Resources"` |
| `Culture` | `internal static global::System.Globalization.CultureInfo Culture { get; set; }` | Gets or sets the current thread's CurrentUICulture for resource lookups |
| `DataPRO_BuildVersionPostamble` | `internal static string DataPRO_BuildVersionPostamble { get; }` | Looks up localized string (empty string per comment) |
| `DataPRO_BuildVersionPreamble` | `internal static string DataPRO_BuildVersionPreamble { get; }` | Looks up localized string similar to `"v"` |
| `DataPRO_Edition` | `internal static string DataPRO_Edition { get; }` | Looks up localized string similar to `"Edition"` |
| `DataPRO_MainFormTitle` | `internal static string DataPRO_MainFormTitle { get; }` | Looks up localized string similar to `"DataPRO"` |
---
## 3. Invariants
- **Version Consistency:** Both `AssemblyVersion` and `AssemblyFileVersion` are set to `"1.0.0.0"` and should be updated together for releases.
- **COM Visibility:** All types in this assembly are not visible to COM components (`ComVisible(false)`).
- **DPI Awareness:** The application is explicitly non-DPI-aware via `DisableDpiAwareness` attribute; this affects rendering on high-DPI displays.
- **Resource Manager Initialization:** The `ResourceManager` property uses lazy initialization with a null check pattern.

View File

@@ -0,0 +1,42 @@
---
source_files:
- DataPRO/DataPRO/RegionAdapters/StackPanelRegionAdapter.cs
generated_at: "2026-04-17T16:29:20.553191+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0b1fef2bce493cf0"
---
# RegionAdapters
### Purpose
This module provides a Prism region adapter for `StackPanel` controls, enabling the Prism region navigation framework to manage child elements within a `StackPanel`. It bridges the gap between Prism's region management system and WPF's `StackPanel` by synchronizing the region's views collection with the panel's visual children.
### Public Interface
**`StackPanelRegionAdapter`** (class, inherits `RegionAdapterBase<StackPanel>`)
- `StackPanelRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)` - Constructor accepting the region behavior factory required by the base class.
- `protected override void Adapt(IRegion region, StackPanel regionTarget)` - Subscribes to the region's `Views.CollectionChanged` event and synchronizes additions and removals with the `StackPanel.Children` collection. Handles `NotifyCollectionChangedAction.Add` and `NotifyCollectionChangedAction.Remove` actions; other actions are ignored.
- `protected override IRegion CreateRegion()` - Returns a new `AllActiveRegion` instance, indicating all views in this region are considered active.
### Invariants
- The `region` parameter in `Adapt()` may be null; the method returns early without side effects in this case.
- Only `Add` and `Remove` collection change actions are handled; `Replace`, `Reset`, and `Move` actions are silently ignored.
- When removing elements, the adapter checks `regionTarget.Children.Contains(element)` before attempting removal to avoid exceptions.
- The region is always created as `AllActiveRegion`, meaning all views are active simultaneously (no deactivation semantics).
### Dependencies
**Depends on:**
- `System.Collections.Specialized` (for `NotifyCollectionChangedAction`)
- `System.Windows` (for `UIElement`)
- `System.Windows.Controls` (for `StackPanel`)
- `Prism.Regions` (for `RegionAdapterBase<T>`, `IRegion`, `IRegionBehaviorFactory`, `AllActiveRegion`)
**Depended on by:** Not determinable from source alone (likely registered in application bootstrapping or module initialization).
### Gotchas
- The `Remove` case uses a local variable `element` assigned from `elementLoopVariable` in the foreach loop—this appears to be a vestigial pattern (possibly from a VB.NET conversion or older C# version) and is unnecessary in modern C# where foreach loop variables are already scoped per iteration.
- No handling for `Reset` or `Replace` actions means bulk collection changes may not properly synchronize the UI.
- The null check for `region` at the start of `Adapt()` is inconsistent with typical Prism adapter patterns where a null region would indicate a framework error.
---

View File

@@ -0,0 +1,29 @@
---
source_files:
- DataPRO/DataPRO/ReviewDataSubControls/ReviewTest.cs
generated_at: "2026-04-17T16:46:03.949062+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f3f5bffa76bc7fb2"
---
# Documentation: ReviewTest.cs
## 1. Purpose
This module provides data structures for representing and managing test review entities within the DTS.Slice namespace. The `ReviewTest` class models a test directory with associated metadata (creation time, channels, events), while `ReviewTestChannel` represents individual data channels within a test. These classes support lazy loading of test data, comparison/sorting by creation time, and resource cleanup for large persistent data structures. The module serves as a bridge between serialized test data on disk and the UI layer (DataPROPage).
---
## 2. Public Interface
### `ReviewTest` Class
**Implements:** `IComparable<ReviewTest>`, `IDisposable`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `ReviewTest(string testDirectory, DataPROWin7.DataPROPage page)` | Initializes a new instance with the specified test directory path and page reference for error reporting. Captures file creation time immediately. |
| `TestDirectory` | `string` (readonly property) | The full path to the test directory. |
| `TestName` | `string` (readonly property) | The name of the test, derived from the directory name. |
| `CreationTime

View File

@@ -0,0 +1,57 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/TSRAIRGoDashboard.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/TSRAIRGoMainWindow.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/TSRAIRGoNavigation.xaml.cs
generated_at: "2026-04-17T16:44:25.012108+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "0f72269943daef77"
---
# TSRAIRGo Module Documentation
## 1. Purpose
The TSRAIRGo module provides a navigation-based dashboard interface within the DataPRO WPF application. It implements a master-detail style layout where `TSRAIRGoMainWindow` serves as the shell container, `TSRAIRGoNavigation` provides navigation controls, and `TSRAIRGoDashboard` serves as the default content view. The module uses the Prism event aggregation pattern for decoupled navigation between views.
---
## 2. Public Interface
### TSRAIRGoDashboard (class)
**Namespace:** `DataPROWin7.TSRAIRGo`
**Inheritance:** `UserControl`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TSRAIRGoDashboard()` | Initializes the control via `InitializeComponent()`. No additional logic. |
---
### TSRAIRGoMainWindow (class)
**Namespace:** `DataPROWin7.TSRAIRGo`
**Inheritance:** `UserControl`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TSRAIRGoMainWindow()` | Initializes components, wires `navigationControl.ContentControl` to `contentControl`, instantiates `_tSRAIRGoDashboard`, sets initial content, and subscribes to `GotoTSRAIRGoDashboardEvent`. |
| SetContent | `public void SetContent(object content)` | Assigns the provided object to `contentControl.Content`, updating the displayed view. |
**Private Fields:**
- `IEventAggregator _eventAggregator` — Prism event aggregator for pub/sub messaging.
- `TSRAIRGoDashboard _tSRAIRGoDashboard` — Cached dashboard instance reused on navigation.
**Private Methods:**
- `void OnNavigateToDashbaord(GotoTSRAIRGoDashboardArg arg)` — Event handler that calls `SetContent(_tSRAIRGoDashboard)`.
---
### TSRAIRGoNavigation (class)
**Namespace:** `DataPROWin7.TSRAIRGo`
**Inheritance:** `UserControl`
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public TSRAIRGoNavigation()` | Initializes components, resolves `_eventAggregator` via ServiceLocator, and populates `TabPageItems` from "AllGroups" configuration. |
| ContentControl | `public Content

View File

@@ -0,0 +1,41 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/Classes/ViewHelper.cs
- DataPRO/DataPRO/TSRAIRGo/Classes/ClockSyncReboot.cs
generated_at: "2026-04-17T15:56:33.412333+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c71fc38e98382edf"
---
# Documentation: TSRAIRGo Classes
## 1. Purpose
This module provides utility classes for the TSR AIR Go application within DataPRO. `ViewHelper` offers WPF text input validation for numeric-only fields. `ClockSyncReboot` manages clock synchronization configuration and conditional rebooting of DAS (Data Acquisition System) units, coordinating asynchronous service calls to query, configure, and restart hardware devices based on test template requirements.
---
## 2. Public Interface
### ViewHelper (static class)
| Method | Signature | Description |
|--------|-----------|-------------|
| `ValidateFloatOnlyTextBox` | `void ValidateFloatOnlyTextBox(TextCompositionEventArgs e)` | Validates text input to allow only numeric characters (0-9) and decimal point (.). Sets `e.Handled = true` if input matches the regex `[^0-9.]+`. |
| `ValidateIntegerOnlyTextBox` | `void ValidateIntegerOnlyTextBox(TextCompositionEventArgs e)` | Validates text input to allow only numeric characters (0-9). Sets `e.Handled = true` if input matches the regex `[^0-9]+`. |
### ClockSyncReboot (static class)
**Delegates:**
| Delegate | Signature | Description |
|----------|-----------|-------------|
| `SendUnitStatusDelegate` | `void SendUnitStatusDelegate(IDASCommunication das, string message)` | Callback to notify unit status changes. |
| `AlertErrorDelegate` | `void AlertErrorDelegate(IDASCommunication das, string message)` | Callback to notify error conditions. The `das` parameter may be `null`. |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `RebootIfNeeded` | `bool RebootIfNeeded(List

View File

@@ -0,0 +1,56 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/Command/HelpButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/ViewDataButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/TriggerButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/DownloadButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/TestIdButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/ArmDisarmButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/DashboardButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/ExportDataButton.cs
- DataPRO/DataPRO/TSRAIRGo/Command/BaseNavigationButtonInfo.cs
generated_at: "2026-04-17T16:11:25.804843+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f6db5739a7754338"
---
# Command
**Purpose:**
This module defines the command pattern implementation for navigation buttons within the TSRAIRGo subsystem. It provides a set of concrete button classes (e.g., `DashboardButton`, `TriggerButton`) and a base class that handles property change notification, allowing the UI to bind to and control navigation elements dynamically.
**Public Interface:**
* `BaseNavigationButtonInfo` (Class)
* Inherits from: `DTS.Common.Base.BasePropertyChanged`
* `string Text`: Gets or sets the button text; raises `OnPropertyChanged`.
* `string Tooltip`: Gets or sets the tooltip text; raises `OnPropertyChanged`.
* `bool Enabled`: Gets or sets the enabled state (defaults to `true`); raises `OnPropertyChanged`.
* `bool ShowBorder`: Gets or sets the border visibility state (defaults to `false`); raises `OnPropertyChanged`.
* **Concrete Button Classes** (All inherit `BaseNavigationButtonInfo` and implement `INavigationButtonInfo`):
* `HelpButton`: `Id` returns `NavigationButtonId.Dashboard`.
* `ViewDataButton`: `Id` returns `NavigationButtonId.ViewData`.
* `TriggerButton`: `Id` returns `NavigationButtonId.Trigger`.
* `DownloadButton`: `Id` returns `NavigationButtonId.Download`.
* `TestIdButton`: `Id` returns `NavigationButtonId.TestId`.
* `ArmDisarmButton`: `Id` returns `NavigationButtonId.ArmDisarm`.
* `DashboardButton`: `Id` returns `NavigationButtonId.Dashboard`.
* `ExportDataButton`: `Id` returns `NavigationButtonId.ExportData`.
**Invariants:**
* All concrete button classes must implement `INavigationButtonInfo`.
* All concrete button classes rely on `BaseNavigationButtonInfo` for property notification.
* `Enabled` is `true` by default; `ShowBorder` is `false` by default.
**Dependencies:**
* **Depends on:**
* `DTS.Common.Interface.TSRAIRGo` (for `INavigationButtonInfo`)
* `DTS.Common.Enums.TSRAIRGo` (for `NavigationButtonId`)
* `DTS.Common.Base` (implied for `BasePropertyChanged`)
* **Depended on by:** TSRAIRGo UI components/ViewModels requiring navigation buttons.
**Gotchas:**
* **Duplicate ID:** `HelpButton` and `DashboardButton` both return `NavigationButtonId.Dashboard`. This may be a bug or intentional aliasing, but it makes distinguishing these buttons via their ID alone impossible.
* **Namespace Mismatch:** The files are located in `DataPRO/DataPRO/TSRAIRGo/Command`, but the namespace is declared as `DataPROWin7.TSRAIRGo.Command`. This inconsistency could be historical (legacy "Win7" naming) or a project structure quirk.

View File

@@ -0,0 +1,71 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/DataProvider/TabPageItemsProvider.cs
- DataPRO/DataPRO/TSRAIRGo/DataProvider/DASModelProvider.cs
generated_at: "2026-04-17T15:57:06.442518+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "70c75469b013dbda"
---
# Documentation: DataProvider Module (TSRAIRGo)
## 1. Purpose
This module provides data access and management for DAS (Data Acquisition System) hardware devices within the TSRAIRGo subsystem. It handles device discovery via UDP multicast, connection management, status tracking, and synchronization between the UI collection (`DASSource`) and the underlying `DASFactory`. The module also includes a simple provider (`TabPageItemsProvider`) for retrieving tab page items from the application's navigation structure.
---
## 2. Public Interface
### ITabPageItemsProvider / TabPageItemsProvider
| Member | Signature | Description |
|--------|-----------|-------------|
| `GetGroupContents` | `List<TabPageItem> GetGroupContents()` | Retrieves all `TabPageItem` objects from all groups whose `Content` is of type `DataPROPage`. Calls `SetContent()` on items with null content before filtering. |
### IDASModelProvider / DASModelProvider
| Member | Signature | Description |
|--------|-----------|-------------|
| `DASSource` | `ObservableCollection<DASModel> DASSource { get; }` | Thread-safe singleton collection of all discovered/added DAS devices. Changes trigger `DASListChangedEvent`. |
| `DefaultSampleRate` | `int DefaultSampleRate { get; set; }` | Default sample rate applied to newly created `DASModel` instances. |
| `DefaultDuration` | `double DefaultDuration { get; set; }` | Default duration applied to newly created `DASModel` instances. |
| `DefaultLevelTrigger` | `LevelTriggerArg DefaultLevelTrigger { get; set; }` | Default level trigger configuration (text and axis flags) for new DAS models. Initialized with `"0.00"` and all axes disabled. |
| `WaitTillScanningDone` | `void WaitTillScanningDone()` | Blocks until the current UDP discovery scan completes or times out (10 seconds). Logs a warning if timeout occurs. |
---
## 3. Invariants
### DASModelProvider
- **Singleton Collection**: `_dasSource` is a static field initialized once under lock; subsequent accesses return the same instance.
- **Thread Safety**: Access to `_dasSource` initialization is protected by `MyLock`.
- **Timer Inactive at Start**: The `_timer` is initialized with `-1` (disabled) as the due time; it only activates when scanning starts.
- **Status Timeout**: A DAS with status `ONLINE` that hasn't been seen for more than `MAX_TIME_BETWEEN_SEEN_SECONDS` (20 seconds) is marked `OFFLINE`.
- **TCP Connection Priority**: If a DAS has an active TCP connection (`IDAS` is not null and `Connected`), the UDP-based last-seen check is skipped.
- **Duplicate Prevention**: `AddDAS` will not add a device if its `SerialNumber` or `IPAddress` already exists in `DASSource`.
- **Cancellation Token Reset**: When restarting a scan after cancellation, a new `CancellationTokenSource` is created (tokens cannot be "reset").
- **UI Thread Requirement**: `DASFactory_DiscoveredDAS` marshals execution to the UI thread via `Dispatcher.BeginInvoke` if not already on it.
### TabPageItemsProvider
- **Content Initialization**: Items with null `Content` will have `SetContent()` called before the type check.
---
## 4. Dependencies
### Imports (What this module depends on)
**TabPageItemsProvider:**
- `DataPROWin7.DataModel``TabPageItem`, `TabPageSource`, `DataPROPage`
**DASModelProvider:**
- `DataPROWin7.DataModel``DASHardware`, `DASHardwareList`
- `DataPROWin7.TSRAIRGo.Model``DASModel`, `TSRAIRGoStatus`
- `DTS.Common.Enums.DASFactory``DFConstantsAndEnums`, `MultiCastDeviceClasses`
- `DTS.Common.Enums.Hardware``HardwareTypes`
- `DTS.Common.Events.TSRAIRGo``StartStopDASScanEvent`, `RemoveDASEvent`, `AddDASEvent`, `NavigateToDashboardEvent`, `IpAddressToPingEvent`, `DASListChangedEvent`
- `DTS.Common.Events``AppStatusEvent`, `PageErrorEvent`
- `DTS.Common.Interface.DASFactory``IDiscoveredDevice`, `ICommunication`
-

View File

@@ -0,0 +1,27 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/Interface/ISystemSettings.cs
- DataPRO/DataPRO/TSRAIRGo/Interface/IDASModel.cs
generated_at: "2026-04-17T16:44:53.015999+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "649ba9bd91d917f1"
---
# Documentation: TSRAIRGo Interfaces
## 1. Purpose
This module defines the core interfaces for the TSRAIRGo data acquisition system (DAS) within DataPRO. It provides abstractions for system-wide recording configuration (`ISystemSettings`) and individual device management (`IDASModel`, `IDASVoltage`, `IDASProgress`, `IDASLevelTrigger`, `IDevicePresence`). These interfaces enable decoupled communication between the UI layer and the underlying DAS hardware controllers, supporting test setup configuration, device status monitoring, voltage tracking, level triggering, and device presence detection.
---
## 2. Public Interface
### ISystemSettings
**Properties:**
| Name | Type | Access | Description |
|------|------|--------|-------------|
| `RecordingMode`

View File

@@ -0,0 +1,269 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/Model/VoltageStatus.cs
- DataPRO/DataPRO/TSRAIRGo/Model/DASModel.cs
generated_at: "2026-04-17T15:57:42.866922+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2c97fd244b272fe1"
---
# Documentation: TSRAIRGo Model Classes
## 1. Purpose
**VoltageStatus** is a simple data transfer object that represents the power status of a DAS device, encapsulating both primary power and backup battery status strings along with their associated display colors.
**DASModel** is the primary model class for managing Data Acquisition System (DAS) hardware within the TSRAIRGo subsystem. It serves as the bridge between the UI layer and hardware abstraction, handling device discovery (ping/connect/query), status tracking, battery state-of-charge calculations, recording time estimation, sample rate management, level trigger configuration, and event counting. It implements multiple interfaces (`IDASModel`, `IDevicePresence`, `IDASVoltage`, `IDASProgress`, `IDASLevelTrigger`, `IComparable<DASModel>`) to provide a comprehensive hardware management facade.
---
## 2. Public Interface
### VoltageStatus Class
```csharp
public class VoltageStatus
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `PrimaryPowerStatus` | `string` | Status string for primary power; defaults to `StringResources.Table_NA` |
| `PrimaryPowerStatusColor` | `string` | Color string for primary power status display |
| `BackupBatteryStatus` | `string` | Status string for backup battery; defaults to `StringResources.Table_NA` |
| `BackupBatteryStatusColor` | `string` | Color string for backup battery status display |
**Constructors:**
```csharp
public VoltageStatus() // Initializes status strings to Table_NA, colors remain null
public VoltageStatus(string primaryPowerStatus, string primaryPowerStatusColor,
string backupBatteryStatus, string backupBatteryStatusColor)
```
The parameterized constructor applies null-coalescing to status strings, defaulting to `StringResources.Table_NA` if null.
---
### DASModel Class
```csharp
public class DASModel : BasePropertyChanged, IDASModel, IDevicePresence,
IDASVoltage, IDASProgress, IDASLevelTrigger, IComparable<DASModel>
```
**Core Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `SerialNumber` | `string` | Device serial number; falls back to `IPAddress` if `Hardware` is null and `_serialNumber` is empty |
| `IPAddress` | `string` | Network address of the DAS device |
| `Hardware` | `DASHardware` | Hardware abstraction object; setter transfers module/parent/port/position/linked serials from previous value |
| `IDAS` | `IDASCommunication` | Communication interface for DAS operations |
| `Status` | `TSRAIRGoStatus.StatusTypes?` | Current operational status; setter ignores `CONNECT_FAILED` when current status is `REBOOTING` |
| `StatusBrush` | `SolidColorBrush` | Read-only; maps `Status` to UI brush via `_statusToBrush` dictionary |
| `StatusProgress` | `double` | Progress percentage (0-100) for long-running operations |
| `ShowStatusProgress` | `bool` | Controls visibility of progress indicator |
| `Included` | `bool` | Whether this DAS is included in the current test |
| `IsClockMaster` | `bool` | Clock synchronization role |
| `SampleRate` | `int` | Samples per second; default 20000; publishes `DASSampleRateChangedEvent` on change |
| `Duration` | `double` | Test duration; triggers `NumberOfEvents` recalculation |
| `NumberOfEvents` | `string` | Formatted as `"{current}/{max}"` based on available recording time |
| `AvailableSampleRates` | `int[]` | Fixed array: `{ 100, 500, 1000, 5000, 10000, 15000, 20000 }` |
**Hardware Info Properties (read-only):**
| Property | Description |
|----------|-------------|
| `CalDate` | Returns `Hardware.CalDate.ToShortDateString()` or empty if null/invalid |
| `Firmware` | Returns `Hardware.Firmware` or empty string |
| `FirstUseDate` | Returns formatted date or `DTS.Common.Strings.Strings.NotApplicable` / `Table_NA` |
| `EstimatedRecordingTime` | Minimum of battery and memory time, formatted as hours/minutes |
| `BatterySoC` | State of charge percentage; uses `IDAS.BaseInput.BatterySoC` if available, otherwise calculates from voltage |
| `InputVoltageStatus` | Returns `"{voltage}V"` or `Table_NA` |
**Level Trigger Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `LevelTriggerText` | `string` | Trigger threshold value; clamped to `[min, max]` range; publishes `DASLevelTriggerChangedEvent` |
| `LevelTriggerAxis1` | `bool` | Enable trigger on axis 1 |
| `LevelTriggerAxis2` | `bool` | Enable trigger on axis 2 |
| `LevelTriggerAxis3` | `bool` | Enable trigger on axis 3 |
| `LevelTriggerMaxValue` | `double` | Calculated from `SerializedSettings.LevelTriggerMaxPercentage * SensorConstants.DefaultRangeHiG` |
| `LevelTriggerMinValue` | `double` | Calculated from `SerializedSettings.LevelTriggerMinPercentage * SensorConstants.DefaultRangeLowG` |
**Commands:**
| Property | Type | Description |
|----------|------|-------------|
| `RemoveDASCommand` | `ICommand` | Publishes `RemoveDASEvent` with serial number |
| `AddDASCommand` | `ICommand` | Publishes `AddDASEvent` with serial number |
**Public Methods:**
```csharp
public int CompareTo(DASModel b)
```
Comparison logic prioritizes `Included` status, then delegates to `Hardware.CompareTo()` or `SerialNumber.CompareTo()`.
```csharp
public void RebindVoltage()
```
Raises `OnPropertyChanged` for battery/status-related properties: `BatterySoC`, `Status`, `StatusBrush`, `PrimaryPowerStatus`, `PrimaryPowerStatusColor`, `BackupBatteryStatus`, `BackupBatteryStatusColor`, `EstimatedRecordingTime`.
```csharp
public void UpdateEventCount(DTS.Common.Enums.RecordingModes recordingMode, DateTime rtcScheduleStartDateTime)
```
Updates `NumberOfEvents` based on firmware protocol version and recording mode. Handles interval mode edge case where `EventNumber + 1` is used for older firmware after scheduled start time.
```csharp
public void ResetLevelTriggers(double dNewValue)
```
Resets all axis flags to `false` and sets trigger value; raises property change notifications.
```csharp
public bool FromTestSetup(TSRAIRGoTestSetup testSetup)
```
Populates model from test setup; returns whether hardware should be included. Calls `FromTestSetupSampleRate` and `FromTestSetupLevelTrigger`.
```csharp
public void PingAndConnectDAS(CancellationToken ct)
```
Orchestrates full connection sequence: ping → query → refresh voltage → get arm status. Includes 150ms delays between phases for UI feedback.
```csharp
public static int GetMaxQueryTime()
```
Returns `Math.Max(SerializedSettings.ResolveChannels_SLICE_QueryConfigTimeoutSec, 3)`.
```csharp
public void QueryConfig(List<IDASCommunication> das, bool bReadIds, bool bDeviceScaleFactors,
CancellationToken ct, int maxQueryTimeSec)
```
Queries DAS configuration via `ConfigurationService`; updates `Hardware`, `IDAS`, and `Status` on success.
```csharp
public void UpdateLastSeen()
```
Sets `LastSeen` to `DateTime.Now`.
---
### RemoveDASCommandClass
```csharp
public class RemoveDASCommandClass : ICommand
```
- `ID` property (string)
- `Execute(object parameter)` publishes `RemoveDASEvent` with `DASModel.SerialNumber`
- `CanExecute` always returns `true`
### AddDASCommandClass
```csharp
public class AddDASCommandClass : ICommand
```
- `ID` property (string)
- `Execute(object parameter)` publishes `AddDASEvent` with `DASModel.SerialNumber`
- `CanExecute` always returns `true`
---
## 3. Invariants
### Battery Voltage Constants
- `MIN_BATTERY_VOLTAGE = 2.98D` — Below this, state-of-charge is 0%
- `MAX_BATTERY_VOLTAGE = 4.2D` — Above this, state-of-charge is 100%
- `SECONDS_PER_HOUR = 3600D`
### Battery Breakpoints
The `_batteryPoints` array defines 16 voltage-to-hours-remaining tuples, ranging from `(4.172656V, 14.75h)` down to `(2.979766V, 0.083h)`.
### Sample Rate Constraints
- Default sample rate: 20000
- Fallback sample rate for memory calculation: 10000
- Valid rates are fixed: `{ 100, 500, 1000, 5000, 10000, 15000, 20000 }`
### Status Transition Rules
- `CONNECT_FAILED` is ignored when current status is `REBOOTING`
- All status values map to one of three brush types: `Failed`, `Busy`, `Complete`, or `Idle`
### Thread Safety
- `_queryDASLock` (static readonly object) protects `SLICEDBHostNames` modifications during `QueryDAS`
- `DASHardware.GetArmStatusLock` is used for `QueryConfig`, `RefreshVoltageStatus`, and `GetArmStatus`
### Recording Time Calculation
- Estimated recording time is the minimum of battery-based and memory-based estimates
- Memory calculation: `totalSamples / sampleRate` where `totalSamples = MemoryInBytes / 12`
---
## 4. Dependencies
### Direct Dependencies (from imports)
**Internal Namespaces:**
- `DataPROWin7.Common``BasePropertyChanged`, utility classes
- `DataPROWin7.Controls` — UI controls
- `DataPROWin7.DataModel` — Data structures
- `DataPROWin7.SubControls` — Sub-controls
- `DataPROWin7.TSRAIRGo.Interface``IDASModel` interface
- `DTS.Common` — Common utilities
- `DTS.Common.Base` — Base classes
- `DTS.Common.Events` / `DTS.Common.Events.TSRAIRGo` — Event types
- `DTS.Common.Interface.DASFactory` — DAS factory interfaces
- `DTS.Common.SharedResource.Strings` — Localized strings
- `DTS.Common.Utilities.Logging``APILogger`
- `DTS.Common.Utils` — Utility classes including `PingUtils`
- `DTS.Common.DataModel.Classes.TestTemplate` — Test template classes
- `DTS.Common.DataModel.Classes.TSRAIRGo``TSRAIRGoTestSetup`, `LevelTriggerArg`
- `DTS.Common.Enums.Sensors` — Sensor enums
- `DTS.Common.Classes.Hardware``DASHardware`
- `DTS.SensorDB` — Sensor database
- `DTS.DASLib.Service``ConfigurationService`, `DiagnosticsService`, `ArmingService`, `ServiceBase`
**External Frameworks:**
- `Prism.Events``IEventAggregator`, event publishing
- `Prism.Ioc``ContainerLocator`
- `System.Windows`, `System.Windows.Input`, `System.Windows.Media` — WPF infrastructure
### Events Published
- `DASSampleRateChangedEvent` with `DASSampleRateArg`
- `DASLevelTriggerChangedEvent` with `LevelTriggerArg`
- `RemoveDASEvent` with serial number string
- `AddDASEvent` with serial number string
- `PageErrorEvent` with `PageErrorArg`
### Events Consumed
None directly subscribed in these files (consumption likely in View/ViewModel layers).
---
## 5. Gotchas
### Hardware Setter State Transfer
The `Hardware` setter copies properties from the *old* value to the *new* value, with a comment noting "this looks backwards but the code was already here." This preserves module/parent/port configuration across hardware reassignment.
### Event Counting Firmware Dependency
`UpdateEventCount` has different logic paths based on firmware protocol version:
- Protocol ≥ 35: Uses `IDAS.DASArmStatus.EventNumber` directly
- Protocol < 35 in Interval mode after scheduled start: Adds 1 to `EventNumber`
- The code explicitly notes this will **incorrectly display "1"** when DAS are set to Local time and UTC schedule time has passed — requires firmware fix.
### Serial Number Fallback Chain
`SerialNumber` getter returns: `Hardware.SerialNumber``_serialNumber``IPAddress`. The setter only modifies `_serialNumber` when `Hardware` is null.
### QueryDAS Early Exit
`QueryDAS` returns early without setting a failed status if the IP address is already in `sliceIPAddresses`. This could mask connection issues if called multiple times for the same device.
### Default Number of Events Cap
`GetMaxEvents()` caps the result at `Properties.Settings.Default.TSRAIRGo_DefaultNumberOfEvents`, which may hide the true recording capacity.
### Status Brush Mapping
The `_statusToBrush` dictionary maps `DISARMED` and `DISARMING` to `Failed` status (red), which may be intentional but differs from typical "idle" semantics.
### CalDate Invalid Handling
`CalDate` explicitly checks for `DASDBRecord.INVALID_DATE` in addition to null, suggesting the database layer uses a sentinel value rather than null for invalid dates.
### Memory Calculation Assumption
`GetEstimatedRecordingTimeMemory` assumes 12 bytes per sample (`MemoryInBytes/12`), which may be hardware-specific and not documented as configurable.

View File

@@ -0,0 +1,74 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/View/GoMainWindow.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/View/Dashboard.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/View/SystemStatus.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/View/Navigation.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/View/SystemSettings.xaml.cs
- DataPRO/DataPRO/TSRAIRGo/View/DASTable.xaml.cs
generated_at: "2026-04-17T16:28:39.454519+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "525ef46c73b6c149"
---
# View
### Purpose
This module provides WPF views for the TSRAIRGo application component within DataPRO. Each view is a `UserControl` that follows a code-behind pattern with ViewModel injection via Unity IoC container. Views handle UI-specific concerns like input validation and event handling while delegating business logic to their respective ViewModels.
### Public Interface
**GoMainWindow** : `UserControl`
- `GoMainWindow()` - Constructor that initializes the component and resolves `GoMainWindowViewModel` from the Unity container to set as `DataContext`.
**Dashboard** : `UserControl`
- `Dashboard()` - Constructor that initializes the component and resolves `DashboardViewModel` from the Unity container to set as `DataContext`.
**SystemStatus** : `UserControl`
- `SystemStatus()` - Constructor that initializes the component and resolves `SystemStatusViewModel` from the Unity container to set as `DataContext`.
**Navigation** : `UserControl`
- `Navigation()` - Constructor that initializes the component, resolves `NavigationViewModel`, sets `DataContext`, and attaches `Loaded` event handler.
- `ContentControl` (property) - Public property of type `ContentControl`; purpose unclear from source.
- `Navigation_Loaded(object, RoutedEventArgs)` - Private handler that calls `_viewModel.Load()`.
**SystemSettings** : `UserControl`
- `SystemSettings()` - Constructor that initializes the component and resolves `SystemSettingsViewModel` from the Unity container to set as `DataContext`.
- `NumberValidationTextBox(object, TextCompositionEventArgs)` - Private handler that calls `ViewHelper.ValidateFloatOnlyTextBox(e)`.
- `NumberIntValidationTextBox(object, TextCompositionEventArgs)` - Private handler that calls `ViewHelper.ValidateIntegerOnlyTextBox(e)`.
**DASTable** : `UserControl`
- `DASTable()` - Constructor that initializes the component, resolves `IEventAggregator`, subscribes to `ClearIpAddressEvent`, resolves `DASTableViewModel`, and sets `DataContext`.
- `IsClockMaster_Click(object, RoutedEventArgs)` - Private handler that ensures only one DAS can be clock master by unsetting `IsClockMaster` on all other items.
- `ShowAllToggleButton_Click(object, RoutedEventArgs)` - Private handler that toggles button content between `Strings.ShowAll` and `Strings.OnlyIncluded`.
- `ShowModeToggleButton_Click(object, RoutedEventArgs)` - Private handler that toggles button content between `Strings.ShowMore` and `Strings.ShowLess`.
- `NumberValidationTextBox(object, TextCompositionEventArgs)` - Private handler that calls `ViewHelper.ValidateFloatOnlyTextBox(e)`.
- `OnClearIpAddress(ClearIpAddressArg)` - Public method that clears `newIpAddress` control when `ClearIpAddressEvent` is published.
### Invariants
- All views require `ContainerLocator.Container` to be properly initialized with a Unity container.
- All ViewModels (`GoMainWindowViewModel`, `DashboardViewModel`, `SystemStatusViewModel`, `NavigationViewModel`, `SystemSettingsViewModel`, `DASTableViewModel`) must be registered in the Unity container.
- `DASTable.newIpAddress` must be a named control in the XAML (referenced in `OnClearIpAddress`).
- `DASTable.DASModelSource` must be an enumerable collection on the ViewModel containing `DASModel` items.
### Dependencies
- **Depends on**:
- `Prism.Ioc` (`ContainerLocator`)
- `Unity` (`IUnityContainer`)
- `System.Windows.Controls`
- `DataPROWin7.TSRAIRGo.ViewModel` (all ViewModels)
- `DataPROWin7.TSRAIRGo.Model` (`DASModel`)
- `DataPROWin7.TSRAIRGo.Classes` (`ViewHelper`)
- `DataPROWin7.TSRAIRGo.DataProvider` (in Navigation)
- `DTS.Common.Interface` (in Navigation)
- `DTS.Common.Strings` (`Strings` class)
- `DTS.Common.Events.TSRAIRGo` (`ClearIpAddressEvent`, `ClearIpAddressArg`)
- `Prism.Events` (`IEventAggregator`)
- **Depended on by**: Not determinable from source alone.
### Gotchas
- **Namespace inconsistency**: The namespace `DataPROWin7.TSRAIRGo` is used despite the module path suggesting `DataPRO.TSRAIRGo`. This may indicate a historical rename or project structure mismatch.
- **Service Locator pattern**: Views use `ContainerLocator.Container.Resolve<IUnityContainer>()` which is an anti-pattern; direct constructor injection would be preferred.
- **Unused property**: `Navigation.ContentControl` is declared but never assigned or used in the visible source.
- **Event subscription without unsubscription**: `

View File

@@ -0,0 +1,254 @@
---
source_files:
- DataPRO/DataPRO/TSRAIRGo/ViewModel/DashboardViewModel.cs
- DataPRO/DataPRO/TSRAIRGo/ViewModel/SystemStatusViewModel.cs
- DataPRO/DataPRO/TSRAIRGo/ViewModel/GoMainWindowViewModel.cs
- DataPRO/DataPRO/TSRAIRGo/ViewModel/NavigationViewModel.cs
- DataPRO/DataPRO/TSRAIRGo/ViewModel/SystemSettingsViewModel.cs
generated_at: "2026-04-17T15:52:15.350011+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "740f127a6ea8ab7f"
---
# TSRAIRGo ViewModel Module Documentation
## 1. Purpose
This module provides the ViewModel layer for the TSRAIRGo subsystem within DataPRO, implementing the MVVM pattern using Prism framework components. It manages UI state for the main dashboard, navigation system, system status display, and comprehensive system settings configuration including recording modes (Active/Scheduled), sample rates, level triggers, and clock synchronization. The ViewModels communicate via Prism's `IEventAggregator` for decoupled pub/sub messaging, and depend on Unity for dependency injection resolution.
---
## 2. Public Interface
### DashboardViewModel
**Namespace:** `DataPROWin7.TSRAIRGo.ViewModel`
```csharp
public class DashboardViewModel : DTS.Common.Base.BasePropertyChanged
public DashboardViewModel()
```
A minimal view model extending `BasePropertyChanged`. Currently has no properties or methods beyond the default constructor. Intended as a placeholder for dashboard-specific UI binding.
---
### SystemStatusViewModel
**Namespace:** `DataPROWin7.TSRAIRGo.ViewModel`
```csharp
public class SystemStatusViewModel : DTS.Common.Base.BasePropertyChanged
public SystemStatusViewModel()
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `Message` | `string` | Status message displayed to user; updated via `SystemStatusEvent` subscription |
| `Error` | `string` | Error message displayed to user; updated via `SystemErrorEvent` subscription |
**Behavior:** Constructor resolves `IEventAggregator` from `ContainerLocator.Container` and subscribes to `SystemStatusEvent` (calls `OnStatusReceived`) and `SystemErrorEvent` (calls `OnErrorReceived`). Event handlers extract `Message` or `Error` from the event arguments.
---
### GoMainWindowViewModel
**Namespace:** `DataPROWin7.TSRAIRGo.ViewModel`
```csharp
public class GoMainWindowViewModel : BasePropertyChanged
public GoMainWindowViewModel()
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ContentValue` | `object` | Current content displayed in main window; raises `OnPropertyChanged` on set |
| `NavigationValue` | `object` | Current navigation control; raises `OnPropertyChanged` on set |
**Behavior:** Constructor subscribes to `NavigateToDashboardEvent`. When triggered via `OnNavigateToDashboard`, it:
1. Resolves `Dashboard` and `Navigation` from Unity container (lazy initialization of `_tSRAIRGoDashboard`)
2. Enables `ViewData` and `ExportData` buttons, disables `Dashboard` button via `NavigationViewModel.EnableButton`
3. Publishes `StartStopDASScanEvent(true)` and `StartStopOverallStatusStateMachineEvent(true)`
---
### NavigationViewModel
**Namespace:** `DataPROWin7.TSRAIRGo.ViewModel`
```csharp
public class NavigationViewModel : BasePropertyChanged
public NavigationViewModel(ITabPageItemsProvider tabPageItemsProvider)
```
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `TabPageItems` | `List<TabPageItem>` | Populated via `ITabPageItemsProvider.GetGroupContents()` in `Load()` |
| `NavigationButtonsInfo` | `Dictionary<NavigationButtonId, INavigationButtonInfo>` | Button configuration dictionary |
| `TestId` | `string` | Test identifier with property change notification |
| `HelpCommand` | `DelegateCommand` | Opens PDF manual |
| `ArmDisarmCommand` | `DelegateCommand` | Publishes `ArmEvent` |
| `TriggerCommand` | `DelegateCommand` | Publishes `TriggerEvent` |
| `NavigateToDownloadCommand` | `DelegateCommand` | Triggers download flow |
| `NavigateToViewDataCommand` | `DelegateCommand` | Navigates to view data page |
| `NavigateToExportDataCommand` | `DelegateCommand` | Navigates to export page |
| `NavigateToDashboardCommand` | `DelegateCommand` | Publishes `NavigateToDashboardEvent` |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `UpdateNavigationButtonInfo` | `void UpdateNavigationButtonInfo(INavigationButtonInfo navigationButtonInfo)` | Updates single button info if key exists |
| `UpdateNavigationButtonsInfo` | `void UpdateNavigationButtonsInfo(IEnumerable<INavigationButtonInfo> navigationButtonsInfo)` | Batch updates button info |
| `EnableHamburgerMenu` | `void EnableHamburgerMenu(bool enable)` | Delegates to `IHamburgerMenuViewModel.EnableMenu` |
| `EnableButton` | `void EnableButton(NavigationButtonId id, bool enable)` | Sets `Enabled` property on button if exists |
| `ChangeTextButton` | `void ChangeTextButton(NavigationButtonId id, string text, string tooltip)` | Updates `Text` and `Tooltip` on button |
| `ShowBorder` | `void ShowBorder(NavigationButtonId id, bool show)` | Sets `ShowBorder` property; marshals to UI thread via `Dispatcher.BeginInvoke` if needed |
| `Load` | `void Load()` | Populates `TabPageItems` from provider |
| `KeyDown` | `bool KeyDown(object sender, KeyEventArgs e)` | Forwards key event to current `DataPROPage` |
| `SetContent` | `void SetContent(DataPROPage page)` | Sets `ContentValue` on `GoMainWindowViewModel` |
| `GoToExportData` | `void GoToExportData()` | Calls `NavigateToExportData()` |
**Navigation Button IDs Initialized:** `Help`, `ArmDisarm`, `Trigger`, `Download`, `ViewData`, `ExportData`, `Dashboard`
---
### SystemSettingsViewModel
**Namespace:** `DataPROWin7.TSRAIRGo.ViewModel`
```csharp
public class SystemSettingsViewModel : DTS.Common.Base.BasePropertyChanged, ISystemSettings
public SystemSettingsViewModel()
```
**Constants:**
| Constant | Value | Description |
|----------|-------|-------------|
| `DEFAULT_INTERVAL_MINUTES` | `100` | Default interval between scheduled events |
| `MIN_EVENTS` | `1` | Minimum number of events |
| `MAX_EVENTS` | `2000` | Maximum number of events |
| `SAMPLE_RATE_FORMATTER` | `"N0"` | Format string for sample rate display |
**Properties:**
| Property | Type | Description |
|----------|------|-------------|
| `IsSystemSettingsEnabled` | `bool` | Enables/disables system settings UI |
| `RecordingMode` | `AvailableRecordingMode` | Current recording mode (implements `ISystemSettings`) |
| `SelectedRecordingMode` | `AvailableRecordingMode` | Bound recording mode selection; triggers mode-specific initialization |
| `Duration` | `double` | Post-trigger duration in seconds |
| `DurationText` | `string` | Label text ("Post Trigger" or "Event Length") |
| `NumberOfEvents` | `int` | Number of events (clamped 1-2000) |
| `Interval` | `int` | Interval between events in minutes |
| `ScheduleStartDateTimeUTC` | `DateTime` | Scheduled start time (seconds truncated) |
| `CurrentDateTimeUTC` | `DateTime` | Returns `DateTime.UtcNow` |
| `AvailableSampleRates` | `string[]` | Valid sample rates from `DFConstantsAndEnums.TSRAIR_ValidSampleRates` |
| `SelectedSampleRateIndex` | `int` | Index of selected sample rate; -1 if mixed |
| `SampleRatesAreMixed` | `bool` | True when connected DAS units have different sample rates |
| `LevelTriggerText` | `string` | Level trigger threshold value |
| `LevelTriggerAxis1/2/3` | `bool` | Level trigger axis enable flags |
| `LevelTriggersAreMixed` | `bool` | True when DAS units have different level trigger settings |
| `ShowLevelTriggers` | `bool` | True only in Active recording mode |
| `SelectedClockSyncProfile` | `ClockSyncProfile` | Selected clock synchronization profile |
| `ScheduledVisibility` | `Visibility` | Visible for Scheduled mode, Collapsed for Active |
| `IntervalVisibility` | `Visibility` | Visible for Scheduled mode with `NumberOfEvents > 1` |
**Commands:**
| Command | Description |
|---------|-------------|
| `SampleRatesAreMixedResetCommand` | Resets mixed sample rate state |
| `LevelTriggersAreMixedResetCommand` | Resets level triggers to min value and clears axis flags |
**Methods:**
| Method | Signature | Description |
|--------|-----------|-------------|
| `PopulateDASSampleRate` | `void PopulateDASSampleRate(string serialNumber, double sampleRate)` | Adds/updates sample rate in lookup; skips if key exists and rate is 0 |
| `PopulateDASLevelTrigger` | `void PopulateDASLevelTrigger(string serialNumber, LevelTriggerArg levelTriggerArg)` | Adds/updates level trigger in lookup |
| `PopulateDASAAFRateList` | `void PopulateDASAAFRateList(string serialNumber, float aafRate)` | Adds/updates AAF rate in lookup |
| `SubscribeDASLevelTrigger` | `void SubscribeDASLevelTrigger()` | Subscribes to `DASLevelTriggerChangedEvent` |
| `UnSubscribeDASLevelTrigger` | `void UnSubscribeDASLevelTrigger()` | Unsubscribes from `DASLevelTriggerChangedEvent` |
| `EnableSystemSettings` | `void EnableSystemSettings(bool enable)` | Sets `IsSystemSettingsEnabled` |
| `FromTestSetup` | `void FromTestSetup(TSRAIRGoTestSetup setup)` | Loads all settings from test setup object |
| `ApplyToTestSetup` | `void ApplyToTestSetup(TSRAIRGoTestSetup setup)` | Saves recording mode, sample rate, duration to test setup |
| `ApplyClockSettingsToTestSetup` | `void ApplyClockSettingsToTestSetup(TSRAIRGoTestSetup setup)` | Saves clock sync settings to test setup |
| `ValidateRTCScheduleStartTime` | `bool ValidateRTCScheduleStartTime()` | Validates schedule start time via `TestTemplate.ValidateScheduleStartTime` |
| `ValidateInterval` | `bool ValidateInterval()` | Validates interval via `TestTemplate.ValidateInterval` |
**Events Published:**
- `SystemSettingsDurationChangedEvent`
- `SystemSettingsSampleRateChangedEvent`
- `SystemSettingsLevelTriggerChangedEvent`
- `SystemSettingsRecordingModeChangedEvent`
- `PageErrorEvent`
**Events Subscribed:**
- `DASSampleRateChangedEvent`
- `DASLevelTriggerChangedEvent`
- `DASListChangedEvent`
---
## 3. Invariants
1. **Event Count Bounds:** `NumberOfEvents` is always clamped between `MIN_EVENTS` (1) and `MAX_EVENTS` (2000).
2. **Sample Rate Validity:** All sample rates must be from `DFConstantsAndEnums.TSRAIR_ValidSampleRates`. Invalid rates are replaced with the next lowest available rate.
3. **Level Trigger Bounds:** Level trigger values are bounded by min/max calculated from `SerializedSettings.LevelTriggerMinPercentage * SensorConstants.DefaultRangeLowG` and `SerializedSettings.LevelTriggerMaxPercentage * SensorConstants.DefaultRangeHiG`.
4. **Schedule Time Seconds Truncation:** `ScheduleStartDateTimeUTC` always has seconds component set to 0 via `value.Subtract(new TimeSpan(0, 0, value.Second))`.
5. **Clock Sync Profile Exclusion:** GPS 1PPS profile (`ClockSyncProfileCollection.ClockSyncProfileDefaults.GPS1PPS`) is explicitly excluded from `AvailableClockSyncProfiles`.
6. **Pre-trigger Calculation:** `PreTriggerSeconds` is calculated as `TSRAIR.TSRAIR_MAX_PRE_TRIGGER_SAMPLES / maxSampleRate`.
7. **Recording Mode Mapping:**
- `DFConstantsAndEnums.RecordingMode.Aerospace``RecordingModes.Active`
- `DFConstantsAndEnums.RecordingMode.Scheduled` with `NumberOfEvents == 1``RecordingModes.Scheduled`
- `DFConstantsAndEnums.RecordingMode.Scheduled` with `NumberOfEvents > 1``RecordingModes.Interval`
---
## 4. Dependencies
### External Dependencies (Imports)
- **Prism Framework:** `Prism.Events`, `Prism.Ioc`, `Prism.Commands` - Event aggregation, DI container location, delegate commands
- **Unity:** `Unity`, `IUnityContainer` - Dependency injection container
- **DTS.Common.Base:** `BasePropertyChanged` - Base class for property change notification
- **DTS.Common.Events / DTS.Common.Events.TSRAIRGo:** Event types for pub/sub messaging
- **DTS.Common.Enums.TSRAIRGo:** `NavigationButtonId`, `DFConstantsAndEnums`, `RecordingModes`
- **DTS.Common.Interface:** `ITabPageItemsProvider`, `INavigationButtonInfo`, `IHamburgerMenuViewModel`, `ISystemSettings`
- **DTS.Common.Storage:** `SerializedSettings` for level trigger bounds
- **DTS.Common.Utilities.Logging:** `APILogger` for error logging
- **DTS.Common.SharedResource.Strings:** `StringResources` for localized strings
- **DTS.Common.Classes.ClockSync:** `ClockSyncProfile`, `ClockSyncProfileCollection`
- **DTS.Common.Enums.Sensors:** `SensorConstants`
- **DataPROWin7.DataModel:** `TabPageItem`, `TabPageSource`, `DataPROPage`
- **DataPROWin7.TSRAIRGo.DataProvider:** `IDASModelProvider`
- **DataPROWin7.TSRAIRGo.Interface:** `ISystemSettings` (implemented by `SystemSettingsViewModel`)
### Internal Dependencies
- `NavigationViewModel` depends on `GoMainWindowViewModel`, `IHamburgerMenuViewModel`, `ITabPageItemsProvider`
- `SystemSettingsViewModel` depends on `IDASModelProvider`, `TSRAIRGoTestSetup`
- `GoMainWindowViewModel` depends on `Dashboard`, `Navigation`, `NavigationViewModel` (resolved via Unity)
---
## 5. Gotchas
1. **Conditional Compilation in NavigateToDownload:** The method `NavigateToDownload()` has a preprocessor directive `#if _DOWNLOAD_USING_NAVIGATE_TO` that completely changes behavior:
- **Defined:** Navigates to download page, enables Dashboard button
- **Not Defined (current):** Calls `Download()` directly, disables Dashboard button
This could cause confusion if the symbol is toggled.
2. **Manual Event Firing Workaround:** In `SystemSettingsViewModel` constructor, `OnDASListChanged(true)` is manually invoked because the DAS list in the provider may already be populated before the ViewModel subscribes to `DASListChangedEvent`. Comment explicitly states this is a "shortcut."
3. **Thread Marshaling in ShowBorder:** `NavigationViewModel.ShowBorder()` uses `Application.Current.Dispatcher.BeginInvoke` to marshal to the UI thread when called from a non-UI thread. This is a silent behavior that could cause unexpected delays.
4. **Timer Lifecycle in SystemSettingsViewModel:** The `_currentTime` `DispatcherTimer` is only started when entering Scheduled mode and stopped when entering Active mode. Timer interval is 1 second for updating `CurrentDateTimeUTC`.
5. **Silent Seconds Truncation:** `ScheduleStartDateTimeUTC` silently truncates seconds in its setter without notification or validation feedback.
6. **Sample Rate Lookup Skip Logic:** `PopulateDASSampleRate` returns early without updating if the serial number already exists AND the new sample rate is 0. This could mask intentional zero-rate signals.
7. **Null Checks Missing in Some Event Handlers:** `OnStatusReceived` and `OnErrorReceived` use null-conditional operators (`arg?.Message`), but other event handlers like `OnDASSampleRateChanged` do not validate arguments before use.
8. **Hardcoded Manual Path:** `NavigationViewModel.Help()` uses hardcoded path `"Manuals"` and filename `"TSR AIR Go Quick Start Guide (10920-04040-APN).pdf"`. Changes to documentation location will require code changes.

View File

@@ -0,0 +1,208 @@
---
source_files:
- DataPRO/DataPRO/View/ShellView.xaml.cs
- DataPRO/DataPRO/View/MainWindow.xaml.cs
generated_at: "2026-04-17T15:57:38.420222+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "db222ae7a05f8bf1"
---
# Documentation: DataPRO Shell Views
## 1. Purpose
The `ShellView` and `MainWindow` classes constitute the primary shell/container for the DataPRO WPF application. `ShellView` is a minimal shell implementing `IShellView`, while `MainWindow` serves as the application's main window, orchestrating navigation between pages (login, home, various functional pages), managing modal dialogs, handling window state (minimize/maximize/restore), coordinating with the DAS (Data Acquisition System) factory, displaying license prompts, managing full-screen chart views, and routing keyboard events. It acts as the central hub connecting the UI layer to application logic, licensing, and data acquisition subsystems.
---
## 2. Public Interface
### ShellView (ShellView.xaml.cs)
| Member | Signature | Description |
|--------|-----------|-------------|
| Constructor | `public ShellView()` | Initializes the component via `InitializeComponent()`. Implements `IShellView`. |
### MainWindow (MainWindow.xaml.cs)
#### Enums
| Member | Values | Description |
|--------|--------|-------------|
| `Icons` | `DataPRO`, `TSRAIRGo` | Defines application icons that can be set on the main window. |
#### Properties
| Member | Type | Description |
|--------|------|-------------|
| `ConnectedPrimaryDb` | `bool` | Gets/sets primary database connection status. Publishes `DBConnectionEvent` on change. |
| `DASAvailable` | `bool` | Gets/sets DAS factory availability status. |
| `DatabaseModified` | `bool` | Gets/sets database modification flag; triggers `OnSetActive()` on current page when changed. |
| `DataPRO_Version` | `string` | Gets/sets the application version string displayed in UI. |
| `PageName` | `string` | Gets/sets current page name; updates window title on change. |
| `DatabaseVersion` | `string` | Gets/sets database version string. |
| `ModifyText` | `string` | Gets/sets modification text for UI display. |
| `HasSaveState` | `bool` | Returns `true` if there's a saved page state; delegates to `_homePage?.HasSavedState`. |
| `SelectedTestSetupListIndex` | `static int` | Static property for selected test setup list index. Default is `-1`. |
| `PropertyChanged` | `event PropertyChangedEventHandler` | INotifyPropertyChanged event for data binding. |
#### Navigation Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `GoTo` | `void GoTo(PageNavigationRequest request)` | Navigates to a given area via home page. |
| `GoTo` | `void GoTo(DataPROTabItem tab, bool saveState = false)` | Navigates to specified tab with optional state saving. |
| `GoToSavedState` | `void GoToSavedState()` | Navigates to the saved state page. |
| `GoToPreviousPage` | `void GoToPreviousPage()` | Navigates to previous page, handling `RunTestBase` tab logic. |
| `GoToPreviousPage` | `void GoToPreviousPage(bool setActive)` | Navigates to previous page with optional `setActive` parameter. |
| `GoToHomePage` | `void GoToHomePage(bool CallOnSetActive = true)` | Navigates to home page, clears previous pages history. |
| `GoToLoginPage` | `void GoToLoginPage()` | Navigates to login page, updates users list. |
| `GoToNewPage` | `void GoToNewPage(DataPROPage page)` | Delegates to `_homePage.GoToNewPage(page)`. |
| `SetNewTest` | `void SetNewTest(DataModel.TestTemplate test)` | Sets new test template, updates header ribbon and persistent state. |
#### Full-Screen Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `GoToFullScreenGrid` | `void GoToFullScreenGrid(object chart)` | Displays chart in full-screen grid mode. |
| `GoToFullScreenRealtime` | `void GoToFullScreenRealtime(Controls.RealtimeChart chart, SubControls.Realtime realtime, RunTestBase rtb)` | Enters full-screen realtime mode with chart and plot info. |
| `GoToSmallScreenRealtime` | `void GoToSmallScreenRealtime()` | Exits full-screen realtime mode. |
| `AddFullScreenPlotInfo` | `void AddFullScreenPlotInfo(Control[] controls)` | Adds plot info controls to full-screen grid. |
| `RemoveFullScreenPlotInfo` | `void RemoveFullScreenPlotInfo()` | Clears all plot info from full-screen grid. |
| `GetRealtimeFullScreen` | `Controls.RealtimeFullScreen GetRealtimeFullScreen()` | Returns reference to `_fullScreen` control. |
#### Modal Dialog Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `DoModalWindow` | `void DoModalWindow(IModalContent content, string msg = null, IList<PageButton> buttonIds = null, PageButton defaultButton = null)` | Queues and displays modal content. |
| `CloseModalDialog` | `void CloseModalDialog()` | Closes current modal dialog and processes queue. |
#### Timed Wait Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `GoToTimedWaitPage` | `void GoToTimedWaitPage(System.Threading.ManualResetEvent mre, string message, Visibility cancelButtonVisibility)` | Displays timed wait control with progress. |
| `CloseTimedWaitPage` | `void CloseTimedWaitPage()` | Closes timed wait page. |
| `SetTimedWaitPercentage` | `void SetTimedWaitPercentage(double percent)` | Updates progress percentage on timed wait control. |
#### Dialog Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `DoChangeView` | `void DoChangeView()` | Displays change view dialog with filtered users. |
| `CloseChangeView` | `void CloseChangeView()` | Hides change view dialog. |
| `DoDisplayHelp` | `void DoDisplayHelp()` | Displays help window. |
| `CloseDisplayHelp` | `void CloseDisplayHelp()` | Hides help window. |
#### License Prompt Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `ShowModalLicensePrompt` | `void ShowModalLicensePrompt()` | Shows expired license warning (skipped in DEBUG builds). |
| `ShowModalUnLicensedPrompt` | `void ShowModalUnLicensedPrompt()` | Shows unlicensed user warning (skipped in DEBUG builds). |
| `ShowModalProductVersionPrompt` | `void ShowModalProductVersionPrompt()` | Shows invalid product version warning (skipped in DEBUG builds). |
#### Other Public Methods
| Member | Signature | Description |
|--------|-----------|-------------|
| `SetIcon` | `void SetIcon(Icons icon)` | Sets window icon based on `Icons` enum value. |
| `SetGroupsVisible` | `void SetGroupsVisible()` | Sets group visibility on home page. |
| `RunTestPostOnSetActive` | `void RunTestPostOnSetActive(DataModel.TestTemplate CurrentTestSetup)` | Updates header ribbon test setup button style. |
| `FactoryChanged` | `void FactoryChanged(DTS.DASLib.DASFactory.DASFactoryEventArgs e)` | Forwards factory change event to current page. |
| `SystemLoaded` | `void SystemLoaded()` | Sets login control active. |
| `OnButtonPress` | `void OnButtonPress(Controls.PageButton button)` | Handles button presses from modal dialogs and UI. |
| `GetKeyState` | `bool GetKeyState(Key key)` | Returns whether specified key is currently down. |
| `SetMainContent` | `void SetMainContent(object o)` | Sets `contentControl.Content`. |
| `GetMainContent` | `object GetMainContent()` | Returns `contentControl.Content`. |
| `GroupedItemControlClicked` | `void GroupedItemControlClicked(object sender)` | Handles grouped item control clicks for navigation. |
| `UpdateTitle` | `void UpdateTitle()` / `void UpdateTitle(object o)` | Updates window title with app name, version, page name, and test setup. |
---
## 3. Invariants
1. **Thread Affinity**: All UI operations must execute on the dispatcher thread. Methods like `SetIcon`, `SetDASAvailable`, `PostCloseCurrentPage`, and `DoDASFactoryUnavailableWarning` explicitly check `Dispatcher.CheckAccess()` and marshal calls to the UI thread when necessary.
2. **Modal Dialog Queue Order**: Modal dialogs are processed FIFO via `_modalContentList`, `_modalMessageList`, `_modalButtonIds`, and `_modalDefaultButton` lists. These four lists must remain synchronized in length and order.
3. **DAS Factory Ownership**: If `DASFactory.CanDASFactoryStart(false)` returns `false` at startup, `DASAvailable` is set to `false` and a background thread polls for ownership via `TakeDASOwnership` until successful.
4. **Window State Consistency**: The `WindowResizer` helper (`ob`) is initialized in `OnInitialized` and used for custom window resizing/dragging behavior.
5. **Title Update Locking**: `UpdateTitle` uses `MyLock` and `_bUpdatingTitle` flag to prevent concurrent title updates.
6. **Key State Tracking**: `_keyStates` dictionary and `KeyLock` object ensure thread-safe keyboard state tracking.
7. **Previous Pages Stack**: `_previousPages` list maintains navigation history for full-screen and modal scenarios.
---
## 4. Dependencies
### Imports (What this module depends on)
| Namespace | Purpose |
|-----------|---------|
| `DTS.Common.Base` | Base types |
| `DTS.Common.Interface` | `IShellView`, `IMainView` interfaces |
| `DTS.Common.Utilities` | Utility classes including `APILogger` |
| `DTS.Common.Utilities.Logging` | Logging infrastructure |
| `DTS.Common.Events` | Prism events including `DBConnectionEvent`, `AppStatusEvent`, `DatabaseVersionChangedEvent` |
| `DTS.Slice.Users` | User management (`User`, `UserCollection`, `UserPermissionLevels`) |
| `DTS.Common.Licensing.SystemInformation` | Hardware info for licensing (`MainBoardInfo`, `ProcessorInfo`, `ComputerSystemInfo`, `MachineInfo`) |
| `DTS.Common.SharedResource.Strings` | Localized string resources |
| `DTS.Common.Enums` | Common enumerations |
| `DTS.DASLib.DASFactory` | Data Acquisition System factory |
| `Prism.Ioc`, `Prism.Events` | Prism framework for DI and event aggregation |
| `Unity` | Unity container for DI |
| `System.Windows.Interop` | WPF interop for Win32 handles |
| `System.Runtime.InteropServices` | P/Invoke for Win32 API calls |
### Internal Dependencies (referenced but not in imports)
| Type | Purpose |
|------|---------|
| `DataPROWin7.Pages.HomePage` | Main content page container |
| `DataPROWin7.Controls.LoginControl2` | Login UI control |
| `DataPROWin7.Controls.TimedWaitControl` | Progress/wait UI control |
| `DataPROWin7.Controls.ModalPage`, `ModalUserPrompt`, `ModalLicensePrompt` | Modal dialog controls |
| `DataPROWin7.Controls.RealtimeFullScreen`, `GridFullScreen` | Full-screen chart controls |
| `DataPROWin7.Common.GroupedItemControl` | Grouped navigation items |
| `DataPROWin7.Common.SerializedSettings` | Persistent user settings |
| `DataPROWin7.Common.WaitCursor` | Cursor management |
| `DataPROWin7.Controls.PageButton` | Button control for modal dialogs |
| `DataPROWin7.DataPROPage` | Base page type |
| `DataPROWin7.RunTestBase` | Test execution page base |
| `TSRAIRGo.ViewModel.NavigationViewModel` | TSR AIR Go navigation (conditional) |
### What depends on this module
- `App` class (referenced extensively via `((App)Application.Current)`)
- Various pages and controls that call navigation methods on `MainWindow`
---
## 5. Gotchas
1. **Conditional Compilation for License Prompts**: `ShowModalLicensePrompt`, `ShowModalUnLicensedPrompt`, and `ShowModalProductVersionPrompt` have empty bodies in DEBUG builds (`#if DEBUG ... #else ... #endif`). License warnings will not appear during debug sessions.
2. **P/Invoke for Window Management**: The class uses `user32.dll` imports (`ShowWindow`, `SetForegroundWindow`) for focusing other application instances. This is Windows-specific and will not work on other platforms.
3. **Exit Confirmation State**: `_onExitConfirmation` is set to `null` only on the "NO" button press (`MainWindow_ConfirmDataPROExit_NO`). If the user closes via other means after the dialog is shown, the state may persist unexpectedly. FB8914 reference in comments indicates this was a bug fix.
4. **DAS Factory Polling**: `TakeDASOwnership` runs on a thread pool thread with a 50ms sleep loop until DAS factory becomes available. This polling continues indefinitely until `_ShuttingDown` is signaled or DAS becomes available.
5. **Full-Screen State Management**: `CheckCloseFullScreen()` is called before navigation operations but relies on `IFullScreenCapable.GoSmallScreen()` being implemented correctly by the fullscreen object.
6. **Key Event Synchronization**: `MainWindow_KeyDown` may be called from `MainWindow_KeyUp` if the key state dictionary indicates a missed down event. This compensates for intercepted key events but may cause unexpected behavior.
7. **Magic Numbers**: `DAS_FACTORY_UNAVAIL_USER_CLOSE = 0x01` is used as an exit code but not documented elsewhere. Similarly, `SW_MAXIMIZE = 3` and `SW_RESTORE = 9` are Win32 constants.
8. **Unused Code**: The `Window_Closed` event handler contains `int j = 10/i;` which appears to be debug/test code that should not be in production.
9. **TSRAIRGo Conditional Behavior**: Multiple methods check `RunTestVariables.IsTSRAIRGo` to alter behavior (title format, exit message, keyboard handling). This suggests the codebase supports two product variants from a single codebase.
10. **Modal Content Reuse**: The comment "15378 Export Data page unusable" indicates modal content can be reused and strings/buttons must be stored for deferred display, explaining the parallel list structures for modal content.

View File

@@ -0,0 +1,56 @@
---
source_files:
- DataPRO/DataPRO/ViewModel/ShellViewModel.cs
- DataPRO/DataPRO/ViewModel/MainViewModel.cs
generated_at: "2026-04-17T15:56:21.240424+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "e4cc6219bacb7e71"
---
# Documentation: ShellViewModel and MainViewModel
## 1. Purpose
**ShellViewModel** serves as the root view model for the application shell, managing the main window's regions, busy state, and notification handling. It acts as the primary container coordinating UI regions and event-driven communication between components.
**MainViewModel** serves as a secondary-level view model for the main content area, managing multiple specialized regions (graphs, tests, legend, diagnostics, stats, cursor, property) and coordinating with its parent `IShellViewModel` for menu and navigation visibility. Both classes participate in a Prism-based MVVM architecture with MEF/Unity dependency injection.
---
## 2. Public Interface
### ShellViewModel
| Member | Signature | Description |
|--------|-----------|-------------|
| `View` | `public IShellView View { get; private set; }` | Gets the associated shell view instance. |
| `NotificationRequest` | `public InteractionRequest<Notification> NotificationRequest { get; private set; }` | Interaction request for displaying notifications. |
| `ConfirmationRequest` | `public InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }` | Interaction request for displaying confirmations. |
| `IsBusy` | `public bool IsBusy { get; set; }` | Controls the busy indicator state. Raises `PropertyChanged` on set. |
| `IsMenuIncluded` | `public bool IsMenuIncluded { get; set; }` | Controls menu visibility. Raises `PropertyChanged` on set. |
| `IsNavigationIncluded` | `public bool IsNavigationIncluded { get; set; }` | Controls navigation panel visibility. Raises `PropertyChanged` on set. |
| `IsDirty` | `public bool IsDirty { get; private set; }` | Indicates whether the view model has unsaved changes. |
| `HeaderInfo` | `public string HeaderInfo => "MainRegion"` | Returns the constant string "MainRegion". |
| `ContextMainRegion` | `public object ContextMainRegion { get; set; }` | Gets/sets the content of the MainRegion. Raises `PropertyChanged` on set. |
| `ContextMenuRegion` | `public object ContextMenuRegion { get; set; }` | Gets/sets the menu region content. |
| `ContextNavigationRegion` | `public object ContextNavigationRegion { get; set; }` | Gets/sets the navigation region content. |
| `GetRegions` | `public List<FrameworkElement> GetRegions()` | Returns all elements named "Region" within the MainShell using `Utils.GetChildrenByName`. |
| `Cleanup` | `public void Cleanup()` | Empty implementation. |
| `CleanupAsync` | `public Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `Initialize` | `public void Initialize()` | Empty implementation. |
| `Initialize(object)` | `public void Initialize(object parameter)` | Empty implementation. |
| `InitializeAsync` | `public Task InitializeAsync()` | Returns `Task.CompletedTask`. |
| `InitializeAsync(object)` | `public Task InitializeAsync(object parameter)` | Returns `Task.CompletedTask`. |
| `Activated` | `public void Activated()` | Empty implementation. |
| `PropertyChanged` | `public new event PropertyChangedEventHandler PropertyChanged` | Property changed event (hides base event). |
**Constructor:** `ShellViewModel(IShellView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`
---
### MainViewModel
| Member | Signature | Description |
|--------|-----------|-------------|
|

View File

@@ -0,0 +1,160 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/DataPRO_Content.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/DataPRO_Content.g.cs
- DataPRO/DataPRO/obj/x86/Debug/GeneratedInternalTypeHelper.g.cs
- DataPRO/DataPRO/obj/x86/Debug/GeneratedInternalTypeHelper.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/App.g.cs
- DataPRO/DataPRO/obj/x86/Debug/App.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageNavControlsGroup.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageNavControlsGroup.g.cs
- DataPRO/DataPRO/obj/x86/Debug/PageActionControlsGroup.g.cs
- DataPRO/DataPRO/obj/x86/Debug/PageActionControlsGroup.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageActionControlsRibbon.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageActionControlsRibbon.g.cs
- DataPRO/DataPRO/obj/x86/Debug/PageHeaderRibbon.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageHeaderRibbon.g.cs
- DataPRO/DataPRO/obj/x86/Debug/PageMainContentControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/PageMainContentControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageContentControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/PageContentControl.g.cs
generated_at: "2026-04-17T15:43:25.008518+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "1dad05ee11bf278c"
---
# Documentation: DataPRO WPF Auto-Generated Build Output
## 1. Purpose
This module consists of auto-generated code files produced by the WPF build process (PresentationBuildTasks) during compilation. These files reside in the `obj/x86/Debug` directory and provide the generated code-behind for XAML files, including the application entry point, UI component initialization, event handler wire-up, and internal type helpers for XAML parsing. They bridge the declarative XAML markup with runtime-executable C# code, enabling the DataPRO WPF application to load, parse, and instantiate its user interface components.
---
## 2. Public Interface
### Application Entry Point
**`DataPROWin7.App`** (partial class, extends `System.Windows.Application`)
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent` | `public void InitializeComponent()` | Initializes XAML component loading; wires up `Application_Startup` to `Startup` event and `Windows_SessionEnding` to `SessionEnding` event. Guards against double initialization via `_contentLoaded` flag. |
| `Main` | `public static void Main()` | Application entry point marked with `[STAThread]`. Creates `App` instance, calls `InitializeComponent()`, then invokes `Run()`. |
### Internal Type Helper (XAML Infrastructure)
**`XamlGeneratedNamespace.GeneratedInternalTypeHelper`** (sealed class, extends `System.Windows.Markup.InternalTypeHelper`)
| Member | Signature | Description |
|--------|-----------|-------------|
| `CreateInstance` | `protected override object CreateInstance(System.Type type, System.Globalization.CultureInfo culture)` | Creates an instance of the specified type using reflection with `Public \| NonPublic \| Instance \| CreateInstance` binding flags. |
| `GetPropertyValue` | `protected override object GetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, System.Globalization.CultureInfo culture)` | Retrieves property value via `PropertyInfo.GetValue()`. |
| `SetPropertyValue` | `protected override void SetPropertyValue(System.Reflection.PropertyInfo propertyInfo, object target, object value, System.Globalization.CultureInfo culture)` | Sets property value via `PropertyInfo.SetValue()`. |
| `CreateDelegate` | `protected override System.Delegate CreateDelegate(System.Type delegateType, object target, string handler)` | Creates delegate by invoking `_CreateDelegate` method on target via reflection. |
| `AddEventHandler` | `protected override void AddEventHandler(System.Reflection.EventInfo eventInfo, object target, System.Delegate handler)` | Attaches event handler via `EventInfo.AddEventHandler()`. |
### UI Controls (Partial Classes)
**`DataPROWin7.PageNavControlsGroup`** (extends `UserControl`, implements `IComponentConnector`)
- `InitializeComponent()`: Loads `/DataPRO;component/pagenavcontrolsgroup.xaml`
- `navControlGrids`: Internal `System.Windows.Controls.Grid` field (line 14 of XAML)
**`DataPROWin7.PageActionControlsGroup`** (extends `UserControl`, implements `IComponentConnector`)
- `InitializeComponent()`: Loads `/DataPRO;component/pageactioncontrolsgroup.xaml`
- `actionControlGrids`: Internal `System.Windows.Controls.WrapPanel` field (line 10 of XAML)
**`DataPROWin7.PageActionControlsRibbon`** (extends `UserControl`, implements `IComponentConnector`)
- `InitializeComponent()`: Loads `/DataPRO;component/pageactioncontrolsribbon.xaml`
- `actionButtonGroupGrids`: Internal `System.Windows.Controls.WrapPanel` field (line 15 of XAML)
**`DataPROWin7.PageHeaderRibbon`** (extends `UserControl`, implements `IComponentConnector`)
- `InitializeComponent()`: Loads `/DataPRO;component/pageheaderribbon.xaml`
- `headerRibbon`: Internal `DataPROWin7.PageHeaderRibbon` field (self-reference, line 9 of XAML)
- Event: `btnChangeTestSetup_Click` wired to `Button.Click` (line 51 of XAML)
**`DataPROWin7.PageMainContentControl`** (extends `UserControl`, implements `IComponentConnector`)
- `InitializeComponent()`: Loads `/DataPRO;component/pagemaincontentcontrol.xaml`
- `mainContent`: Internal `DataPROWin7.PageMainContentControl` field (self-reference, line 8 of XAML)
- `contentControl`: Internal `System.Windows.Controls.ContentControl` field (line 9 of XAML)
**`DataPROWin7.PageContentControl`** (extends `UserControl`, implements `IComponentConnector`)
- `InitializeComponent()`: Loads `/DataPRO;component/pagecontentcontrol.xaml`
- `_CreateDelegate(System.Type delegateType, string handler)`: Internal method for delegate creation
- `NavControl`: Internal `DataPROWin7.PageNavControl` field (line 18 of XAML)
- `MainContentControl`: Internal `DataPROWin7.PageMainContentControl` field (line 19 of XAML)
- `ActionControlsRibbon`: Internal `DataPROWin7.PageActionControlsRibbon` field (line 20 of XAML)
### Assembly-Level Attributes
```csharp
[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("licensing/licenseproperty.tt")]
```
Declared in `DataPRO_Content.g.cs` and `DataPRO_Content.g.i.cs`, associating a license template file as embedded content.
---
## 3. Invariants
1. **Auto-Generation**: All files are marked with `// <auto-generated>` and `GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")`. Manual edits will be overwritten on rebuild.
2. **Single Initialization**: Each `InitializeComponent()` method guards against re-initialization using the `_contentLoaded` boolean flag. Once set to `true`, subsequent calls return immediately.
3. **STA Thread Requirement**: The `Main()` entry point is decorated with `[STAThreadAttribute()]`, requiring the application to run in a Single-Threaded Apartment COM threading model.
4. **Partial Class Contract**: All UI controls are `partial` classes. The companion partial class (in hand-written code-behind) must exist in the same namespace and provide any event handlers referenced in XAML (e.g., `Application_Startup`, `Windows_SessionEnding`, `btnChangeTestSetup_Click`).
5. **Resource URI Format**: All XAML resources are referenced using pack URIs in the format `/DataPRO;component/<filename>.xaml` with `UriKind.Relative`.
6. **IComponentConnector Implementation**: All generated UI controls implement `System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)` to wire named XAML elements to code-behind fields.
---
## 4. Dependencies
### External Dependencies (Referenced Namespaces)
- `System.Windows.*` (PresentationCore, PresentationFramework, WindowsBase)
- `System.Windows.Controls` / `System.Windows.Controls.Primitives`
- `System.Windows.Markup`
- `System.Windows.Media.*`
- `System.Windows.Navigation`
- `System.Windows.Shapes`
- `System.Windows.Shell`
- `System.Reflection`
- `System.Globalization`
- `System.Diagnostics`
- `System.CodeDom.Compiler`
- `System.ComponentModel`
### Internal Dependencies
- `DTS.Common.Converters` (referenced in `PageHeaderRibbon.g.cs` via `using` directive)
- `DataPROWin7` namespace (self-referential for control types)
### Content Dependencies
- `licensing/licenseproperty.tt` (T4 template file registered as assembly content)
### Control Composition Hierarchy
```
PageContentControl
├── PageNavControl (NavControl)
├── PageMainContentControl (MainContentControl)
│ └── ContentControl (contentControl)
└── PageActionControlsRibbon (ActionControlsRibbon)
```
---
## 5. Gotchas
1. **Do Not Edit**: These files are regenerated on every build. Any manual modifications will be lost. The corresponding source files are the `.xaml` files and their hand-written `.xaml.cs` code-behind files in the project.
2. **Duplicate File Pairs**: Each generated file exists in both `.g.cs` and `.g.i.cs` variants. The `.g.cs` files are generated during the build; `.g.i.cs` files are generated during IntelliSense preprocessing. Both contain identical content but serve different build phases.
3. **Self-Referencing Controls**: `PageHeaderRibbon` and `PageMainContentControl` contain internal fields referencing their own type (`headerRibbon` and `mainContent` respectively). This pattern suggests the XAML may have `x:Name` attributes on the root UserControl element.
4. **Missing Handler Implementations**: The generated code references event handlers (`Application_Startup`, `Windows_SessionEnding`, `btnChangeTestSetup_Click`) that must be implemented in the hand-written partial class. If missing, compilation will fail.
5. **Namespace Mismatch**: The project is named "DataPRO" but the namespace is `DataPROWin7`, suggesting possible legacy naming or Windows 7 compatibility considerations.
6. **Build Configuration Specific**: These files are in `obj/x86/Debug`, indicating an x86 platform target with Debug configuration. Different configurations will generate different output directories.

View File

@@ -0,0 +1,182 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/SensorLayout.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/SensorLayout.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/CheckHardware.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/CheckHardware.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/ArmCheckList.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/ArmCheckList.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Download.g.cs
generated_at: "2026-04-17T15:48:32.249567+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c854172d00e848de"
---
# Documentation: CollectDataSubControls (WPF Generated Partial Classes)
## 1. Purpose
This module contains auto-generated WPF partial classes for data collection sub-controls within the DataPRO application. These files (`.g.cs` and `.g.i.cs`) are produced by the WPF build system from XAML markup and establish the wire-up between XAML elements and code-behind. The controls appear to be part of a hardware configuration and data acquisition workflow, providing UI for sensor layout assignment, hardware verification, arm system checklists, and data download operations. Each control inherits from either `System.Windows.Controls.UserControl` or a custom `SubControl` base class.
---
## 2. Public Interface
### SensorLayout
**Namespace:** `DataPROWin7.SubControls`
**Base Class:** `System.Windows.Controls.UserControl`
**Interfaces:** `System.Windows.Markup.IComponentConnector`, `System.Windows.Markup.IStyleConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/sensorlayout.xaml`. Guards against double initialization via `_contentLoaded` flag. |
**Internal Fields (XAML-named elements):**
- `sensorBaseLayout` - `DataPROWin7.SubControls.SensorLayout` (self-reference at line 7 of XAML)
- `lvChannels` - `System.Windows.Controls.ListView` (line 39)
- `lvSensors` - `System.Windows.Controls.ListView` (line 72)
**Event Handlers (referenced but not defined in generated code):**
- `HardwareChannelList_SelectionChanged` - Attached to `lvChannels.SelectionChanged`
- `HardwareUnassign_Click` - Attached to Button Click (connectionId 3)
- `btnSensorAssign_Click` - Attached to Button Click (connectionId 5)
---
### CheckHardware
**Namespace:** `DataPROWin7.SubControls`
**Base Class:** `DataPROWin7.SubControls.SubControl`
**Interfaces:** `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/checkhardware.xaml`. |
| `_CreateDelegate` | `internal System.Delegate _CreateDelegate(System.Type delegateType, string handler)` | Creates a delegate bound to this instance for the specified handler method name. |
**Internal Fields:**
- `checkHardwarePage` - `DataPROWin7.SubControls.CheckHardware` (self-reference)
- `ctrlStatusRibbon` - `DataPROWin7.Controls.StatusRibbon` (line 36)
- `rbTreeMode` - `System.Windows.Controls.RadioButton` (line 56)
- `rbExcelMode` - `System.Windows.Controls.RadioButton` (line 58)
- `gridExcel` - `System.Windows.Controls.Grid` (line 60)
- `ctrlIncludedContent` - `System.Windows.Controls.ContentControl` (line 65)
- `ctrlAvailableContent` - `System.Windows.Controls.ContentControl` (line 66)
- `gridTreeDisplay` - `System.Windows.Controls.Grid` (line 69)
**Event Handlers:**
- `rbTreeMode_Checked` - Attached to `rbTreeMode.Checked`
- `rbTreeMode_Unchecked` - Attached to `rbTreeMode.Unchecked`
---
### ArmCheckList
**Namespace:** `DataPROWin7.SubControls`
**Base Class:** `DataPROWin7.SubControls.SubControl`
**Interfaces:** `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/armchecklist.xaml`. |
| `_CreateDelegate` | `internal System.Delegate _CreateDelegate(System.Type delegateType, string handler)` | Creates a delegate bound to this instance. |
**Internal Fields:**
- `armSystem` - `DataPROWin7.SubControls.ArmCheckList` (self-reference)
- `ctrlStatusRibbon` - `DataPROWin7.Controls.StatusRibbon` (line 44)
- `ctrlSensorIdContainer` - `System.Windows.Controls.ContentControl` (line 48)
- `ctrlDASVoltageContainer` - `System.Windows.Controls.ContentControl` (line 51)
- `ctrlSquibContainer` - `System.Windows.Controls.ContentControl` (line 54)
- `ctrlEventLineContainer` - `System.Windows.Controls.ContentControl` (line 57)
- `ctrlLevelTriggerContainer` - `System.Windows.Controls.ContentControl` (line 60)
- `ctrlTiltSensorContainer` - `System.Windows.Controls.ContentControl` (line 63)
- `ctrlTemperatureContainer` - `System.Windows.Controls.ContentControl` (line 66)
- `ctrlClockSyncContainer` - `System.Windows.Controls.ContentControl` (line 69)
---
### Download
**Namespace:** `DataPROWin7.SubControls`
**Base Class:** `DataPROWin7.SubControls.SubControl`
**Interfaces:** `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/download.xaml`. |
| `_CreateDelegate` | `internal System.Delegate _CreateDelegate(System.Type delegateType, string handler)` | Creates a delegate bound to this instance. |
**Internal Fields:**
- `downloadPage` - `DataPROWin7.SubControls.Download` (self-reference)
- `ctrlStatusRibbon` - `DataPROWin7.Controls.StatusRibbon` (line 37)
- `downloadContentControl` - `System.Windows.Controls.ContentControl` (line 38)
- `rbTreeMode` - `System.Windows.Controls.RadioButton` (line 61)
- `rbExcelMode` - `System.Windows.Controls.RadioButton` (line 63)
- `gridExcel` - `System.Windows.Controls.Grid` (line 65)
- `dgDiagnosticResultsContainer` - `System.Windows.Controls.ContentControl` (line 66)
- `dgDiagnosticResults` - `DataPROWin7.Controls.GenericTable2` (line 67)
- `gridTreeDisplay` - `System.Windows.Controls.Grid` (line 74)
- `TestObjects_Grid` - `System.Windows.Controls.Grid` (line 82)
- `lvAllTestObjects` - `System.Windows.Controls.ListView` (line 92)
- `DAS_Grid` - `System.Windows.Controls.Grid` (line 147)
- `lvHardware` - `System.Windows.Controls.ListView` (line 154)
**Event Handlers:**
- `rbTreeMode_Checked` / `rbTreeMode_Unchecked` - Attached to `rbTreeMode`
- `lvTestObjects_SelectionChanged` - Attached to `lvAllTestObjects.SelectionChanged`
- `lvHardware_SelectionChanged` - Attached to `lvHardware.SelectionChanged`
---
## 3. Invariants
1. **Single Initialization**: `InitializeComponent()` must only execute its loading logic once. The `_contentLoaded` flag ensures subsequent calls return early.
2. **XAML Resource Path Consistency**: Each control loads its XAML from a fixed relative URI (e.g., `/DataPRO;component/collectdatasubcontrols/sensorlayout.xaml`). The XAML file must exist at this location in the assembly resources.
3. **Connection ID Mapping**: The `Connect(int connectionId, object target)` methods use hardcoded switch cases to map XAML elements to code-behind fields. These IDs are generated by the build tool and must remain synchronized with the XAML.
4. **Inheritance Hierarchy**: `CheckHardware`, `ArmCheckList`, and `Download` all inherit from `DataPROWin7.SubControls.SubControl` (not directly from `UserControl`). `SensorLayout` inherits directly from `UserControl`.
5. **Internal Field Access**: All XAML-named elements are declared `internal` with `SuppressMessageAttribute` for the "AvoidUnusedPrivateFields" warning, indicating they are accessed via reflection or from partial class counterparts.
---
## 4. Dependencies
### External Dependencies (from imports):
- **System.Windows.*** - Core WPF namespaces (`Controls`, `Data`, `Input`, `Markup`, `Media`, `Navigation`, `Shapes`, `Shell`)
- **Xceed.Wpf.Toolkit** - Extended WPF Toolkit library (used by `SensorLayout` and `ArmCheckList`), including:
- `Xceed.Wpf.Toolkit.Chart`
- `Xceed.Wpf.Toolkit.PropertyGrid.*`
- `Xceed.Wpf.Toolkit.Zoombox`
- **DTS.Common.*** - Custom library providing:
- `DTS.Common.Controls`
- `DTS.Common.Converters`
- `DTS.Common.Enums`
### Internal Dependencies:
- `DataPROWin7` (root namespace)
- `DataPROWin7.Common`
- `DataPROWin7.Controls` (includes `StatusRibbon`, `GenericTable2`)
- `DataPROWin7.Controls.CustomUIElements`
- `DataPROWin7.Controls.DAS`
- `DataPROWin7.SubControls` (contains `SubControl` base class)
- `DataPROWin7.CollectDataSubControls.CheckHardware`
### What Depends on This Module:
**Unclear from source alone.** The generated files do not show consumers. The presence of `internal` fields suggests these controls are used within the same assembly, likely by a main window or navigation framework.
---
## 5. Gotchas
1. **Auto-Generated Code Warning**: These files are marked with the standard auto-generated comment: "Changes to this file may cause incorrect behavior and will be lost if the code is regenerated." Do not modify these files directly; edit the corresponding `.xaml` or `.xaml.cs` files instead.
2. **Duplicate File Pairs**: Each control has both a `.g.cs` and `.g.i.cs` file with identical content. This is a WPF build artifact—the `.g.i.cs` variant is typically used for IntelliSense. Both define the same partial class.
3. **Self-Referential Fields**: Each control contains a field referencing itself (e.g., `sensorBaseLayout` of type `SensorLayout` within `SensorLayout`). This is a XAML naming convention but may cause confusion when debugging.
4. **Missing Event Handler Implementations**: The generated code references event handlers (e.g., `HardwareChannelList_SelectionChanged`, `btnSensorAssign_Click`) that are not defined in these files. They must exist in the partial class counterpart (the `.xaml.cs` file), but this cannot be verified from the provided source.
5. **SuppressMessage Attributes**: Multiple FxCop suppressions are applied (`CA1823`, `CA1033`, `CA1502`, `CA1800`, `CA1811`). These indicate known code analysis violations that have been explicitly suppressed—potentially masking design issues.
6. **Tree/Excel Mode Pattern**: Both `CheckHardware` and `Download` controls implement a dual-view pattern with `rbTreeMode`/`rbExcelMode` radio buttons and corresponding `gridTreeDisplay`/`gridExcel` grids. The pattern is duplicated, suggesting a potential refactoring opportunity.

View File

@@ -0,0 +1,64 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Diagnostics/CanDiagnosticResult.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Diagnostics/CanDiagnosticResult.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Diagnostics/DigitalInputDiagnosticResult.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Diagnostics/DigitalInputDiagnosticResult.g.i.cs
generated_at: "2026-04-17T15:53:18.940799+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "41924aedbd932779"
---
# Documentation: CollectDataSubControls Diagnostics (Auto-Generated)
## 1. Purpose
This module contains auto-generated WPF code-behind partial classes for diagnostic result user controls. These files are build artifacts produced by the WPF build system (`PresentationBuildTasks`) from XAML source files located at `CollectDataSubControls/Diagnostics/`. They exist to connect XAML-defined UI elements to the code-behind, enabling the `InitializeComponent()` pattern used in WPF UserControls. The controls appear to be part of a data collection subsystem for displaying diagnostic results, specifically for CAN bus and digital input diagnostics.
## 2. Public Interface
### `CanDiagnosticResult`
- **Namespace**: `DataPROWin7.CollectDataSubControls`
- **Base Class**: `System.Windows.Controls.UserControl`
- **Interfaces**: `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/diagnostics/candiagnosticresult.xaml`. Guards against double initialization via `_contentLoaded` flag. |
| `Connect` | `void IComponentConnector.Connect(int connectionId, object target)` | Explicit interface implementation. Sets `_contentLoaded = true`. No named elements are connected in the generated code. |
### `DigitalInputDiagnosticResult`
- **Namespace**: `DataPROWin7.CollectDataSubControls`
- **Base Class**: `System.Windows.Controls.UserControl`
- **Interfaces**: `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/diagnostics/digitalinputdiagnosticresult.xaml`. Guards against double initialization. |
| `Connect` | `void IComponentConnector.Connect(int connectionId, object target)` | Explicit interface implementation. Sets `_contentLoaded = true`. No named elements are connected in the generated code. |
## 3. Invariants
- **Single Initialization**: `_contentLoaded` flag ensures `InitializeComponent()` is idempotent—calling it multiple times has no effect after the first call.
- **Resource URI Convention**: XAML resources follow the pack URI format `/DataPRO;component/collectdatasubcontrols/diagnostics/{controlname}.xaml` with `UriKind.Relative`.
- **Partial Class Pattern**: Both classes are declared `partial`, indicating a corresponding code-behind file (e.g., `CanDiagnosticResult.xaml.cs`) must exist with the complementary partial class definition.
- **Build Artifact Status**: These files are located in `obj/x86/Debug/`, indicating they are compiler-generated intermediates, not source files.
## 4. Dependencies
### External Dependencies (Imports)
- `DTS.Common.Converters` — Custom converter library (likely for data binding conversions)
- `DataPROWin7` — The main assembly namespace
- `System.Windows.*` — WPF framework namespaces including:
- `System.Windows.Controls` (UserControl base)
- `System.Windows.Markup` (IComponentConnector interface)
- `System.Windows.Navigation`, `System.Windows.Shapes`, etc.
- `System`, `System.Diagnostics` — Core .NET namespaces
### XAML Dependencies
- `CanDiagnosticResult.xaml` — Source XAML file (referenced via checksum and URI)
- `DigitalInputDiagnosticResult.xaml` — Source XAML file (referenced via checksum and URI)
### What Depends on This
- **Unclear from source alone** — The source files do not indicate which modules instantiate these controls. The namespace `CollectDataSub

View File

@@ -0,0 +1,101 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Realtime/MeterGraph.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Realtime/MeterGraph.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Realtime/GraphPlotInfo.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Realtime/GraphPlotInfo.g.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Realtime/MeterMode.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/Realtime/MeterMode.g.cs
generated_at: "2026-04-17T15:51:35.285114+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "755af425e3b46f7f"
---
# Documentation: CollectDataSubControls.Realtime (WPF Generated Partial Classes)
## 1. Purpose
This module contains auto-generated WPF code-behind partial classes for three UserControls within the `DataPROWin7.CollectDataSubControls` namespace: `MeterGraph`, `GraphPlotInfo`, and `MeterMode`. These controls appear to be part of a real-time data visualization subsystem, likely used for displaying meter readings and graph plots. The files are generated by the WPF build system (`PresentationBuildTasks`) from corresponding XAML files and provide the infrastructure for XAML-to-code binding via `IComponentConnector`.
---
## 2. Public Interface
### Class: `MeterGraph`
**Namespace:** `DataPROWin7.CollectDataSubControls`
**Inheritance:** `System.Windows.Controls.UserControl`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/realtime/metergraph.xaml`. Guards against multiple calls via `_contentLoaded` flag. |
| `ctrlGraph` | `internal MeterGraph` | Internal field referencing the control itself (self-referential binding from XAML line 7). |
| `Connect` | `void IComponentConnector.Connect(int connectionId, object target)` | Explicit interface implementation. Maps `connectionId` 1 to `ctrlGraph` field. |
---
### Class: `GraphPlotInfo`
**Namespace:** `DataPROWin7.CollectDataSubControls`
**Inheritance:** `System.Windows.Controls.UserControl`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/realtime/graphplotinfo.xaml`. |
| `ctrlGraphPlotInfo` | `internal GraphPlotInfo` | Internal self-referential field (from XAML line 9). |
| `ddlSelectedChannel` | `internal System.Windows.Controls.ComboBox` | Internal field for a ComboBox control (from XAML line 38). |
| `Connect` | `void IComponentConnector.Connect(int connectionId, object target)` | Maps `connectionId` 1 to `ctrlGraphPlotInfo`, `connectionId` 2 to `ddlSelectedChannel`. |
---
### Class: `MeterMode`
**Namespace:** `DataPROWin7.CollectDataSubControls`
**Inheritance:** `System.Windows.Controls.UserControl`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/collectdatasubcontrols/realtime/metermode.xaml`. |
| `mainChart` | `internal MeterGraph` | Internal field referencing a `MeterGraph` instance (from XAML line 15). |
| `SubGraphsGrid` | `internal System.Windows.Controls.Primitives.UniformGrid` | Internal field for a UniformGrid layout container (from XAML line 16). |
| `_CreateDelegate` | `internal System.Delegate _CreateDelegate(System.Type delegateType, string handler)` | Helper method for creating event handler delegates from XAML. |
| `Connect` | `void IComponentConnector.Connect(int connectionId, object target)` | Maps `connectionId` 1 to `mainChart`, `connectionId` 2 to `SubGraphsGrid`. |
---
## 3. Invariants
- **Single Initialization:** `InitializeComponent()` must only be called once per instance. Subsequent calls return immediately due to the `_contentLoaded` guard.
- **Generated Code Integrity:** These files are auto-generated. Manual modifications will be lost upon regeneration.
- **Partial Class Pattern:** Each class is `partial` and must be paired with a corresponding code-behind file (not shown here) that contains the actual business logic.
- **XAML Resource Path:** All resource URIs follow the pattern `/DataPRO;component/collectdatasubcontrols/realtime/{controlname}.xaml` with `UriKind.Relative`.
- **Thread Affinity:** As WPF controls, these must be created and accessed on the UI thread (standard WPF constraint).
---
## 4. Dependencies
### External Dependencies (from imports):
- `System.Windows` - Core WPF types
- `System.Windows.Controls` - UserControl, ComboBox
- `System.Windows.Controls.Primitives` - UniformGrid
- `System.Windows.Markup` - IComponentConnector interface
- `System.Windows.Shapes`, `System.Windows.Media.*` - Graphics/visuals (imported but usage unclear from generated code alone)
### Internal Dependencies:
- `MeterMode` depends on `MeterGraph` (contains `mainChart` field of type `MeterGraph`)
- All controls are in namespace `DataPROWin7.CollectDataSubControls`
- `GraphPlotInfo` imports `DataPROWin7` root namespace (purpose unclear from generated code alone)
### Consumers:
- **Unclear from source alone.** These are sub-controls; the parent container(s) that instantiate them are not present in the provided files.
---
## 5. Gotchas
1. **These are generated files, not source files.** The actual implementation logic resides in companion `.xaml.cs` files (code-behind) which are not included here. Do not edit these `.g.cs` / `.g.i.cs` files directly.
2. **Self-referential fields:** Both `MeterGraph.ctrlGraph` and `GraphPlotInfo.ctrlGraphPlotInfo` reference their own type. This is unusual and suggests the XAML defines a nested or templated reference to the control within itself. The purpose is unclear from generated code alone.
3. **Duplicate file pairs:** The `.g.cs` and `.g.i.cs` variants appear identical in content. This is typical of WPF build outputs where `.g.i.cs` is used for IntelliSense and `.g.cs` for compilation, but the exact distinction is a build system implementation detail.
4. **Missing context:** The actual data visualization logic, event handlers, and public APIs are defined in the partial class counterparts (e.g., `MeterGraph.xaml.cs`) which are not provided. The behavior of these controls cannot be fully understood from generated code alone.

View File

@@ -0,0 +1,91 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/ResolveChannels/ResolveChannels.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/CollectDataSubControls/ResolveChannels/ResolveChannels.g.cs
generated_at: "2026-04-17T15:57:05.450580+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "838545b37fdb28f7"
---
# Documentation: ResolveChannels (Auto-Generated WPF Component)
## 1. Purpose
This file contains the auto-generated partial class for `ResolveChannels`, a WPF user control that appears to manage channel resolution workflows within a data collection system. The control provides UI for categorizing and filtering channels across multiple states (unresolved, resolved, extra IDs, out-of-place, and hardware channels). This is build-generated code from `ResolveChannels.xaml` and should not be edited directly; the actual business logic resides in a separate code-behind file not provided here.
---
## 2. Public Interface
### Class Declaration
```csharp
public partial class ResolveChannels : DataPROWin7.SubControls.SubControl, System.Windows.Markup.IComponentConnector
```
### Public Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent` | `public void InitializeComponent()` | Loads the XAML component resource. Idempotent—returns early if already called. |
### Internal Fields (XAML Element References)
| Field | Type | XAML Line | Purpose |
|-------|------|-----------|---------|
| `resolveChannels` | `DataPROWin7.SubControls.ResolveChannels` | 12 | Self-reference to the control instance |
| `ctrlStatusRibbon` | `DataPROWin7.Controls.StatusRibbon` | 45 | Status ribbon control |
| `ctrlUnResolvedContainer` | `System.Windows.Controls.ContentControl` | 61 | Container for unresolved channel items |
| `ctrlResolvedContainer` | `System.Windows.Controls.ContentControl` | 64 | Container for resolved channel items |
| `ctrlExtraIdsContiner` | `System.Windows.Controls.ContentControl` | 66 | Container for extra ID items |
| `ctrlOutOfPlaceContainer` | `System.Windows.Controls.ContentControl` | 68 | Container for out-of-place items |
| `rbAllChannels` | `System.Windows.Controls.RadioButton` | 83 | Filter: show all channels |
| `rbOpenChannels` | `System.Windows.Controls.RadioButton` | 84 | Filter: show open channels |
| `rbInUseChannels` | `System.Windows.Controls.RadioButton` | 85 | Filter: show in-use channels |
| `rbManuallyAssigned` | `System.Windows.Controls.RadioButton` | 86 | Filter: show manually assigned channels |
| `ctrlHardwareChannelsContainer` | `System.Windows.Controls.ContentControl` | 89 | Container for hardware channel items |
### Event Handlers (Referenced, Not Defined)
The following event handlers are wired to `Checked` events on RadioButtons but are **not defined in this generated file**:
- `rbAllChecked` — wired to `rbAllChannels.Checked`
- `rbOpenChecked` — wired to `rbOpenChannels.Checked`
- `rbInUseChecked` — wired to `rbInUseChannels.Checked`
- `rbManuallyAssignedChecked` — wired to `rbManuallyAssigned.Checked`
---
## 3. Invariants
- **Idempotent Initialization**: `InitializeComponent()` will only execute its logic once; subsequent calls return immediately due to the `_contentLoaded` flag check.
- **Fixed Resource URI**: The XAML resource is located at `/DataPRO;component/collectdatasubcontrols/resolvechannels/resolvechannels.xaml` (relative URI).
- **Connection ID Mapping**: The `IComponentConnector.Connect` method maps integer IDs 111 to specific named controls. This mapping is generated from XAML and must remain synchronized with the XAML file.
- **Inheritance**: `ResolveChannels` must always inherit from `DataPROWin7.SubControls.SubControl` as defined in the XAML.
---
## 4. Dependencies
### This Module Depends On
- `DataPROWin7` (root namespace)
- `DataPROWin7.Common`
- `DataPROWin7.Controls` (specifically `StatusRibbon`)
- `DataPROWin7.SubControls` (specifically `SubControl` base class)
- `System.Windows.*` (WPF framework: `System.Windows`, `System.Windows.Controls`, `System.Windows.Markup`, etc.)
### What Depends On This Module
- **Unclear from source alone** — the partial class suggests a code-behind file (`ResolveChannels.xaml.cs`) exists that completes the implementation, but it is not provided.
---
## 5. Gotchas
1. **Auto-Generated Code**: Both `.g.cs` and `.g.i.cs` files are build outputs from `PresentationBuildTasks`. Any manual edits will be overwritten on rebuild. The actual implementation is in the code-behind file.
2. **Typo in Field Name**: `ctrlExtraIdsContiner` is misspelled (should be `ctrlExtraIdsContainer`). This typo originates from the XAML `x:Name` attribute and will propagate throughout the codebase.
3. **Missing Code-Behind**: The event handlers (`rbAllChecked`, `rbOpenChecked`, `rbInUseChecked`, `rbManuallyAssignedChecked`) are referenced but not defined in these files. Their implementation resides in the partial class counterpart (`ResolveChannels.xaml.cs`), which was not provided.
4. **Duplicate Files**: The `.g.cs` and `.g.i.cs` files appear identical. In WPF builds, `.g.cs` is typically generated for regular builds while `.g.i.cs` is used for IntelliSense. Both should be treated as ephemeral build artifacts.
5. **Namespace Mismatch**: The project is named `DataPRO` but the namespace is `DataPROWin7`,

View File

@@ -0,0 +1,73 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/Common/ModalDialog.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Common/ModalDialog.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Common/ToastWindow.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Common/ToastWindow.g.i.cs
generated_at: "2026-04-17T15:38:49.571855+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ea81d41d12f224e0"
---
# Documentation: DataPROWin7.Common UI Components
## 1. Purpose
This module contains auto-generated WPF partial classes for two UI components in the `DataPROWin7.Common` namespace: `ModalDialog` (a modal dialog user control) and `ToastWindow` (a toast notification window). These files are generated by the WPF build process (`PresentationBuildTasks`) from their corresponding XAML files (`ModalDialog.xaml` and `ToastWindow.xaml`). They implement `IComponentConnector` to support XAML parsing and element connection at runtime. **Note: These are generated files; the actual business logic resides in separate code-behind files not provided here.**
---
## 2. Public Interface
### ModalDialog
**Type:** `public partial class ModalDialog : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/common/modaldialog.xaml`. Idempotent—returns immediately if `_contentLoaded` is already `true`. |
| `controlUser` | `internal System.Windows.Controls.UserControl` | Internal field referencing a `UserControl` element defined at line 25 of `ModalDialog.xaml`. |
### ToastWindow
**Type:** `public partial class ToastWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/common/toastwindow.xaml`. Idempotent—returns immediately if `_contentLoaded` is already `true`. |
| `ImageViewer` | `internal System.Windows.Controls.Image` | Internal field referencing an `Image` control defined at line 10 of `ToastWindow.xaml`. |
| `ImageText` | `internal System.Windows.Controls.TextBlock` | Internal field referencing a `TextBlock` control defined at line 11 of `ToastWindow.xaml`. |
| `Window_MouseUp` | Event handler (inferred) | Referenced in `Connect()` method; wired to the `MouseUp` event on the window (line 8 of `ToastWindow.xaml`). Implementation not present in generated code. |
---
## 3. Invariants
- **Idempotent Initialization:** `InitializeComponent()` will only execute its loading logic once per instance. Subsequent calls return immediately due to the `_contentLoaded` guard.
- **Partial Class Contract:** Both classes are `partial`, meaning a companion code-behind file (e.g., `ModalDialog.xaml.cs`) must exist providing additional implementation not visible in these generated files.
- **XAML Resource Path:** The XAML resources must exist at the specified pack URIs (`/DataPRO;component/common/modaldialog.xaml` and `/DataPRO;component/common/toastwindow.xaml`) within the `DataPRO` assembly.
- **Connection IDs:** The `Connect` method uses integer IDs to map XAML elements; `ModalDialog` uses ID 1 for `controlUser`; `ToastWindow` uses IDs 1 (window itself), 2 (`ImageViewer`), and 3 (`ImageText`).
---
## 4. Dependencies
### Direct Dependencies (from `using` statements)
- `System.Windows.*` namespaces (WPF framework): `System.Windows`, `System.Windows.Controls`, `System.Windows.Input`, `System.Windows.Markup`, `System.Windows.Media`, `System.Windows.Shapes`, etc.
- `System` (core .NET)
- `System.Diagnostics`, `System.CodeDom.Compiler`, `System.ComponentModel` (for attributes)
### Inferred Dependencies
- **XAML Files:** `ModalDialog.xaml` and `ToastWindow.xaml` (source for generation)
- **Code-Behind Files:** Not provided, but required to complete the partial class definitions
- **DataPRO Assembly:** The generated code expects to be compiled into or reference the `DataPRO` assembly
### Consumers
- Unknown from these generated files alone. Other parts of the `DataPROWin7.Common` namespace or broader `DataPRO` application likely instantiate these components.
---
## 5. Gotchas
1. **Auto-Generated Code:** These files are marked

View File

@@ -0,0 +1,159 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/Controls/ViewGraphViewControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/ViewGraphViewControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/StatusRibbon.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/StatusRibbon.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/EditChannelCodesControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/EditChannelCodesControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/GridFullScreen.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/GridFullScreen.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/RealtimeFullScreen.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/RealtimeFullScreen.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/RenameTestControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/RenameTestControl.g.i.cs
generated_at: "2026-04-17T15:46:05.885549+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "ecfbb32851257e06"
---
# Documentation: WPF Auto-Generated Controls
## 1. Purpose
This module consists of **auto-generated WPF code-behind files** produced by the PresentationBuildTasks tool during the build process. These files serve as the compiled bridge between XAML markup definitions and .NET partial classes, implementing `System.Windows.Markup.IComponentConnector` to enable runtime XAML parsing, element naming, and event wiring. They are generated from corresponding XAML files in the `DataPRO` project and should not be manually edited.
---
## 2. Public Interface
### ViewGraphViewControl
**Namespace:** `DataPROWin7.SubControls`
**Base Class:** `DataPROWin7.SubControls.SubControl`
| Member | Type | Description |
|--------|------|-------------|
| `InitializeComponent()` | `void` | Loads the XAML resource from `/DataPRO;component/controls/viewgraphviewcontrol.xaml`. Guards against double-loading via `_contentLoaded` flag. |
| `viewGraphViewControl` | `internal ViewGraphViewControl` | Self-reference field populated during XAML connection (line 10 of XAML). |
---
### StatusRibbon
**Namespace:** `DataPROWin7.Controls`
**Base Class:** `System.Windows.Controls.UserControl`
| Member | Type | Description |
|--------|------|-------------|
| `InitializeComponent()` | `void` | Loads the XAML resource from `/DataPRO;component/controls/statusribbon.xaml`. |
| `statusRibbon` | `internal StatusRibbon` | Self-reference field (line 10 of XAML). |
| `lblAggregateStatusText` | `internal System.Windows.Controls.TextBlock` | Named TextBlock element (line 53 of XAML). |
---
### EditChannelCodesControl
**Namespace:** `DataPROWin7.Controls`
**Base Class:** `System.Windows.Controls.UserControl`
| Member | Type | Description |
|--------|------|-------------|
| `InitializeComponent()` | `void` | Loads the XAML resource from `/DataPRO;component/controls/editchannelcodescontrol.xaml`. |
| `editChannelCodes` | `internal EditChannelCodesControl` | Self-reference field (line 9 of XAML). |
| `contentControl` | `internal System.Windows.Controls.ContentControl` | Named ContentControl element (line 17 of XAML). |
---
### GridFullScreen
**Namespace:** `DataPROWin7.Controls`
**Base Class:** `System.Windows.Controls.UserControl`
| Member | Type | Description |
|--------|------|-------------|
| `InitializeComponent()` | `void` | Loads the XAML resource from `/DataPRO;component/controls/gridfullscreen.xaml`. |
| `fullScreenRealtime` | `internal GridFullScreen` | Self-reference field (line 10 of XAML). |
| `CloseButton` | `internal System.Windows.Controls.Button` | Named Button element (line 19 of XAML). Wires `Click` event to `closeButton_Click` handler. |
---
### RealtimeFullScreen
**Namespace:** `DataPROWin7.Controls`
**Base Class:** `System.Windows.Controls.UserControl`
| Member | Type | Description |
|--------|------|-------------|
| `InitializeComponent()` | `void` | Loads the XAML resource from `/DataPRO;component/controls/realtimefullscreen.xaml`. |
| `fullScreenRealtime` | `internal RealtimeFullScreen` | Self-reference field (line 10 of XAML). |
| `backButton` | `internal System.Windows.Controls.Button` | Named Button (line 52 of XAML). Wires `Click` to `backButton_Click`. |
| `nextButton` | `internal System.Windows.Controls.Button` | Named Button (line 59 of XAML). Wires `Click` to `nextButton_Click`. |
| `CloseButton` | `internal System.Windows.Controls.Button` | Named Button (line 66 of XAML). Wires `Click` to `closeButton_Click`. |
---
### RenameTestControl
**Namespace:** `DataPROWin7.Controls`
**Base Class:** `System.Windows.Controls.UserControl`
| Member | Type | Description |
|--------|------|-------------|
| `InitializeComponent()` | `void` | Loads the XAML resource from `/DataPRO;component/controls/renametestcontrol.xaml`. |
| `_CreateDelegate(Type, string)` | `internal System.Delegate` | Helper method for creating event delegates from handler names. |
| `renameTestControl` | `internal RenameTestControl` | Self-reference field (line 10 of XAML). |
| `ctrlStatusRibbon` | `internal StatusRibbon` | Embedded StatusRibbon control (line 33 of XAML). |
| `tbTestSetupName` | `internal System.Windows.Controls.TextBox` | Named TextBox (line 36 of XAML). |
| `tbTestId` | `internal System.Windows.Controls.TextBox` | Named TextBox (line 39 of XAML). |
| `btnRename` | `internal System.Windows.Controls.Button` | Named Button (line 42 of XAML). Wires `Click` to `btnRename_Click`. |
---
## 3. Invariants
1. **Single Initialization Guarantee**: `InitializeComponent()` must only load the XAML once. The `_contentLoaded` boolean flag ensures subsequent calls return early without reloading.
2. **Connection ID Uniqueness**: Each named XAML element is assigned a unique `connectionId` integer. The `Connect()` method uses a switch statement to map IDs to field assignments.
3. **Event Handler Existence**: Event handlers referenced in XAML (e.g., `closeButton_Click`, `backButton_Click`, `nextButton_Click`, `btnRename_Click`) must be defined in the companion code-behind partial class (the `.xaml.cs` file, not shown here).
4. **Resource URI Format**: All XAML resources follow the pack URI pattern `/DataPRO;component/controls/{controlname}.xaml` with `UriKind.Relative`.
5. **Partial Class Contract**: These generated files are `partial` classes; the developer-authored code-behind files must complete the class definition with business logic and event handlers.
---
## 4. Dependencies
### External Framework Dependencies
- `System.Windows` (WPF core)
- `System.Windows.Controls`
- `System.Windows.Controls.Primitives`
- `System.Windows.Data`
- `System.Windows.Markup` (for `IComponentConnector`)
- `System.Windows.Media.*` (animation, effects, imaging, etc.)
- `System.Windows.Navigation`
- `System.Windows.Shapes`
- `System.Windows.Shell`
### Third-Party Dependencies (RenameTestControl only)
- `Xceed.Wpf.Toolkit` and numerous sub-namespaces (`Chart`, `Chromes`, `Core.Converters`, `Core.Input`, `Core.Media`, `Core.Utilities`, `Panels`, `Primitives`, `PropertyGrid.*`, `Zoombox`)
### Internal Dependencies
- `DataPROWin7` (root namespace)
- `DataPROWin7.Common` (referenced by StatusRibbon)
- `DataPROWin7.Controls` (controls reference each other)
- `DataPROWin7.SubControls` (contains ViewGraphViewControl and SubControl base)
- `DTS.Common.Converters` (referenced by EditChannelCodesControl)
---
## 5. Gotchas
1. **Auto-Generated Code**: These files are marked with `<auto-generated>` comments and will be **overwritten on rebuild**. Never edit these files directly; modify the corresponding `.xaml` or `.xaml.cs` files instead.
2. **Duplicate File Pairs**: Each control has both `.g.cs` and `.g.i.cs` variants in the provided source. These appear to be identical outputs from different build stages (`.g.i.cs` typically from XAML IntelliSense, `.g.cs` from compilation). The duplication is a build artifact.
3. **Missing Code-Behind Logic**: The actual event handler implementations (`closeButton_Click`, `backButton_Click`, `nextButton_Click`, `btnRename_Click`) are **not present** in these generated files. They must exist in the developer-authored partial class files (e.g., `GridFullScreen.xaml.cs`).
4. **Self-Reference Pattern**: Several controls contain an internal field referencing their own type (e.g., `viewGraphViewControl` of type `ViewGraphViewControl`). This is a XAML naming convention artifact—when the root element is named in XAML, it generates a self-referential field.
5. **Unused Field Warnings Suppressed**: All named element fields are decorated with `[SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]` because the fields are populated by the XAML parser but may not be explicitly used in code.
6. **ViewGraphViewControl Inheritance**: Unlike other controls which inherit from `UserControl`, `ViewGraphViewControl` inherits from `DataPROWin7.SubControls.SubControl`—a custom base class whose implementation is not provided in these sources.

View File

@@ -0,0 +1,135 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ActionLabel.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ActionLabel.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/NavStepActionButton.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/NavStepActionButton.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/PageButton.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/PageButton.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ActionButton.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ActionButton.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ActionRadioButton.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ActionRadioButton.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/combobox.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/combobox.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ModalUserPrompt.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ModalUserPrompt.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/CustomUIElements/ModalLicensePrompt.g.cs
generated_at: "2026-04-17T15:44:05.263885+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "95ce3483374b99aa"
---
# CustomUIElements Module Documentation
## 1. Purpose
This module contains auto-generated WPF partial classes for custom UI controls used throughout the DataPRO application. These files are compiler-generated from XAML definitions and provide the code-behind infrastructure for component initialization and event wiring. The controls represent reusable UI elements including various button types (`ActionButton`, `PageButton`, `NavStepActionButton`, `ActionRadioButton`), a label component (`ActionLabel`), modal dialogs (`ModalUserPrompt`, `ModalLicensePrompt`), and a styled ComboBox resource dictionary. They serve as the presentation layer building blocks for the application's navigation and user interaction flows.
## 2. Public Interface
### ActionLabel
- **Namespace:** `DataPROWin7.Controls`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/actionlabel.xaml`. Idempotent; returns early if already called.
- `internal ActionLabel thislabel` - Self-reference field bound at line 7 of the XAML.
### ActionButton
- **Namespace:** `DataPROWin7.Controls`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/actionbutton.xaml`.
- `internal ActionButton thisbutton` - Self-reference field.
- `internal System.Windows.Controls.Button theactualbutton` - Internal Button control.
- Event handler `Button_Click` is wired to `theactualbutton.Click` via `RoutedEventHandler`.
### PageButton
- **Namespace:** `DataPROWin7.Controls`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/pagebutton.xaml`.
- `internal PageButton thisbutton` - Self-reference field.
- `internal System.Windows.Controls.Button theactualbutton` - Internal Button control.
- Event handler `Button_Click` is wired to `theactualbutton.Click` via `RoutedEventHandler`.
### NavStepActionButton
- **Namespace:** `DataPROWin7.Controls.CustomUIElements`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/navstepactionbutton.xaml`.
- `internal NavStepActionButton actionButton` - Self-reference field.
- Event handler `actionButton_Click` is wired to an internal Button's `Click` event via `RoutedEventHandler`.
### ActionRadioButton
- **Namespace:** `DataPROWin7.Controls`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/actionradiobutton.xaml`.
- `internal ActionRadioButton thisbutton` - Self-reference field.
- `internal System.Windows.Controls.RadioButton theactualbutton` - Internal RadioButton control.
- Event handler `Button_Click` is wired to `theactualbutton.Click` via `RoutedEventHandler`.
### combobox
- **Namespace:** `DataPROWin7.Controls.CustomUIElements`
- **Base Class:** `System.Windows.ResourceDictionary`
- **Interfaces:** `IComponentConnector`, `IStyleConnector`
- **Members:**
- `void InitializeComponent()` - Loads the resource dictionary from `/DataPRO;component/controls/customuielements/combobox.xaml`.
- `void IStyleConnector.Connect(int connectionId, object target)` - Wires a `ToolTipEventHandler` to the `FrameworkElement.ToolTipOpeningEvent` for connectionId=1.
### ModalUserPrompt
- **Namespace:** `DataPROWin7.Controls`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/modaluserprompt.xaml`.
- `internal ModalUserPrompt myControl` - Self-reference field.
- `internal System.Windows.Controls.Grid ModalContent` - Container for modal content.
- `internal System.Windows.Controls.Grid buttonGrid` - Container for action buttons.
### ModalLicensePrompt
- **Namespace:** `DataPROWin7.Controls`
- **Base Class:** `System.Windows.Controls.UserControl`
- **Members:**
- `void InitializeComponent()` - Loads the XAML component from `/DataPRO;component/controls/customuielements/modallicenseprompt.xaml`.
- `internal ModalLicensePrompt myControl` - Self-reference field.
- `internal System.Windows.Controls.Grid ModalContent` - Container for modal content.
- `internal System.Windows.Controls.Grid buttonGrid` - Container for action buttons.
## 3. Invariants
- **Auto-generated nature:** All files are marked with `<auto-generated>` and carry the warning that manual changes will be lost upon regeneration. These files should never be edited directly.
- **Idempotent initialization:** `InitializeComponent()` methods check `_contentLoaded` flag and return early if already initialized, preventing double-initialization.
- **Partial class pattern:** All controls are `partial` classes; the actual business logic resides in companion `.xaml.cs` code-behind files (not provided in these sources).
- **Interface implementation:** All controls implement `System.Windows.Markup.IComponentConnector`; `combobox` additionally implements `IStyleConnector` for style-based event wiring.
- **Internal field visibility:** All named element references (`thisbutton`, `theactualbutton`, `ModalContent`, etc.) are marked `internal`, accessible within the assembly but not to external consumers.
## 4. Dependencies
### External Dependencies (from imports):
- `System.Windows.*` namespaces - Core WPF framework (PresentationFramework, PresentationCore)
- `System.Windows.Controls` - UserControl, Button, RadioButton, Grid
- `System.Windows.Markup` - IComponentConnector, IStyleConnector interfaces
### Internal Dependencies:
- `DataPROWin7` namespace - Referenced by `ModalUserPrompt` and `ModalLicensePrompt`
- `DataPROWin7.Common` namespace - Referenced by `ModalUserPrompt` and `ModalLicensePrompt`
### Resource Dependencies:
- All controls depend on their corresponding XAML files in `/DataPRO;component/controls/customuielements/`
### Consumers:
- Not determinable from these generated files alone; the actual usage would be in other views, windows, or user controls within the DataPRO assembly.
## 5. Gotchas
- **Do NOT modify these files:** These are compiler-generated artifacts in the `obj/x86/Debug` directory. Any modifications will be overwritten on the next build. The actual source files are the corresponding `.xaml` and `.xaml.cs` files in the `Controls/CustomUIElements/` source directory.
- **Duplicate generated files:** Both `.g.cs` and `.g.i.cs` variants exist with identical content. This is a WPF build artifact; the `.g.i.cs` files are typically used for IntelliSense support while `.g.cs` files are used for compilation.
- **Inconsistent namespace hierarchy:** Controls are split between `DataPROWin7.Controls` and `DataPROWin7.Controls.CustomUIElements` namespaces. `NavStepActionButton` and `combobox` are in the nested namespace while similar controls (`ActionButton`, `PageButton`) are in the parent namespace. The reason for this inconsistency is unclear from the generated code alone.
- **Self-referencing fields:** Controls like `ActionLabel`, `ActionButton`, `PageButton`, etc. contain internal fields that reference themselves (e.g., `thislabel`, `thisbutton`). This pattern suggests the XAML root element is named, but the purpose of this self-reference is unclear without the original XAML or code-behind.
- **Event handler implementations absent:** Event handlers referenced in `Connect()` methods (`Button_Click`, `actionButton_Click`, `ToolTipEventHandler`) are declared but not defined in these generated files. Their implementations must exist in the partial class companions (`.xaml.cs` files).

View File

@@ -0,0 +1,141 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/EditDASRecordControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/EditDASRecordControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/BuildTestSetupControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/BuildTestSetupControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/DataRecodersTileControl.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/DataRecodersTileControl.g.i.cs
generated_at: "2026-04-17T15:51:58.761323+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "831d905cea00d4b2"
---
# DAS Controls Documentation
## 1. Purpose
This module contains auto-generated WPF partial classes for three DAS (Data Acquisition System) user controls: `EditDASRecordControl`, `BuildTestSetupControl`, and `DataRecodersTileControl`. These files are generated by the WPF build process (`PresentationBuildTasks`) from XAML definitions and provide the `InitializeComponent()` method and named element references required for code-behind access. They exist to bridge XAML markup with .NET code, enabling strongly-typed access to UI elements defined in XAML.
**Note:** These are intermediate build artifacts located in `obj/x86/Debug`. The actual source definitions reside in the corresponding `.xaml` and `.xaml.cs` files under `Controls/DAS/`.
---
## 2. Public Interface
### EditDASRecordControl
**Namespace:** `DataPROWin7.Controls`
**Type:** `partial class EditDASRecordControl : UserControl, IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/das/editdasrecordcontrol.xaml`. Idempotent—returns early if `_contentLoaded` is `true`. |
**Internal Fields (XAML element references):**
- `editDASRecordControl``internal EditDASRecordControl` — Self-reference to the control instance (line 9 of XAML)
- `ViewContainer``internal ContentControl` — Container for dynamic view content (line 23 of XAML)
---
### BuildTestSetupControl
**Namespace:** `DataPROWin7.Controls`
**Type:** `partial class BuildTestSetupControl : UserControl, IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/das/buildtestsetupcontrol.xaml`. Idempotent. |
| `_CreateDelegate` | `internal Delegate _CreateDelegate(Type delegateType, string handler)` | Creates a delegate bound to this instance for the named handler method. |
**Internal Fields (XAML element references):**
- `buildTestSetupControl``internal BuildTestSetupControl` — Self-reference (line 11 of XAML)
- `ctrlStatusRibbon``internal StatusRibbon` — Status ribbon control (line 33 of XAML)
- `dgTestSetupSelector``internal DataGrid` — DataGrid for test setup selection (line 34 of XAML)
**Event Handlers (referenced in XAML):**
- `dgTestSetupSelector_Click``RoutedEventHandler` attached to `ButtonBase.ClickEvent` on `dgTestSetupSelector`
---
### DataRecodersTileControl
**Namespace:** `DataPROWin7.Controls.DAS`
**Type:** `partial class DataRecodersTileControl : UserControl, IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/das/datarecoderstilecontrol.xaml`. Idempotent. |
**Internal Fields (XAML element references):**
- `dataRecodersControl``internal DataRecodersTileControl` — Self-reference (line 11 of XAML)
- `rdOverdue``internal RowDefinition` — Row definition for overdue section (line 21 of XAML)
- `gridOverdue``internal Grid` — Grid container for overdue items (line 25 of XAML)
- `lblOverdue``internal Label` — Label for overdue section header (line 34 of XAML)
- `overdueCalibrations``internal ContentControl` — Container for overdue calibration content (line 36 of XAML)
- `rbShowModules``internal ToggleButton` — Toggle button for module visibility (line 45 of XAML)
- `lblDataRecoders``internal Label` — Label for data recorders section (line 53 of XAML)
- `ctrlAllHardware``internal ContentControl` — Container for all hardware content (line 54 of XAML)
**Event Handlers (referenced in XAML):**
- `rbShowModules_Clicked``RoutedEventHandler` attached to `Click` event on `rbShowModules`
---
## 3. Invariants
1. **Auto-generated code:** All files are marked with `<auto-generated>` and carry the `GeneratedCodeAttribute`. Manual edits will be lost on regeneration.
2. **Idempotent initialization:** `InitializeComponent()` checks `_contentLoaded` before executing; calling it multiple times has no additional effect after the first call.
3. **XAML-Code synchronization:** The `#line` directives and checksums bind these generated files to specific XAML source locations. The checksum algorithm identifier is `{8829d00f-11b8-4213-878b-770e8597ac16}` (SHA256).
4. **Connection IDs are stable:** The `Connect(int connectionId, object target)` method uses fixed integer IDs mapped to specific XAML elements. These IDs must remain consistent between the XAML and generated code.
5. **Partial class pattern:** All controls are `partial` classes; the code-behind file (`.xaml.cs`) provides the complementary partial definition with actual business logic.
---
## 4. Dependencies
### External Dependencies (from imports):
| Dependency | Usage |
|------------|-------|
| `DTS.Common.Behaviors` | Custom behaviors (EditDASRecordControl only) |
| `DTS.Common.Controls` | Custom controls including `StatusRibbon` |
| `Microsoft.Xaml.Behaviors` | Blend behaviors framework |
| `Microsoft.Xaml.Behaviors.*` | Core, Input, Layout, Media behavior sub-namespaces |
| `System.Windows.*` | WPF framework (Controls, Data, Input, Markup, Media, etc.) |
### Internal Dependencies:
| Namespace | Usage |
|-----------|-------|
| `DataPROWin7` | Root application namespace |
| `DataPROWin7.Common` | Common utilities (BuildTestSetupControl only) |
| `DataPROWin7.Controls` | Shared controls including `StatusRibbon` |
| `DataPROWin7.Controls.CustomUIElements` | Custom UI elements (BuildTestSetupControl only) |
| `DataPROWin7.Controls.DAS` | DAS-specific controls (DataRecodersTileControl) |
### Consumers:
**Unclear from source alone.** The controls are in the `DataPROWin7.Controls` namespace, suggesting consumption by main application windows or other views, but specific consumers are not visible in these generated files.
---
## 5. Gotchas
1. **These are build artifacts, not source files:** The actual implementation logic resides in the `.xaml.cs` code-behind files and `.xaml` markup files. Do not edit these `.g.cs` or `.g.i.cs` files directly.
2. **Duplicate file pairs:** Each control has both `.g.cs` and `.g.i.cs` variants with identical content. These are generated for different build contexts (e.g., design-time vs. compile-time).
3. **Typo in naming:** `DataRecodersTileControl` appears to have a typo ("Recoders" instead of "Recorders"). This is reflected in both the class name and the XAML filename (`datarecoderstilecontrol.xaml`). This typo may be intentional for backward compatibility or may need correction.
4. **Self-referencing fields:** Each control contains an internal field referencing itself (e.g., `editDASRecordControl` of type `EditDASRecordControl`). This pattern is unusual and may indicate XAML naming conventions where the root element has an `x:Name` attribute.
5. **Missing implementation details:** The actual event handler implementations (`dgTestSetupSelector_Click`, `rbShowModules_Clicked`) are not in these files—they must be defined in the code-behind partial classes. The business logic and data binding behavior cannot be determined from these generated files alone.

View File

@@ -0,0 +1,93 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/HardwareDiscovery/HardwareDiscoveryControl.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DAS/HardwareDiscovery/HardwareDiscoveryControl.g.cs
generated_at: "2026-04-17T15:57:21.253587+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "13fa7abbc49f1c3b"
---
# HardwareDiscoveryControl Documentation
## 1. Purpose
This module is an auto-generated WPF partial class for `HardwareDiscoveryControl`, a UserControl that provides a UI for discovering and managing Data Acquisition System (DAS) hardware devices. It appears to support multicast IP configuration, device filtering by type (TDAS, SLICE), and displays discovered devices alongside their associated sensors and channels. The control is part of the DataPRO application's DAS subsystem and is generated from the XAML file at `Controls/DAS/HardwareDiscovery/HardwareDiscoveryControl.xaml`.
## 2. Public Interface
### Class: `HardwareDiscoveryControl`
**Signature:** `public partial class HardwareDiscoveryControl : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector`
A WPF UserControl for hardware discovery operations. Implements `IComponentConnector` for XAML parsing integration.
#### Methods
| Method | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/das/hardwarediscovery/hardwarediscoverycontrol.xaml`. Guards against double-initialization via `_contentLoaded` flag. |
| `Connect` | `void IComponentConnector.Connect(int connectionId, object target)` | Internal method that wires XAML elements to code-behind fields and event handlers. Uses a switch on `connectionId` (1-21) to map elements. |
| `_CreateDelegate` | `internal System.Delegate _CreateDelegate(System.Type delegateType, string handler)` | Creates a delegate for the specified handler method name. |
#### Internal Fields (XAML Element References)
| Field | Type | XAML Line | Purpose |
|-------|------|-----------|---------|
| `hardwareDiscovery` | `DataPROWin7.Controls.HardwareDiscoveryControl` | 11 | Self-reference to the control |
| `ctrlStatusRibbon` | `DataPROWin7.Controls.StatusRibbon` | 51 | Status display ribbon |
| `rbMulticastIP` | `System.Windows.Controls.Primitives.ToggleButton` | 61 | Toggle for multicast IP mode |
| `rtbIPAddresses` | `System.Windows.Controls.RichTextBox` | 71 | IP address input/display |
| `columnDAS` | `System.Windows.Controls.ColumnDefinition` | 76 | Grid column for DAS section |
| `columnSplitter` | `System.Windows.Controls.ColumnDefinition` | 77 | Grid column for splitter |
| `columnSensors` | `System.Windows.Controls.ColumnDefinition` | 78 | Grid column for sensors section |
| `lblIncludedDAS` | `System.Windows.Controls.Label` | 88 | Label for included DAS devices |
| `rbShowModules` | `System.Windows.Controls.Primitives.ToggleButton` | 91 | Toggle to show modules view |
| `ctrlTableContainer` | `System.Windows.Controls.ContentControl` | 129 | Container for included devices table |
| `lblAvailableDAS` | `System.Windows.Controls.Label` | 130 | Label for available DAS devices |
| `rbIncludeConnected` | `System.Windows.Controls.Primitives.ToggleButton` | 141 | Toggle for including connected devices |
| `ctrlSeparator` | `System.Windows.Controls.Separator` | 143 | Visual separator |
| `rbTDASFilter` | `System.Windows.Controls.Primitives.ToggleButton` | 144 | Filter for TDAS devices |
| `rbSLICEFilter` | `System.Windows.Controls.Primitives.ToggleButton` | 145 | Filter for SLICE devices |
| `rbALLFilter` | `System.Windows.Controls.Primitives.ToggleButton` | 146 | Show all devices filter |
| `ctrlTableAvailableContainer` | `System.Windows.Controls.ContentControl` | 149 | Container for available devices table |
| `ctrlSensorsContainer` | `System.Windows.Controls.ContentControl` | 188 | Container for sensors display |
| `ctrlChannelsContainer` | `System.Windows.Controls.ContentControl` | 189 | Container for channels display |
#### Event Handlers (Referenced, Not Defined)
The following event handlers are wired in `Connect()` but their implementations reside in the non-generated code-behind file (not provided):
- `rbMulticastIP_Click` - Click handler for multicast IP toggle
- `btnAdd_Click` - Click handler for add button (line 72)
- `rbShowModules_Clicked` - Click handler for show modules toggle
- `btnIncludeSelected_Click` - Click handler for include selected button (line 142)
- `rbTDASFilter_Checked` - Checked handler for TDAS filter
- `rbSLICEFilter_Checked` - Checked handler for SLICE filter
- `rbAllFilter_Checked` - Checked handler for all devices filter
- `toggleButton_Unchecked` - Shared unchecked handler for filter toggles
## 3. Invariants
- **Auto-generated code**: These files are regenerated on each build; manual changes will be lost.
- **Single initialization**: `InitializeComponent()` is idempotent—calling it multiple times has no effect after the first call due to the `_contentLoaded` guard.
- **XAML resource existence**: The XAML resource at `/DataPRO;component/controls/das/hardwarediscovery/hardwarediscoverycontrol.xaml` must exist and be valid.
- **Connection ID range**: The `Connect()` method handles connection IDs 1-21; any unhandled ID falls through without error.
- **Partial class pattern**: The actual business logic resides in a separate partial class file (likely `HardwareDiscoveryControl.xaml.cs`) which is not provided here.
## 4. Dependencies
### This Module Depends On:
- `DTS.Common.Controls` - External control library
- `DataPROWin7` - Main application namespace
- `DataPROWin7.Controls` - Specifically `StatusRibbon` control
- `System.Windows.*` - WPF framework assemblies (Controls, Primitives, Markup, etc.)
### Consumers:
- Unknown from source alone. This control is instantiated somewhere in the DataPRO application, likely in a main window or navigation system.
## 5. Gotchas
- **Generated files only**: The provided files are auto-generated WPF code-behind. The actual implementation logic (event handlers, properties, business logic) resides in the developer-authored partial class file `HardwareDiscoveryControl.xaml.cs`, which is **not provided**. Understanding the control's behavior fully requires that file.
- **Filter toggle behavior unclear**: The filter toggles (`rbTDASFilter`, `rbSLICEFilter`, `rbALLFilter`) all share the same `toggleButton_Unchecked` handler but have distinct `_Checked` handlers. The mutual exclusivity logic (if any) is not visible in these generated files.
- **Self-referential field**: The `hardwareDiscovery` field holds a reference to the control itself (connectionId 1), which may be used for data binding or event routing purposes—reason unclear from generated code alone.
- **Naming inconsistency**: The filter handler is named `rbAllFilter_Checked` (lowercase "all") while the field is `rbALLFilter` (uppercase "ALL").

View File

@@ -0,0 +1,112 @@
---
source_files:
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataHDFExportOptions.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataHDFExportOptions.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataEmptyExportOptions.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataEmptyExportOptions.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataSimpleChapter10ExportOptions.g.i.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataSimpleChapter10ExportOptions.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataDiademExportOptions.g.cs
- DataPRO/DataPRO/obj/x86/Debug/Controls/DataExports/DataDiademExportOptions.g.i.cs
generated_at: "2026-04-17T15:48:26.586994+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "3af3ff2076de78d4"
---
# Documentation: Data Export Options Controls (Auto-Generated)
## 1. Purpose
This module contains auto-generated WPF code-behind files for data export configuration user controls within the `DataPROWin7.Controls` namespace. These files are generated by the WPF build system (`PresentationBuildTasks`) from XAML files located at `Controls/DataExports/`. They provide the partial class implementations that enable XAML markup compilation, including named element references and component connection logic. These controls appear to support multiple export formats: HDF, DIAdem, Chapter 10, and a placeholder/empty options control.
**Note:** These are build artifacts from the `obj/x86/Debug` directory, not source files. The actual implementation logic resides in the corresponding `.xaml` and `.xaml.cs` files, which are not included in this analysis.
---
## 2. Public Interface
### DataHDFExportOptions
**Inheritance:** `System.Windows.Controls.UserControl`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/dataexports/datahdfexportoptions.xaml`. Guards against double-initialization via `_contentLoaded` flag. |
| `exportOptions` | `internal DataPROWin7.Controls.DataHDFExportOptions` | Self-reference to the control instance, bound at connectionId 1. |
---
### DataEmptyExportOptions
**Inheritance:** `System.Windows.Controls.UserControl`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/dataexports/dataemptyexportoptions.xaml`. |
| `exportOptions` | `internal DataPROWin7.Controls.DataEmptyExportOptions` | Self-reference to the control instance, bound at connectionId 1. |
---
### DataSimpleChapter10ExportOptions
**Inheritance:** `DataPROWin7.Controls.DataExports.DataROIAwareBase`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/dataexports/datasimplechapter10exportoptions.xaml`. |
| `exportOptions` | `internal DataPROWin7.Controls.DataSimpleChapter10ExportOptions` | Self-reference, bound at connectionId 1. |
| `icRegionsOfInterest` | `internal System.Windows.Controls.ItemsControl` | ItemsControl for displaying regions of interest, bound at connectionId 2. |
| `ChannelSelectContent` | `internal System.Windows.Controls.ContentControl` | ContentControl for channel selection UI, bound at connectionId 3. |
| `icEvent` | `internal System.Windows.Controls.ItemsControl` | ItemsControl for event display, bound at connectionId 4. |
---
### DataDiademExportOptions
**Inheritance:** `System.Windows.Controls.UserControl`, `System.Windows.Markup.IComponentConnector`
| Member | Signature | Description |
|--------|-----------|-------------|
| `InitializeComponent()` | `public void InitializeComponent()` | Loads the XAML component from `/DataPRO;component/controls/dataexports/datadiademexportoptions.xaml`. |
| `exportOptions` | `internal DataPROWin7.Controls.DataDiademExportOptions` | Self-reference, bound at connectionId 1. |
| `cmbDiademChannelName200` | `internal System.Windows.Controls.ComboBox` | ComboBox for DIAdem channel name mapping (field 200). Wires `SelectionChanged` to `cmbDiademChannelName200_SelectionChanged` and `GotFocus` to `SelectAllText`. |
| `cmbDiademUserComment201` | `internal System.Windows.Controls.ComboBox` | ComboBox for DIAdem user comment mapping (field 201). Wires `SelectionChanged` to `cmbDiademUserComment201_SelectionChanged` and `GotFocus` to `SelectAllText`. |
| `cmbDiademReserved1_301` | `internal System.Windows.Controls.ComboBox` | ComboBox for DIAdem reserved field 1 (field 301). Wires `SelectionChanged` to `cmbDiademReserved1_301_SelectionChanged` and `GotFocus` to `SelectAllText`. |
| `cmbDiademReserved2_302` | `internal System.Windows.Controls.ComboBox` | ComboBox for DIAdem reserved field 2 (field 302). Wires `SelectionChanged` to `cmbDiademReserved2_302_SelectionChanged` and `GotFocus` to `SelectAllText`. |
---
## 3. Invariants
- **Single Initialization:** `InitializeComponent()` must only execute once per instance. The `_contentLoaded` flag enforces this; subsequent calls return immediately.
- **Partial Class Completion:** Each class is `partial` and requires a developer-authored companion file (`.xaml.cs`) to complete the type definition. This is not visible in the provided sources.
- **Connection Ordering:** The `Connect(int connectionId, object target)` method uses a switch statement that maps sequential connection IDs to named elements. The order is determined by the XAML compilation process.
- **Thread Affinity:** As WPF controls inheriting from `DispatcherObject`, these controls must be created and accessed on the same UI thread.
---
## 4. Dependencies
### External Dependencies (from `using` statements):
- **WPF Core:** `System.Windows`, `System.Windows.Controls`, `System.Windows.Markup`, `System.Windows.Data`, `System.Windows.Input`, `System.Windows.Media*`
- **DTS.Common.Converters** (referenced by `DataEmptyExportOptions`)
- **DTS.Common.Controls** (referenced by `DataDiademExportOptions`)
- **DataPROWin7.Controls.DataExports** (referenced by `DataEmptyExportOptions`, `DataSimpleChapter10ExportOptions`)
- **DataPROWin7.Controls.Settings** (referenced by `DataEmptyExportOptions`, `DataDiademExportOptions`)
### Inheritance Dependencies:
- `DataSimpleChapter10ExportOptions` extends `DataPROWin7.Controls.DataExports.DataROIAwareBase` — behavior of this base class is not visible in provided sources.
### Resource Dependencies:
- Each control loads its XAML via a pack URI (e.g., `/DataPRO;component/controls/dataexports/datahdfexportoptions.xaml`).
---
## 5. Gotchas
1. **Auto-Generated Files:** These files reside in `obj/x86/Debug/` and are regenerated on each build. Manual edits will be lost. The actual source code is in the corresponding `.xaml` and `.xaml.cs` files.
2. **Duplicate File Pairs:** Each control has both `.g.cs` and `.g.i.cs` variants with identical content. The `.g.i.cs` files are typically used for IntelliSense during design-time, while `.g.cs` is the actual compiled output.
3. **Missing Event Handlers:** `DataDiademExportOptions` references event handlers (`cmbDiademChannelName200_SelectionChanged`, `cmbDiademUserComment201_SelectionChanged`, `cmbDiademReserved1_301_SelectionChanged`, `cmbDiademReserved2_302_SelectionChanged`, `SelectAllText`) that are not defined in these generated files. They must exist in the partial class companion file.
4. **Self-Reference Pattern:** Each control has an `exportOptions` field that references itself. This pattern suggests the XAML uses `x:Name="exportOptions"` on the root element, which may be used for element-to-element binding within the XAML.
5. **DataROIAwareBase Unknown:** `DataSimpleChapter10ExportOptions` inherits from `DataROIAwareBase`, but the base class implementation is not provided. Its contract and behavior cannot be determined from these sources alone.

Some files were not shown because too many files have changed in this diff Show More