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,103 @@
---
source_files:
- DataPRO/Modules/TestSetups/CachedItemsList/CachedItemsListModule.cs
generated_at: "2026-04-16T04:49:30.522340+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "9857e307f8488ab7"
---
# CachedItemsList
## Documentation: `CachedItemsListModule`
---
### **Purpose**
The `CachedItemsListModule` is a Prism-based modular component responsible for registering the view and view model for the *Cached Items List* UI feature within the applications dependency injection container (Unity). It enables dynamic loading and integration of the `CachedItemsList` feature as a Prism module, exposing its UI components (`CachedItemsListView` and `CachedItemsListViewModel`) as singleton services via interface abstractions (`ICachedItemsListView`, `ICachedItemsListViewModel`). The module also contributes metadata (name, image, group, region) to the host applications module discovery and UI assembly system via custom assembly-level attributes.
---
### **Public Interface**
#### **Class: `CachedItemsListModule`**
- **Namespace**: `CachedItemsList`
- **Inherits**: `IModule` (Prism.Modularity)
- **Attributes**: `[Export(typeof(IModule))]`, `[Module(ModuleName = "CachedItemsListModule")]`
| Member | Signature | Description |
|--------|-----------|-------------|
| **Constructor** | `public CachedItemsListModule(IUnityContainer unityContainer)` | Initializes the module with the Unity container instance via DI. Stores reference for later registration. |
| **`Initialize()`** | `public void Initialize()` | Registers the view and view model types as singletons in the Unity container: <br>• `ICachedItemsListView``CachedItemsListView` <br>• `ICachedItemsListViewModel``CachedItemsListViewModel` |
| **`OnInitialized(IContainerProvider containerProvider)`** | `public void OnInitialized(IContainerProvider containerProvider)` | Currently empty. No initialization logic beyond registration. |
| **`RegisterTypes(IContainerRegistry containerRegistry)`** | `public void RegisterTypes(IContainerRegistry containerRegistry)` | Delegates to `Initialize()`. (Note: Uses `IContainerRegistry` from Prism, but internally calls `IUnityContainer`-based `Initialize()`; may indicate legacy or transitional DI usage.) |
#### **Attribute: `CachedItemsListModuleNameAttribute`**
- **Namespace**: `CachedItemsList`
- **Inherits**: `TextAttribute` (from `DTS.Common.Interface`)
- **Usage**: `[assembly: CachedItemsListModuleName]`
| Member | Signature | Description |
|--------|-----------|-------------|
| **Constructor** | `public CachedItemsListModuleNameAttribute(string s = null)` | Initializes with optional parameter (unused). |
| **`AssemblyName`** | `public override string AssemblyName { get; }` | Returns `"CachedItemsList"` (from `AssemblyNames.CachedItemsList.ToString()`). |
| **`GetAttributeType()`** | `public override Type GetAttributeType()` | Returns `typeof(TextAttribute)`. |
| **`GetAssemblyName()`** | `public override string GetAssemblyName()` | Returns `AssemblyName`. |
#### **Attribute: `CachedItemsListModuleImageAttribute`**
- **Namespace**: `CachedItemsList`
- **Inherits**: `ImageAttribute` (from `DTS.Common.Interface`)
- **Usage**: `[assembly: CachedItemsListModuleImageAttribute]`
| Member | Signature | Description |
|--------|-----------|-------------|
| **Constructor** | `public CachedItemsListModuleImageAttribute(string s = null)` | Initializes image and name by calling `AssemblyInfo.GetImage(...)`. |
| **`AssemblyImage`** | `public override BitmapImage AssemblyImage { get; }` | Returns a `BitmapImage` loaded via `AssemblyInfo.GetImage("CachedItemsList")`. |
| **`AssemblyName`** | `public override string AssemblyName { get; }` | Returns `"CachedItemsList"`. |
| **`AssemblyGroup`** | `public override string AssemblyGroup { get; }` | Returns `"Prepare"` (from `eAssemblyGroups.Prepare.ToString()`). |
| **`AssemblyRegion`** | `public override eAssemblyRegion AssemblyRegion { get; }` | Returns `eAssemblyRegion.CachedItemsListRegion`. |
| **`GetAttributeType()`** | `public override Type GetAttributeType()` | Returns `typeof(ImageAttribute)`. |
| **`GetAssemblyImage()` / `GetAssemblyName()` / `GetAssemblyGroup()` / `GetAssemblyRegion()`** | `public override ...` | Delegates to corresponding properties. |
---
### **Invariants**
- **Singleton Registration**: Both `ICachedItemsListView` and `ICachedItemsListViewModel` are registered as *singletons* in the Unity container during `Initialize()`. This implies only one instance of each will exist per application lifetime.
- **Module Name Consistency**: The modules registered name (`"CachedItemsListModule"`) and assembly metadata (`AssemblyNames.CachedItemsList.ToString()`) must match expected values by the host application for correct module loading and UI integration.
- **Region Mapping**: The `AssemblyRegion` is fixed to `eAssemblyRegion.CachedItemsListRegion`, indicating the module expects to be injected into a region of that name (e.g., via Prisms `RegionManager`).
- **Group Membership**: The module belongs to the `"Prepare"` group (`eAssemblyGroups.Prepare`), likely used for UI categorization (e.g., in a module selection screen).
---
### **Dependencies**
#### **Dependencies *of* this module**
- **Prism.Modularity**: Requires `IModule` interface for Prism module lifecycle.
- **Unity Container**: Uses `IUnityContainer` (via `Unity` namespace) for type registration.
- **DTS.Common & DTS.Common.Interface**: Relies on:
- `AssemblyNames.CachedItemsList` enum value.
- `AssemblyInfo.GetImage(...)` method for image loading.
- `eAssemblyGroups.Prepare` enum value.
- `eAssemblyRegion.CachedItemsListRegion` enum value.
- Base attribute types: `TextAttribute`, `ImageAttribute`.
- **WPF**: Uses `System.Windows.Media.Imaging.BitmapImage` (indicating this module targets WPF UI).
#### **Dependencies *on* this module**
- **Host Application**: The main application (not shown) must:
- Discover and load this module via Prism module catalog.
- Use `CachedItemsListRegion` for view injection.
- Rely on `AssemblyInfo.GetImage(...)` and `AssemblyNames` for UI rendering of module metadata.
---
### **Gotchas**
- **DI Container Mismatch**: `RegisterTypes` accepts `IContainerRegistry` (Prisms abstraction), but internally calls `Initialize()`, which uses `IUnityContainer`. This implies the module assumes Unity is the underlying container and may break if used with another DI container (e.g., DryIoc, Autofac) without adapter support.
- **Redundant `OnInitialized`**: The `OnInitialized` method is empty and unused. If future logic is added here, ensure it does not conflict with `Initialize()` (which runs earlier).
- **Hardcoded Assembly Name**: `"CachedItemsList"` is hardcoded in multiple places (e.g., `AssemblyNames.CachedItemsList.ToString()`). Renaming the assembly or enum value requires synchronized updates.
- **Image Loading Side Effects**: `AssemblyInfo.GetImage(...)` is called in the attribute constructor (during assembly load), which may cause runtime failures if the image resource is missing or path is incorrect—failures may occur before module initialization.
- **No View/ViewModel Initialization Logic**: The module only registers types; no view initialization (e.g., setting `DataContext`) occurs here. That responsibility likely resides in the host application or view-level Prism behaviors.
None identified beyond the above.

View File

@@ -0,0 +1,46 @@
---
source_files:
- DataPRO/Modules/TestSetups/CachedItemsList/Model/CachedItem.cs
generated_at: "2026-04-16T04:52:12.109191+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "13d6de34ad0e45b6"
---
# Model
## 1. Purpose
This module defines the `CachedItem` class, a concrete implementation of the `ICachedItem` interface, representing metadata for an item stored in a caching layer (likely associated with test setups). It encapsulates the items identity (`Name`, `ObjectType`), when it was cached (`CacheTime`), and the timestamp of its last modification in the underlying database (`DBTime`). Its role is to provide a consistent, immutable snapshot of cached item state for use in UI or business logic that needs to reason about cache freshness and database synchronization.
## 2. Public Interface
- **`CachedItem(string name, string objectType, DateTime cacheTime, DateTime dbTime)`**
Constructor. Initializes all properties. All parameters are required and stored as read-only values (via `private set` accessors).
- **`string Name { get; }`**
Read-only property. The logical name of the cached item (e.g., test setup name).
- **`string ObjectType { get; }`**
Read-only property. A string indicating the type of object being cached (e.g., `"TestSetup"`, `"Scenario"`).
- **`DateTime CacheTime { get; }`**
Read-only property. The timestamp when the item was last loaded into the cache.
- **`DateTime DBTime { get; }`**
Read-only property. The timestamp of the items last modification in the database. **Special semantics**: `DateTime.MinValue` indicates the item no longer exists in the database; any other value is the actual `LastModified` time from the database.
## 3. Invariants
- All properties are immutable after construction (`private set` ensures no external mutation).
- `DBTime == DateTime.MinValue` is a sentinel value meaning the item is *no longer present* in the database; all other `DBTime` values represent valid database timestamps.
- No validation is performed on input parameters (e.g., empty `Name` or `ObjectType` is allowed by the constructor).
- `CacheTime` and `DBTime` may be equal, but `CacheTime` is not guaranteed to be ≥ `DBTime` (no ordering invariant enforced).
## 4. Dependencies
- **Depends on**:
- `DTS.Common.Interface.TestSetups.CachedItemsList` (specifically, the `ICachedItem` interface).
- `System` (for `DateTime`).
- **Depended on by**:
- Any consumer of the `ICachedItem` interface (e.g., UI components, cache invalidation logic, comparison services) — inferred from the namespace `CachedItemsList.Model` and interface implementation.
- Likely used by modules in `TestSetups` or `CachedItemsList` layers (not visible in this file but implied by the namespace structure).
## 5. Gotchas
- **`DBTime == DateTime.MinValue` is a sentinel**, not a valid database timestamp. Misinterpreting this as a real modification time could lead to incorrect assumptions (e.g., treating it as a recent item).
- The class is fully immutable, but callers must be aware that `DBTime.MinValue` carries special meaning — this is documented only in XML comments, not enforced.
- No equality semantics (`Equals`, `GetHashCode`, or `IEquatable<T>`) are defined; reference equality is used by default.
- No validation on `Name` or `ObjectType` — empty strings or `null` are permitted, which may cause downstream issues if not handled.
- None identified beyond the above.

View File

@@ -0,0 +1,60 @@
---
source_files:
- DataPRO/Modules/TestSetups/CachedItemsList/Properties/Settings.Designer.cs
- DataPRO/Modules/TestSetups/CachedItemsList/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T04:52:03.197686+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "e21f27fa8a64140f"
---
# Properties
## Documentation Page: `CachedItemsList.Properties.Settings`
---
### 1. **Purpose**
This module defines the application settings infrastructure for the `CachedItemsList` module within the DataPRO system. It provides a strongly-typed, thread-safe singleton accessor (`Settings.Default`) for reading configuration values stored in the applications configuration file (e.g., `app.config` or `user.config`). As a generated class, its sole purpose is to expose typed access to user- or application-scoped settings defined elsewhere (e.g., in the Visual Studio designer or `.settings` file), enabling type-safe retrieval of configuration values at runtime.
---
### 2. **Public Interface**
The module exposes **one public static property**:
- **`Settings.Default`**
- **Type**: `CachedItemsList.Properties.Settings`
- **Signature**: `public static Settings Default { get; }`
- **Behavior**: Returns a thread-safe singleton instance of the `Settings` class. This instance wraps the underlying `ApplicationSettingsBase` and provides access to settings values (e.g., via indexer or property accessors, though none are defined in this file). The instance is synchronized using `ApplicationSettingsBase.Synchronized`, ensuring safe concurrent access.
> **Note**: No explicit settings properties (e.g., `string SomeSetting { get; set; }`) are declared in this file. They are expected to be auto-generated in the same partial class (likely in a `.Designer.cs` file not included here) and are not visible in the provided source.
---
### 3. **Invariants**
- The `Settings` class is a **singleton**; only one instance exists per AppDomain (via `defaultInstance`).
- The singleton instance is **thread-safe** due to wrapping with `ApplicationSettingsBase.Synchronized()`.
- The class is **sealed** and **internal**, preventing external inheritance or instantiation.
- The class inherits from `System.Configuration.ApplicationSettingsBase`, implying it adheres to .NETs standard settings lifecycle (e.g., loading from config files, per-user roaming/local scope, etc.).
---
### 4. **Dependencies**
- **Depends on**:
- `System.Configuration` (for `ApplicationSettingsBase`)
- `System.Runtime.CompilerServices` (for `CompilerGeneratedAttribute`)
- `System.CodeDom.Compiler` (for `GeneratedCodeAttribute`)
- **Used by**:
- Other modules in `CachedItemsList` (and potentially the broader `DataPRO` system) that require access to configuration values.
- The `CachedItemsList` assembly itself (via `CachedItemsList.Properties.Settings.Default`).
---
### 5. **Gotchas**
- **Auto-generated code**: This file is auto-generated by the Visual Studio Settings Designer. Manual edits will be overwritten on rebuild.
- **No settings defined here**: The provided snippet contains only the scaffolding for the settings class. Actual settings (names, types, default values) are not present and must be inferred from the corresponding `.settings` designer file or project configuration.
- **Thread-safety caveat**: While `Synchronized()` ensures thread-safe *access*, it does *not* guarantee atomicity of compound operations (e.g., read-modify-write).
- **Versioning**: Assembly version is hardcoded to `1.0.0.0` (per `AssemblyInfo.cs`), which may impact settings migration or version-specific configuration behavior if not handled explicitly.
- **COM visibility disabled**: `ComVisible(false)` means this assembly is not intended for COM interop; settings access is purely .NET-side.
> **None identified from source alone** beyond the above — further gotchas (e.g., specific setting names, default values, or runtime behavior) require inspection of the `.settings` designer file or config files.

View File

@@ -0,0 +1,55 @@
---
source_files:
- DataPRO/Modules/TestSetups/CachedItemsList/Resources/TranslateExtension.cs
- DataPRO/Modules/TestSetups/CachedItemsList/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T04:51:53.561882+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "f0403bd28120458d"
---
# Resources
## Documentation: `TranslateExtension` Markup Extension
### 1. Purpose
The `TranslateExtension` class provides a WPF markup extension to enable declarative localization of UI strings in XAML. It allows developers to bind localized text to UI elements by referencing a resource key (e.g., `{local:Translate CacheTime}`), retrieving the corresponding string from the strongly-typed `StringResources` class. This avoids hardcoding English strings in XAML and supports runtime culture switching via `StringResources.Culture`. It exists to centralize and standardize string localization within the `CachedItemsList` module.
### 2. Public Interface
- **`TranslateExtension(string key)`**
Constructor. Initializes the extension with the resource key (`_key`) to look up.
- *Parameter*: `key` (`string`) The resource key (e.g., `"CacheTime"`, `"Name"`). Must match a key in the `.resx` file.
- **`override object ProvideValue(IServiceProvider serviceProvider)`**
WPF markup extension entry point. Performs the resource lookup at runtime.
- *Behavior*:
- If `_key` is `null` or empty → returns `"#stringnotfound#"`.
- Otherwise, calls `StringResources.ResourceManager.GetString(_key)`.
- If a matching string is found → returns the localized string.
- If no match is found → returns `"#stringnotfound# " + _key` (e.g., `"#stringnotfound# UnknownKey"`).
### 3. Invariants
- `_key` is immutable after construction (stored in a `readonly` field).
- The returned value is always a `string` (enforced by `[MarkupExtensionReturnType(typeof(string))]`).
- Lookup is case-sensitive (relies on `ResourceManager.GetString`, which performs exact key matching).
- No fallback logic beyond the `"#stringnotfound#"` prefix; missing keys are *not* silently ignored.
- Thread-safety: `StringResources.ResourceManager` is thread-safe (uses double-checked locking internally), but `TranslateExtension` itself does not enforce thread-safety for concurrent `ProvideValue` calls—though WPF typically invokes it on the UI thread.
### 4. Dependencies
- **Depends on**:
- `System.Windows.Markup.MarkupExtension` (WPF framework)
- `CachedItemsList.Resources.StringResources` (strongly-typed resource class)
- `System.Resources.ResourceManager` (via `StringResources.ResourceManager`)
- **Used by**:
- XAML files in the `CachedItemsList` module (e.g., `*.xaml` pages referencing `{local:Translate ...}`).
- No direct programmatic usage in the provided source; usage is exclusively via XAML markup.
### 5. Gotchas
- **Hardcoded fallback**: The `"#stringnotfound#"` prefix is used verbatim for missing keys—this may cause UI clutter if keys are misspelled.
- **No null-safety for `serviceProvider`**: The `ProvideValue` method does not validate `serviceProvider` (though WPF always provides a valid instance during XAML parsing).
- **Culture switching requires manual update**: While `StringResources.Culture` can be set to switch languages, `TranslateExtension` does not auto-refresh when `Culture` changes; UI updates require re-evaluation (e.g., via property change notifications or re-rendering).
- **Key must match `.resx` keys exactly**: Typos in XAML (e.g., `{local:Translate Cache_Time}` vs. `"CacheTime"`) will trigger the fallback string.
- **No compile-time key validation**: XAML keys are strings; invalid keys are only caught at runtime (when `ProvideValue` executes).
- **Auto-generated resource class**: `StringResources.Designer.cs` is regenerated on build; manual edits will be lost. Resource keys must be managed in the `.resx` file.
- **No support for parameterized strings**: The extension only retrieves static strings; it does not handle `string.Format`-style placeholders (e.g., `"Hello {0}"`).

View File

@@ -0,0 +1,53 @@
---
source_files:
- DataPRO/Modules/TestSetups/CachedItemsList/View/CachedItemsListView.xaml.cs
generated_at: "2026-04-16T04:52:13.234420+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "24681a4fed640d41"
---
# View
### **Purpose**
This module provides the WPF UI view implementation for a cached items list component, serving as the visual representation layer in a test setup module. It implements the `ICachedItemsListListView` interface (from `DTS.Common.Interface.TestSetups.CachedItemsList`) and handles the XAML-defined UI (`CachedItemsListView.xaml`) for displaying a list of cached items—likely in a `ListView` with `GridView` columns—while delegating interaction logic (e.g., sorting, double-click handling) to its associated view model via the interface contract.
---
### **Public Interface**
The class `CachedItemsListView` is a partial class with no *active* public methods or properties defined in the provided source. All non-trivial logic is commented out. The only public member is the constructor:
- **`public CachedItemsListView()`**
Initializes the view by calling `InitializeComponent()`, which loads and wires up the XAML-defined UI elements. This is the standard WPF pattern for view initialization.
> **Note**: The commented-out methods (`ListViewHeader_Click`, `MouseDoubleClick`, `GetCurrentIndex`, `GetListViewItem`, `IsMouseOverTarget`) and the `GetPositionDelegate` delegate are *not* part of the active public interface. They appear to be legacy or incomplete implementations.
---
### **Invariants**
No explicit invariants are enforced or documented in the active code. However, as an implementation of `ICachedItemsListView`, the following *contractual* invariants are implied (but not verifiable from this file alone):
- The view must bind to a `DataContext` implementing `ICachedItemsListViewModel`.
- The view must render the items collection provided by the view model.
- UI state (e.g., selection, sorting indicators) must reflect changes propagated from the view model.
Since no validation, state checks, or ordering guarantees are present in the active code, no runtime invariants are enforced *here*.
---
### **Dependencies**
- **WPF Framework**: Uses `System.Windows.*` namespaces (`Window`, `Controls`, `Data`, `Media`).
- **Interface Contract**: Depends on `DTS.Common.Interface.TestSetups.CachedItemsList.ICachedItemsListView` (imported via `using`).
- **XAML File**: Implicitly depends on `CachedItemsListView.xaml` (not shown), which defines the UI structure (e.g., `ListView`, `GridView`).
- **View Model**: Implicitly expects a `DataContext` implementing `ICachedItemsListViewModel` (referenced in commented code), though this is not enforced at compile time.
**Depended upon by**: Likely the view model (`ICachedItemsListViewModel` implementation) and higher-level test setup modules that consume this view.
---
### **Gotchas**
- **Commented-out functionality**: Critical interaction handlers (header click sorting, double-click item selection) are commented out and non-functional. This may indicate incomplete implementation, technical debt, or intentional deprecation. Developers should verify if this behavior is handled elsewhere (e.g., in the view model or via XAML triggers).
- **No explicit error handling**: The constructor does not validate dependencies or state; failures in `InitializeComponent()` (e.g., missing XAML resources) will manifest as runtime exceptions.
- **Namespace quirk**: `// ReSharper disable CheckNamespace` suggests the namespace `CachedItemsList` is intentionally used instead of a fully qualified one (e.g., `DTS.Modules.TestSetups.CachedItemsList.View`), possibly for legacy or brevity reasons—ensure consistency with project conventions.
- **No documentation of XAML structure**: Without the `.xaml` file, the exact layout, binding paths, and control types (e.g., `ListView`, `GridViewColumn`) cannot be inferred, making it hard to assess data binding correctness.
> **None identified from source alone** beyond the above—no obvious logic errors or anti-patterns in active code.

View File

@@ -0,0 +1,153 @@
---
source_files:
- DataPRO/Modules/TestSetups/CachedItemsList/ViewModel/CachedItemsListViewModel.cs
generated_at: "2026-04-16T04:52:03.540484+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "cb6b20481dcc9200"
---
# ViewModel
### **Purpose**
The `CachedItemsListViewModel` class serves as the ViewModel for the `CachedItemsList` module, responsible for managing and exposing a list of items (sensors, hardware, and calibrations) that may be out of sync between the current test setup and the persistent database. It coordinates UI state (e.g., busy indicators, notifications), integrates with Prisms event aggregation and region management, and provides a foundation for detecting discrepancies (e.g., missing or modified items). Though the core logic for populating `CachedItems` is currently commented out, the class defines the structure and infrastructure needed to support cache validation and synchronization workflows.
---
### **Public Interface**
#### **Constructor**
```csharp
public CachedItemsListViewModel(
ICachedItemsListView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
```
Initializes the ViewModel, sets the `View` and its `DataContext`, registers event subscriptions for `RaiseNotification` and `BusyIndicatorChangeNotification`, and initializes `InteractionRequest` properties for UI notifications.
#### **Properties**
- `public ICachedItemsListView View { get; set; }`
Reference to the associated view. Set during construction.
- `public ICachedItem[] CachedItems { get; set; } = new ICachedItem[0];`
Array of cached items representing potential discrepancies. *Currently unpopulated in active code*.
- `public bool IsDirty => false;`
Always returns `false`; no dirty-state tracking logic is implemented.
- `public bool IsBusy { get; set; }`
Binds to UI busy indicator. Raises `PropertyChanged` on change.
- `public bool IsMenuIncluded { get; set; }`
Controls visibility of menu UI elements. Raises `PropertyChanged` on change.
- `public bool IsNavigationIncluded { get; set; }`
Controls visibility of navigation UI elements. Raises `PropertyChanged` on change.
- `public bool HasOutofDateCachedItems => CachedItems.Any();`
Indicates if any cached items exist (i.e., potential discrepancies). *Always `false` while `CachedItems` is empty*.
- `public bool HasMissingSensors { get; }`
Returns `true` if `CachedItems` contains at least one sensor item with `DBTime == DateTime.MinValue`. *Currently always `false`*.
#### **Methods**
- `public void Unset()`
Empty stub; no cleanup logic.
- `public void Cleanup()`
Empty stub; no cleanup logic.
- `public Task CleanupAsync()`
Returns `Task.CompletedTask`; no async cleanup.
- `public void Initialize()`
Empty stub.
- `public void Initialize(object parameter)`
Empty stub.
- `public void Initialize(object parameter, object model)`
Empty stub.
- `public Task InitializeAsync()`
Returns `Task.CompletedTask`.
- `public Task InitializeAsync(object parameter)`
Returns `Task.CompletedTask`.
- `public void Activated()`
Empty stub.
- `public bool SetCachedItems(ISensorData[] sensors, ISensorCalibration[] sensorCalibrations, IDASHardware[] hardware, IDASHardware[] allDAS)`
*Currently returns `false` immediately.*
Intended to compare in-memory sensor/hardware/calibration data against database records and populate `CachedItems` with discrepancies. Logic is commented out but includes:
- Grouping sensors by type (analog, squib, digital input/output).
- Filtering out test-specific digital outputs (via `IsTestSpecificDigitalOutput`).
- Detecting out-of-date or missing items by comparing `LastModified`/`CalibrationDate`/`ModifyDate`.
- Using `DbOperations` methods (e.g., `SensorsAnalogGet`, `SensorCalibrationsGet`) to fetch DB records.
- Returning `true` if any discrepancies were found.
#### **Event Handlers (Private)**
- `private void OnBusyIndicatorNotification(bool eventArg)`
Updates `IsBusy` based on event argument.
- `private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)`
Converts `NotificationContentEventArgs` to `Notification` and raises `NotificationRequest`.
#### **InteractionRequests**
- `public InteractionRequest<Notification> NotificationRequest { get; }`
Used to trigger notification popups.
- `public InteractionRequest<Confirmation> ConfirmationRequest { get; }`
Used to trigger confirmation dialogs.
#### **Event**
- `public event PropertyChangedEventHandler PropertyChanged;`
Implements `INotifyPropertyChanged`.
- `public void OnPropertyChanged(string propertyName)`
Raises `PropertyChanged` for the specified property.
---
### **Invariants**
- `CachedItems` is always a non-null array (default: empty).
- `IsBusy` is synchronized with the `BusyIndicatorChangeNotification` event.
- `IsTestSpecificDigitalOutput` uses the constant `TEST_SPECIFIC_DIGITAL_OUT = "TSD_"` to exclude test-specific digital outputs from cache validation.
- `HasMissingSensors` relies on `DBTime == DateTime.MinValue` and `ObjectType == Resources.StringResources.Sensor` to identify missing sensors.
- `CachedItems` is *not* populated in the current implementation (all `Initialize*`/`SetCachedItems` methods are no-ops or stubs).
---
### **Dependencies**
#### **Imports/References**
- `DTS.Common.Events` (e.g., `RaiseNotification`, `BusyIndicatorChangeNotification`)
- `DTS.Common.Interface.TestSetups.CachedItemsList` (e.g., `ICachedItemsListViewModel`, `ICachedItemsListView`, `ICachedItem`)
- `DTS.Common.Interface.DataRecorders` (e.g., `IDASHardware`)
- `DTS.Common.Interface.Sensors` (e.g., `ISensorData`, `ISensorCalibration`)
- `Prism.Events` (`IEventAggregator`)
- `Prism.Regions` (`IRegionManager`)
- `Unity` (`IUnityContainer`)
- `DTS.Common.Interactivity` (`InteractionRequest<T>`)
- `System.ComponentModel` (`INotifyPropertyChanged`)
#### **External Components Used**
- `DbOperations` (referenced in commented code, e.g., `DbOperations.SensorsAnalogGet`) — *not imported directly but assumed to be available at runtime*.
- `Resources.StringResources` (e.g., `Resources.StringResources.Sensor`) — *assumed static resource*.
#### **Depended Upon By**
- `ICachedItemsListView` (view) binds to this ViewModel.
- Other modules may publish `RaiseNotification` or `BusyIndicatorChangeNotification` events consumed by this ViewModel.
---
### **Gotchas**
- **Critical functionality is commented out**: The `SetCachedItems` method and all initialization logic are non-functional. The class currently does *not* populate `CachedItems` or detect discrepancies.
- **`IsDirty` is hardcoded to `false`**: No actual dirty-state tracking is implemented.
- **`DbOperations` is not imported**: The commented code references `DbOperations`, but no `using` or `using static` directive for it exists. Its availability at runtime is unverifiable from this file alone.
- **`Resources.StringResources` usage is implicit**: No `using` directive for the `Resources` namespace is present; its structure and members (e.g., `Sensor`, `Hardware`, `SensorCal`) are assumed.
- **`TEST_SPECIFIC_DIGITAL_OUT` prefix `"TSD_"` is hardcoded**: No configuration or external definition is provided for this value.
- **`CachedItems` is a public auto-property**: Direct mutation (e.g., `CachedItems = new ICachedItem[0]`) bypasses `OnPropertyChanged`, but the property is *not* raised when set (only `IsBusy`, `IsMenuIncluded`, `IsNavigationIncluded` raise `PropertyChanged`). This may cause UI binding issues if `CachedItems` is reassigned.
- **No disposal logic**: `Unset`, `Cleanup`, and `CleanupAsync` are empty; event subscriptions (e.g., `_eventAggregator`) are not unsubscribed, risking memory leaks.
- **`IsTestSpecificDigitalOutput` is static but uses instance constant**: The method is `static`, but `TEST_SPECIFIC_DIGITAL_OUT` is an instance field—though valid in C#, this is unusual and could be confusing.

View File

@@ -0,0 +1,69 @@
---
source_files:
- DataPRO/Modules/TestSetups/Diagnostics/DiagnosticsModule.cs
generated_at: "2026-04-16T04:49:11.269350+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "b958e3011c307915"
---
# Diagnostics
## Documentation: DiagnosticsModule
### 1. Purpose
The `DiagnosticsModule` is a Prism module responsible for initializing and registering the diagnostics view and view model within the applications dependency injection container (Unity). It enables the diagnostics functionality as a modular component in the system, integrating with the UI framework via Prisms module loading mechanism and Unity for dependency injection. The module also exposes metadata attributes (`DiagnosticsModuleNameAttribute`, `DiagnosticsModuleImageAttribute`) that provide identifying information (name, image, group, region) for the diagnostics module to be displayed in the main UI (e.g., a summary or navigation screen).
### 2. Public Interface
- **`DiagnosticsModule(IUnityContainer unityContainer)`**
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration.
- **`void Initialize()`**
Registers two interfaces to their concrete implementations as singleton types in the Unity container:
- `IDiagnosticsTreeView``DiagnosticsTreeView`
- `IDiagnosticsViewModel``DiagnosticsViewModel`
This method is called both directly from the constructor (via `RegisterTypes`) and explicitly during Prisms module initialization lifecycle.
- **`void OnInitialized(IContainerProvider containerProvider)`**
Empty implementation. No logic is executed during Prisms `OnInitialized` phase.
- **`void RegisterTypes(IContainerRegistry containerRegistry)`**
Delegates to `Initialize()`. Note: Although the parameter `containerRegistry` is of type `IContainerRegistry` (Prisms abstraction), the implementation uses the injected `IUnityContainer` instead—*not* the `containerRegistry* parameter.
- **`DiagnosticsModuleNameAttribute` class**
Assembly-level attribute. Provides the modules name (`AssemblyNames.Diagnostics.ToString()`) via its `AssemblyName` property. Inherits from `TextAttribute`.
- **`DiagnosticsModuleImageAttribute` class**
Assembly-level attribute. Provides metadata for UI presentation:
- `AssemblyImage`: `BitmapImage` loaded via `AssemblyInfo.GetImage(AssemblyNames.Diagnostics.ToString())`
- `AssemblyName`: Same as above
- `AssemblyGroup`: `eAssemblyGroups.Prepare.ToString()`
- `AssemblyRegion`: `eAssemblyRegion.DiagnosticsRegion`
Inherits from `ImageAttribute`.
### 3. Invariants
- The `DiagnosticsModule` must be loaded *after* the Unity container is available and *before* views/view models are resolved.
- `IDiagnosticsTreeView` and `IDiagnosticsViewModel` must be registered as singletons; no other lifetimes are specified.
- The `AssemblyNames.Diagnostics` and `eAssemblyGroups.Prepare` and `eAssemblyRegion.DiagnosticsRegion` constants must be defined elsewhere (not in this file); their values are assumed to be stable and non-null.
- The `AssemblyInfo.GetImage(...)` call must succeed for `DiagnosticsModuleImageAttribute` to initialize without exception; failure would cause a runtime error at attribute instantiation (e.g., during assembly load).
- The `Initialize()` method is idempotent *within the same container instance* (repeated calls re-register the same mappings), but Unity does not prevent duplicate registrations.
### 4. Dependencies
**Dependencies *of* this module:**
- `DTS.Common`, `DTS.Common.Interface`, `DTS.Common.Interface.TestSetups.Diagnostics` — likely contain shared contracts (`IDiagnosticsTreeView`, `IDiagnosticsViewModel`, `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`, `TextAttribute`, `ImageAttribute`).
- `Prism.Modularity` — for `IModule` interface.
- `Prism.Ioc` — for `IContainerRegistry`.
- `Unity` — for `IUnityContainer`.
- `System.Windows.Media.Imaging` — for `BitmapImage`.
**Dependencies *on* this module:**
- Any module or component that requires `IDiagnosticsTreeView` or `IDiagnosticsViewModel` (e.g., a view that consumes diagnostics data).
- The main shell/UI layer likely uses `DiagnosticsModuleNameAttribute` and `DiagnosticsModuleImageAttribute` to populate a module summary or navigation UI.
### 5. Gotchas
- **`RegisterTypes` ignores its parameter**: Despite accepting `IContainerRegistry containerRegistry`, the method calls `Initialize()`, which uses the *private `IUnityContainer` field* instead. This tightly couples the module to Unity and breaks Prisms container-agnostic design.
- **Attribute initialization side effects**: `DiagnosticsModuleImageAttribute` performs I/O (`AssemblyInfo.GetImage(...)`) in its constructor and property getters. This may cause delays or failures during assembly loading or reflection-based discovery.
- **No `OnInitialized` logic**: The `OnInitialized` method is empty, suggesting initialization logic was either removed or never implemented.
- **Redundant attribute properties**: `AssemblyName`, `AssemblyGroup`, etc., are computed in both the property getter *and* constructor, and stored in private fields — likely legacy or redundant.
- **Missing validation**: No checks for null `AssemblyNames.Diagnostics` or missing image resources; failures are silent or cause exceptions at runtime.
- **No tests or documentation for attribute usage**: Behavior of how/when these attributes are consumed (e.g., by a module discovery service) is not evident from this file.

View File

@@ -0,0 +1,49 @@
---
source_files:
- DataPRO/Modules/TestSetups/Diagnostics/Properties/Settings.Designer.cs
- DataPRO/Modules/TestSetups/Diagnostics/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T04:51:04.800084+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "a0502aa255ed79b1"
---
# Properties
## Documentation Page: Diagnostics Module Settings
### 1. Purpose
This module provides application-level settings infrastructure for the *Diagnostics* submodule within the TestSetups module of the DataPRO system. It exposes a strongly-typed settings class (`Diagnostics.Properties.Settings`) derived from `ApplicationSettingsBase`, enabling centralized, persisted configuration access for diagnostic-related runtime parameters. The module itself contains no executable logic beyond the auto-generated settings infrastructure—it serves as a configuration contract point for the diagnostics module, likely consumed by other components in the diagnostics pipeline (e.g., test setup validation, diagnostic reporting, or hardware interaction modules).
### 2. Public Interface
The module exposes only one public type:
- **`Diagnostics.Properties.Settings`**
- **Type**: `internal sealed partial class` inheriting from `System.Configuration.ApplicationSettingsBase`
- **Static Property**: `public static Settings Default { get; }`
- Returns the singleton, thread-safe instance of the settings class.
- Internally uses `ApplicationSettingsBase.Synchronized()` to ensure thread safety.
- **Note**: No custom settings properties are defined in the provided source. The class is auto-generated and currently contains *no user-defined settings* beyond the default `ApplicationSettingsBase` behavior (e.g., default constructor, `Item[string]` indexer, etc.). Any settings would be added via Visual Studios Settings designer and regenerated into this file.
### 3. Invariants
- The `Default` property always returns a non-null, synchronized instance of `Settings`.
- The class is `sealed` and `partial`, indicating it is not extensible via inheritance and may be partially regenerated.
- Thread-safety is enforced for the singleton instance via `Synchronized()`, but *no other thread-safety guarantees* are provided for individual property access (as is standard for `ApplicationSettingsBase`).
- The assembly version is fixed at `1.0.0.0` (both `AssemblyVersion` and `AssemblyFileVersion`), with no build/revision auto-increment.
### 4. Dependencies
- **Depends on**:
- `System.Configuration` (for `ApplicationSettingsBase`)
- `System.Runtime.CompilerServices` (for `CompilerGeneratedAttribute`)
- `System.CodeDom.Compiler` (for `GeneratedCodeAttribute`)
- **Depended on by**:
- Other modules/components in the `Diagnostics` namespace (e.g., test setup validators, diagnostic runners) that consume diagnostic configuration.
- The broader `DataPRO` system via the `Diagnostics` assembly (GUID: `c91752c2-0792-475c-be1e-bc1aff79e56e`).
- **Assembly metadata** indicates it is part of the `Diagnostics` product, owned by `DTS`, and is not COM-visible.
### 5. Gotchas
- **Auto-generated file**: Manual edits will be overwritten on regeneration (e.g., via Visual Studios Settings designer).
- **No settings defined**: The current `Settings` class contains *no user-defined properties*—it is a skeleton. Any configuration behavior must be added externally and regenerated into this file.
- **Thread-safety scope**: While the `Default` instance is synchronized, accessing individual settings properties (once defined) is *not* guaranteed thread-safe beyond the base `ApplicationSettingsBase` semantics.
- **Versioning**: Hardcoded version `1.0.0.0` may indicate legacy or placeholder status; verify if versioning is intentionally static or an oversight.
- **No documentation comments**: The source lacks XML documentation, making it unclear what settings *should* be present or their semantics.

View File

@@ -0,0 +1,69 @@
---
source_files:
- DataPRO/Modules/TestSetups/Diagnostics/Resources/TranslateExtension.cs
- DataPRO/Modules/TestSetups/Diagnostics/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T04:50:59.405186+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "8602aa2c75632a3b"
---
# Resources
## Documentation: `TranslateExtension` Markup Extension
---
### 1. Purpose
The `TranslateExtension` class is a WPF `MarkupExtension` used to resolve localized string resources at XAML runtime. It enables declarative binding to localized strings in UI markup by accepting a resource key and returning the corresponding localized value from the `StringResources` strongly-typed resource class. This allows UI text to be localized without hardcoding strings in XAML, supporting multi-language deployments of the diagnostics module.
---
### 2. Public Interface
#### `TranslateExtension(string key)`
- **Signature**: `public TranslateExtension(string key)`
- **Behavior**: Constructor. Stores the provided resource key for later lookup. Does not perform validation beyond null/empty checks during `ProvideValue`.
#### `ProvideValue(IServiceProvider serviceProvider)`
- **Signature**: `public override object ProvideValue(IServiceProvider serviceProvider)`
- **Behavior**:
- If `_key` is `null` or empty, returns `"#stringnotfound#"`.
- Otherwise, attempts to retrieve the string value from `StringResources.ResourceManager.GetString(_key)`.
- If the resource is not found (i.e., `GetString` returns `null`), returns `"#stringnotfound# " + _key` (note the trailing space).
- Returns a `string` (as indicated by `[MarkupExtensionReturnType(typeof(string))]`).
---
### 3. Invariants
- `_key` is immutable after construction (stored in a `readonly` field).
- The returned value is always a `string`.
- Missing or empty keys **always** yield `"#stringnotfound#"` (no concatenation with key).
- Missing resources **always** yield `"#stringnotfound# <key>"` (with a space between the prefix and key).
- No exceptions are thrown during `ProvideValue`—errors are silently handled via fallback strings.
- Resource lookup uses the default `ResourceManager` instance and current UI culture (unless overridden via `StringResources.Culture`).
---
### 4. Dependencies
#### Dependencies *of* `TranslateExtension`:
- `System.Windows.Markup.MarkupExtension` (base class, part of WPF).
- `Diagnostics.Resources.StringResources` (specifically its `ResourceManager` property and `GetString(string)` method).
- `System` (for `string.IsNullOrEmpty`, `object.ReferenceEquals`, etc.).
#### Dependencies *on* `TranslateExtension`:
- XAML files in the diagnostics module (e.g., `.xaml` files) that use `{local:Translate KeyName}` syntax to bind UI text.
- `StringResources.Designer.cs` must be compiled and available at runtime (auto-generated; relies on corresponding `.resx` file, not visible here).
---
### 5. Gotchas
- **No null-safety for `_key` beyond emptiness**: Passing `null` as `_key` is allowed in the constructor but results in `"#stringnotfound#"` at runtime.
- **Ambiguous fallbacks**: Both missing keys and empty keys produce `"#stringnotfound#"`, making debugging harder without inspecting the key itself.
- **Hardcoded prefix**: The `"#stringnotfound#"` string is hardcoded and not configurable. If this prefix appears in actual resources, it may cause confusion.
- **No caching of resolved values**: Each `ProvideValue` call re-invokes `ResourceManager.GetString`, which may have performance implications in high-frequency scenarios (though `ResourceManager` itself caches internally).
- **Culture dependency**: Behavior depends on the current UI threads `Culture` (via `StringResources.Culture`). If the UI culture changes dynamically, existing bindings may not update unless re-evaluated.
- **No compile-time key validation**: Typos in XAML resource keys (e.g., `{local:Translate Channles}`) will only surface at runtime as `"#stringnotfound# Channles"`.
None identified beyond the above.

View File

@@ -0,0 +1,44 @@
---
source_files:
- DataPRO/Modules/TestSetups/Diagnostics/View/DiagnosticsTreeView.xaml.cs
generated_at: "2026-04-16T04:51:08.211908+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "0a0fe72fbe0be4ed"
---
# View
## Documentation: `DiagnosticsTreeView` Class
### 1. Purpose
The `DiagnosticsTreeView` class provides the WPF UI implementation for a tree-view control used to display diagnostic data in the test setup diagnostics module. It serves as the concrete view layer implementing the `IDiagnosticsTreeView` interface, handling the visual representation and user interaction for hierarchical diagnostic information (e.g., test steps, subtests, or diagnostic nodes). Its existence enables separation of UI logic from business logic, adhering to MVVM or similar patterns where `IDiagnosticsTreeView` defines the contract for view interactions.
### 2. Public Interface
The class is `partial`, implying its full definition is split between this file and `DiagnosticsTreeView.xaml`. From the provided source, only the following is publicly exposed:
- **`public DiagnosticsTreeView()`**
Constructor. Calls `InitializeComponent()` to load and wire up the XAML-defined UI elements. No additional initialization logic is visible in this file.
*Note:* No other public methods, properties, or events are declared in this file. Any additional public members (e.g., event handlers, dependency properties, or interface implementations) must be defined in the corresponding `DiagnosticsTreeView.xaml` or other partial files, which are not included here.
### 3. Invariants
No explicit invariants (e.g., state constraints, validation rules, ordering guarantees) are declared or inferable from this file alone. The class relies on WPFs standard tree-view behavior (e.g., `ItemsControl` semantics), but no custom invariants are enforced in the provided code.
### 4. Dependencies
- **Direct Dependencies (via `using`):**
- `System.Windows.*` (WPF core namespaces: `System.Windows`, `System.Windows.Controls`, `System.Windows.Data`, `System.Windows.Media`)
- `DTS.Common.Interface.TestSetups.Diagnostics` — specifically, the `IDiagnosticsTreeView` interface (referenced via `inheritdoc`).
- **Implicit Dependencies:**
- `DiagnosticsTreeView.xaml` — required for `InitializeComponent()` to succeed (contains UI layout and element definitions).
- `IDiagnosticsTreeView` interface — must be defined in `DTS.Common.Interface.TestSetups.Diagnostics` and implemented by this class.
- **Depended upon:**
- Likely consumed by a corresponding view model (e.g., `DiagnosticsTreeViewModel`) that binds to this view via `IDiagnosticsTreeView`. The interface contract (`IDiagnosticsTreeView`) enables inversion of control.
### 5. Gotchas
- **Incomplete visibility:** The class is `partial`, and no members beyond the constructor are visible in this file. Behavior, event handling, and data binding logic reside in `DiagnosticsTreeView.xaml` and other partial definitions, which are not provided.
- **Interface implementation:** While `IDiagnosticsTreeView` is referenced, its contract (methods/properties) is not included here. Consumers must rely on the interface definition in `DTS.Common.Interface.TestSetups.Diagnostics`.
- **No logic in constructor:** The constructor does not initialize data or set up bindings—this is expected to be handled via XAML data binding (e.g., `DataContext` assignment in XAML or by a framework).
- **Namespace quirk:** `// ReSharper disable CheckNamespace` suggests the namespace is intentionally `Diagnostics` (not nested under a deeper module), which may conflict with standard naming conventions and could cause ambiguity.
*None identified from source alone.*

View File

@@ -0,0 +1,122 @@
---
source_files:
- DataPRO/Modules/TestSetups/Diagnostics/ViewModel/DiagnosticsViewModel.cs
generated_at: "2026-04-16T04:50:48.729446+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ea1f4ae58f807074"
---
# ViewModel
## Documentation: `DiagnosticsViewModel`
---
### 1. **Purpose**
The `DiagnosticsViewModel` class serves as the view model for the Diagnostics module within the applications UI, implementing the `IDiagnosticsViewModel` interface. It acts as the intermediary between the diagnostics view (`IDiagnosticsTreeView`) and underlying system services (e.g., event aggregation, region management, dependency injection), enabling UI interaction patterns such as notifications and busy-state indication. It subscribes to global events (`RaiseNotification`, `BusyIndicatorChangeNotification`) to synchronize UI state (e.g., `IsBusy`, `IsMenuIncluded`) and trigger interactive popups via Prisms `InteractionRequest` mechanism. Though currently minimal in logic, it provides the foundational structure for future diagnostics functionality.
---
### 2. **Public Interface**
#### `public IDiagnosticsTreeView View { get; set; }`
*Alias:* `TreeView` (see below).
The view instance bound to this view model. Set during construction and used to establish data context.
#### `public IDiagnosticsTreeView TreeView { get; set; }`
Explicitly named property (redundant with `View`). Holds the reference to the diagnostics tree view.
#### `public bool IsDirty { get; private set; }`
Read-only property indicating whether the view models state has unsaved changes. Currently never set to `true` in the source.
#### `public bool IsBusy { get; set; }`
Public property that reflects whether a long-running operation is in progress. Raises `PropertyChanged` when changed.
#### `public bool IsMenuIncluded { get; set; }`
Controls whether the menu UI element should be rendered. Raises `PropertyChanged` on change.
#### `public bool IsNavigationIncluded { get; set; }`
Controls whether the navigation UI element should be rendered. Raises `PropertyChanged` on change.
#### `public event PropertyChangedEventHandler PropertyChanged`
Standard `INotifyPropertyChanged` implementation. Used by `OnPropertyChanged`.
#### `public void OnPropertyChanged(string propertyName)`
Raises the `PropertyChanged` event for the specified property name.
#### `public InteractionRequest<Notification> NotificationRequest { get; }`
Prism interaction request used to trigger notification popups (e.g., alerts, messages). Raised via `OnRaiseNotification`.
#### `public InteractionRequest<Confirmation> ConfirmationRequest { get; }`
Prism interaction request for confirmation dialogs (currently unused in the source).
#### `public void Unset()`
No-op stub. Intended for cleanup before view model is detached.
#### `public void Cleanup()`
No-op stub. Intended for synchronous cleanup.
#### `public Task CleanupAsync()`
Returns `Task.CompletedTask`. No-op stub for asynchronous cleanup.
#### `public void Initialize()`
No-op stub. Part of Prisms `INavigationAware` / `IInitialize` pattern.
#### `public void Initialize(object parameter)`
No-op stub.
#### `public void Initialize(object parameter, object model)`
No-op stub.
#### `public Task InitializeAsync()`
Returns `Task.CompletedTask`. No-op stub.
#### `public Task InitializeAsync(object parameter)`
Returns `Task.CompletedTask`. No-op stub.
#### `public void Activated()`
No-op stub. Likely part of Prisms `INavigationAware` or region lifecycle.
---
### 3. **Invariants**
- `TreeView` must be non-null after construction (set in constructor).
- `IsBusy` must be set only via its property setter (which triggers `OnPropertyChanged("IsBusy")`).
- `IsMenuIncluded` and `IsNavigationIncluded` must be set only via their property setters (which trigger `OnPropertyChanged`).
- `NotificationRequest` and `ConfirmationRequest` are initialized exactly once in the constructor.
- Event subscriptions (`RaiseNotification`, `BusyIndicatorChangeNotification`) are established in the constructor and never unsubscribed (potential memory leak risk).
- `OnRaiseNotification` constructs a *new* `NotificationContentEventArgs` with empty strings for `Header` and `Footer`, preserving only `Message`, `Image`, and `Title`.
---
### 4. **Dependencies**
#### **Imports / Dependencies Used**
- `DTS.Common.Events` → Provides `RaiseNotification`, `BusyIndicatorChangeNotification`, and `NotificationContentEventArgs`.
- `DTS.Common.Interface.TestSetups.Diagnostics` → Defines `IDiagnosticsTreeView` and `IDiagnosticsViewModel`.
- `Prism.Events` → Provides `IEventAggregator`, `EventAggregator`, and event types.
- `Prism.Regions` → Provides `IRegionManager`.
- `Unity` → Provides `IUnityContainer`.
- `System.ComponentModel`, `System.Threading.Tasks` → Standard .NET interfaces and async support.
#### **Consumers (Inferred)**
- The view (`IDiagnosticsTreeView`) binds to this view model (via `TreeView.DataContext = this`).
- External components publish `RaiseNotification` and `BusyIndicatorChangeNotification` events via `IEventAggregator`, which this view model consumes.
- Likely registered as a singleton (`[PartCreationPolicy(CreationPolicy.Shared)]`) and injected via Unity.
---
### 5. **Gotchas**
- **No-op lifecycle methods**: All `Initialize*`, `Cleanup*`, and `Activated` methods are empty stubs. Behavior is not implemented despite being part of Prisms expected patterns.
- **Event subscription leak**: Subscriptions to `_eventAggregator.GetEvent<...>().Subscribe(...)` are not disposed or unsubscribed. If the view model is long-lived or recreated frequently, this may cause memory leaks or duplicate handlers.
- **Redundant `View` and `TreeView` properties**: Both `View` and `TreeView` are exposed and refer to the same object. This duplication is confusing and suggests possible refactoring debt.
- **Unused `ConfirmationRequest`**: Declared but never used. May indicate incomplete implementation.
- **`IsDirty` never set to `true`**: The property exists but is never updated, rendering it non-functional.
- **`OnRaiseNotification` mutates event args**: A new `NotificationContentEventArgs` is created with empty `Header` and `Footer`, discarding original values. This may be intentional (e.g., to sanitize content), but is not documented.
- **No command bindings**: The `#region Commands` section is empty. If commands are expected (e.g., for button clicks), they are not implemented here.
> **None identified from source alone** for *behavioral correctness* beyond the above.

View File

@@ -0,0 +1,91 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/TTSImportModule.cs
generated_at: "2026-04-16T04:49:40.145713+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1b549e2b16a3c023"
---
# TTS
### **Purpose**
The `TTSImportModule` is a Prism module responsible for registering view and view-model types related to TTS (Test Timing Specification) import functionality within the DTS (Device Test System) framework. It enables modular UI composition by integrating TTS-specific import views (e.g., hardware scan, file editing, summary, channel configuration) into the applications dependency injection container via Unity, making them available for navigation and reuse across the UI. This module acts as a bridge between the core test setup infrastructure and the TTS import feature set, ensuring proper instantiation and lifecycle management of its UI components.
---
### **Public Interface**
#### **Class: `TTSImportModule`**
- **`TTSImportModule(IUnityContainer unityContainer)`**
Constructor. Accepts a Unity container via dependency injection and stores it for later use in type registration during `Initialize()`.
- **`void Initialize()`**
Registers all TTS import-related view and view-model types as singleton mappings in the Unity container. Specifically registers:
- `IHardwareScanView``HardwareScanView`
- `IHardwareScanViewModel``HardwareScanViewModel`
- `IEditFileView``EditFileView`
- `IEditFileViewModel``EditFileViewModel`
- `ISummaryView``SummaryView`
- `ISummaryViewModel``SummaryViewModel`
- `IReadFileView``ReadFileView`
- `IReadFileViewModel``ReadFileViewModel`
- `ILevelTriggerView``LevelTriggerView`
- `ILevelTriggerViewModel``LevelTriggerViewModel`
- `IAnalogChannelsView``AnalogChannelsView`
- `IAnalogChannelsViewModel``AnalogChannelsViewModel`
- `ITOMChannelsView``TOMChannelsView`
- `ITOMChannelsViewModel``TOMChannelsViewModel`
- `IDigitalInputChannelsView``DigitalInputChannelsView`
- `IDigitalInputChannelsViewModel``DigitalInputChannelsViewModel`
- `IDigitalOutputChannelsView``DigitalOutputChannelsView`
- `IDigitalOutputChannelsViewModel``DigitalOutputChannelsViewModel`
- **`void OnInitialized(IContainerProvider containerProvider)`**
Currently throws `NotImplementedException`. Intended for post-initialization logic per Prism module lifecycle, but unused.
- **`void RegisterTypes(IContainerRegistry containerRegistry)`**
Currently throws `NotImplementedException`. Presumably intended for Prisms `IContainerRegistry`-based type registration, but not implemented.
#### **Attribute Classes**
- **`TTSImportModuleNameAttribute`**
Assembly-level attribute. Inherits from `TextAttribute`. Returns `"TTSImport"` as the `AssemblyName` (via `AssemblyNames.TTSImport.ToString()`). Used to identify the module by name.
- **`TTSImportModuleImageAttribute`**
Assembly-level attribute. Inherits from `ImageAttribute`. Provides metadata for UI presentation:
- `AssemblyImage`: Loads image via `AssemblyInfo.GetImage("TTSImport")`.
- `AssemblyName`: `"TTSImport"`.
- `AssemblyGroup`: `"Prepare"` (via `eAssemblyGroups.Prepare.ToString()`).
- `AssemblyRegion`: `eAssemblyRegion.TTSImportRegion`.
---
### **Invariants**
- The `TTSImportModule` must be loaded *before* any UI components that depend on its registered views/view-models are instantiated.
- All view and view-model types registered in `Initialize()` must be concrete types implementing their respective interfaces (e.g., `HardwareScanView : IHardwareScanView`).
- The `AssemblyNames.TTSImport` and `eAssemblyGroups.Prepare`/`eAssemblyRegion.TTSImportRegion` enums must be defined and accessible (from `DTS.Common`), or runtime failures will occur during attribute initialization.
- The `AssemblyInfo.GetImage(...)` method must return a valid `BitmapImage` for `"TTSImport"`; otherwise, `TTSImportModuleImageAttribute` may throw or return null.
---
### **Dependencies**
**Dependencies *of* this module:**
- `DTS.Common` (specifically `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`)
- `Prism.Modularity` (`IModule`, `IContainerProvider`, `IContainerRegistry`)
- `Unity` (`IUnityContainer`)
- `System.Windows.Media.Imaging` (`BitmapImage`)
- Internal interfaces under `DTS.Common.Interface.TestSetups.Imports.TTS.*` (e.g., `IHardwareScanView`, `IAnalogChannelsViewModel`)
**Dependencies *on* this module:**
- Any module or UI component that consumes TTS import views (e.g., via `IUnityContainer.Resolve<T>()` or Prism region navigation) depends on this module being loaded first.
- The `TTSImportModuleNameAttribute` and `TTSImportModuleImageAttribute` are used by the host application (likely in module discovery/UI assembly rendering), so the host depends on these attributes being present.
---
### **Gotchas**
- **`OnInitialized` and `RegisterTypes` are unimplemented** — throwing `NotImplementedException`. This is inconsistent with Prisms `IModule` contract and may cause runtime errors if the host framework calls them.
- **Hardcoded assembly name `"TTSImport"`** — relies on `AssemblyNames.TTSImport` and `AssemblyInfo.GetImage(...)`. If these are misconfigured or renamed, attribute initialization will fail silently or throw.
- **No validation in `Initialize()`** — assumes all view/view-model types exist and are resolvable. Missing implementations will cause Unity registration to fail at runtime (not compile time).
- **No cleanup logic** — the module does not unregister types or dispose resources (e.g., images), potentially contributing to memory leaks in long-running scenarios.
- **`TTSImportModuleImageAttribute` constructor assigns `_img` twice** — redundant assignment in the parameterized constructor (`_img = ...` in both default and `: this(null)` paths). Likely harmless but indicates possible refactoring debt.
- **No documentation on view/view-model responsibilities** — while interfaces like `IHardwareScanView` are registered, their semantics (e.g., data flow, user interactions) are not described here and must be inferred from their implementations.

View File

@@ -0,0 +1,314 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Model/WorkFunctionThreadData.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/SummaryChannel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/ChannelSummary.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/DasSummary.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/HardwareSummaryRecord.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSTestSetup.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSLevelTriggerRecord.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/DASChannel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Model/TTSChannelRecord.cs
generated_at: "2026-04-16T04:50:55.201620+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "7bc3f89b4437f095"
---
# Model
**Documentation: TTS Import Model Layer**
---
### 1. Purpose
This module provides core data models for representing test setup configurations, hardware channel assignments, and sensor metadata in the TTS (Toyota Test System) import workflow. It serves as the domain model layer for parsing, editing, and serializing TTS test configurations—primarily from CSV files or hardware scans—while supporting real-time UI binding via `INotifyPropertyChanged`. The models encapsulate channel definitions (`TTSChannelRecord`), hardware channel wrappers (`DASChannel`), level trigger logic (`TTSLevelTriggerRecord`), and summary data structures (`ChannelSummary`, `DasSummary`, `SummaryChannel`, `HardwareSummaryRecord`). These classes are used by UI view models and import/export logic to manage sensor-to-hardware assignments, trigger thresholds, and validation rules.
---
### 2. Public Interface
#### `WorkFunctionThreadData`
- **`ManualResetEvent CancelEvent { get; }`**
Signal to request cancellation of a background operation.
- **`ManualResetEvent DoneEvent { get; }`**
Signal to indicate completion of a background operation.
*Constructor initializes both events to non-signaled state.*
#### `SummaryChannel`
- **`string ChannelType { get; set; }`**
Gets/sets the channel type string; raises `PropertyChanged` on change.
- **`int Assigned { get; set; }`**
Gets/sets the count of assigned channels; raises `PropertyChanged`.
- **`string Unassigned { get; set; }`**
Gets/sets the unassigned channel list string; raises `PropertyChanged`.
#### `ChannelSummary`
- **`string ChannelType { get; set; }`**
Channel type identifier; raises `PropertyChanged`.
- **`int Requested { get; set; }`**
Number of channels requested for this type; raises `PropertyChanged`.
- **`int Assigned { get; set; }`**
Number of channels assigned; raises `PropertyChanged`.
- **`int Unassigned { get; set; }`**
Number of channels unassigned; raises `PropertyChanged`.
#### `DasSummary`
- **`string DASSerial { get; set; }`**
DAS unit serial number; raises `PropertyChanged`.
- **`string EIDFound { get; set; }`**
EID status string (e.g., "Found"/"Missing"); raises `PropertyChanged`.
- **`string BatteryVoltageStatus { get; set; }`**
Battery voltage status string; raises `PropertyChanged`.
- **`System.Windows.Media.SolidColorBrush BatteryVoltageColor { get; set; }`**
Brush for UI color coding of battery status; raises `PropertyChanged`.
- **`string InputVoltageStatus { get; set; }`**
Input voltage status string; raises `PropertyChanged`.
- **`System.Windows.Media.SolidColorBrush InputVoltageColor { get; set; }`**
Brush for UI color coding of input voltage status; raises `PropertyChanged`.
#### `HardwareSummaryRecord`
- **`uint DOut { get; set; }`**
Count of digital output channels; raises `PropertyChanged`.
- **`uint DIn { get; set; }`**
Count of digital input channels; raises `PropertyChanged`.
- **`uint Squib { get; set; }`**
Count of squib channels; raises `PropertyChanged`.
- **`uint Analog { get; set; }`**
Count of analog channels; raises `PropertyChanged`.
- **`uint SPS { get; set; }`**
Count of SPS modules; raises `PropertyChanged`.
- **`uint SPD { get; set; }`**
Count of SPD modules; raises `PropertyChanged`.
- **`uint SPT { get; set; }`**
Count of SPT modules; raises `PropertyChanged`.
- **`uint ECM { get; set; }`**
Count of ECM modules; raises `PropertyChanged`.
- **`uint Rack { get; set; }`**
Count of rack units; raises `PropertyChanged`.
- **`uint G5 { get; set; }`**
Count of G5 modules; raises `PropertyChanged`.
- **`uint Total { get; private set; }`**
Sum of `Analog + Squib + DIn + DOut`; *only updated via `UpdateTotal()`*.
- **`void UpdateTotal()`**
Recalculates `Total` as sum of analog, squib, digital input, and digital output counts.
- **`void Update(uint analog, uint squib, uint din, uint dout, uint ecm, uint sps, uint spt, uint spd, uint g5, uint rack)`**
Sets all module counts and calls `UpdateTotal()`.
#### `TTSTestSetup`
- **`double SampleRate { get; set; }`**
Sampling rate in Hz.
- **`RecordingModes Mode { get; set; }`**
Recording mode enum (e.g., Circular, File).
- **`double TestLength { get; }`**
Computed as `PreTrigger + PostTrigger`.
- **`double PreTrigger { get; set; }`**
Pre-trigger time in seconds.
- **`double PostTrigger { get; set; }`**
Post-trigger time in seconds.
- **`double ROIStart { get; set; }`**
Region of interest start time (seconds).
- **`double ROIEnd { get; set; }`**
Region of interest end time (seconds).
- **`string Filename { get; set; }`**
Path to the imported CSV file.
- **`string TestId { get; set; }`**
Test identifier string.
- **`string Line1 { get; set; }`**, **`Line2 { get; set; }`**, **`Line3 { get; set; }`**, **`Line4 { get; set; }`**
First four lines of the CSV header (used when generating new CSVs).
- **`string[] DummyList { get; set; }`**
Array of 8 strings (purpose unclear from source).
- **`ITTSChannelRecord[] Channels { get; set; }`**
Array of channel records.
- **`ILevelTrigger[] LevelTriggers { get; }`**
Fixed-size array of 6 `ILevelTrigger` instances (initialized in constructor).
- **`string OriginalImportFile { get; set; }`**
Path of the original imported file.
- **`bool AllowAdvancedRecordingModes { get; set; }`**
Enables HybridRecorder mode.
- **`bool AllowActiveRecordingModes { get; set; }`**
Enables Active RAM and Active RAM Multiple modes.
- **`bool AllowTSRAIRRecordingModes { get; set; }`**
Enables TSRAIR modes.
- **`bool RequireEIDFound { get; set; }`**
If `true`, sensors without EIDs are excluded.
- **`string DefaultDigitalInputMode { get; set; }`**
Default digital input mode from config.
- **`ISquibSettingDefaults SquibDefaults { get; set; }`**
Default squib settings.
- **`double DefaultSquibFireDurationMs { get; set; }`**
Default squib fire duration (ms) from config.
- **`Tuple<string, string>[] PreAssignedSensorIdAndHwId { get; set; }`**
Pre-existing sensor-to-hardware assignments (from XML import).
- **`string GetHashCode()`**
Computes SHA-256 hash over key properties and channel/trigger data; *note: overrides `object.GetHashCode()` but is named `GetHashCode()` (not `override`)*.
#### `TTSLevelTriggerRecord`
- **`string Code { get; }`**
Channel code of associated `Channel` (`""` if none).
- **`string JCode { get; }`**
JCode/Description of associated `Channel` (`""` if none).
- **`double ValuePercent { get; set; }`**
Threshold as % of full scale; triggers `RecalculateEUValue()`.
- **`double ValueEU { get; set; }`**
Threshold in engineering units; triggers `RecalculatePercent()`.
- **`string EULabel { get; }`**
Engineering unit label from `Channel.SensorEU`.
- **`string HWSerialNumber { get; }`**
Hardware module serial number from `Channel.HardwareChannel`.
- **`int ChannelNumber { get; }`**
TTS channel number from `Channel.ChannelNumber`.
- **`ITTSChannelRecord Channel { get; set; }`**
Sensor channel assignment; setter triggers `Refresh()` on *all other level triggers*.
- **`ITTSSetup TestSetup { get; }`**
Parent test setup instance.
- **`ITTSChannelRecord[] AvailableChannels { get; }`**
Read-only array of channels eligible for assignment, enforcing uniqueness of channel codes, SIMs (for TDASRack), and max 2 per G5.
- **`bool IsActive { get; }`**
`true` if `Channel` is non-null and not an empty record.
- **`bool IsModified { get; set; }`**
Flag indicating user modification.
- **`byte[] GetBytes()`**
Serializes active trigger data (code, JCode, ValueEU, HWSerialNumber).
- **`void Refresh()`**
Rebuilds `AvailableChannels`, revalidates current assignment, and raises `PropertyChanged("AvailableChannels")`.
- **`void Add(ITTSChannelRecord channel)`**
Raises `PropertyChanged("AvailableChannels")`.
- **`void Remove(ITTSChannelRecord channel)`**
Unassigns `Channel` if it matches, then raises `PropertyChanged("AvailableChannels")`.
#### `DASChannel`
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Gets/sets digital output mode; auto-adds/removes channel from `TestSetup.Channels`.
- **`double DigitalOutputDelayMs { get; set; }`**
Delay (ms) from trigger to output start.
- **`double DigitalOutputDurationMs { get; set; }`**
Duration (ms) of output pulse.
- **`string Polarity { get; set; }`**
`"+"` or `"-"`; maps to `Channel.SensorPolarity`.
- **`SquibFireMode SquibFireMode { get; set; }`**
Gets/sets squib fire mode (`CAP` or `CONSTANT`).
- **`bool Disabled { get; set; }`**
Dependency property for UI styling; reflects `Channel.Disabled`.
- **`ITTSChannelRecord Channel { get; private set; }`**
Associated TTS channel record (can be `null`).
- **`string DASChannelString { get; }`**
Hardware channel string representation (e.g., `[SPS00001] ch 13`).
- **`string ToyotaCode { get; set; }`**
Gets/sets `Channel.ChannelCode`.
- **`string EID { get; set; }`**
Electronic ID of sensor (if any).
- **`string Name { get; set; }`**
Gets/sets `Channel.JCodeOrDescription`.
- **`string SerialNumber { get; }`**
`Channel.SensorSerialNumber`.
- **`double Sensitivity { get; }`**
`Channel.SensorSensitivity`.
- **`string SensitivityString { get; }`**
Formatted sensitivity string (`N12`).
- **`bool IsActive { get; }`**
`true` if `Channel` is non-null and (not digital output or has non-`NONE` mode).
- **`double Capacity { get; }`**
`Channel.SensorCapacity`.
- **`double Range { get; set; }`**
Gets/sets `Channel.ChannelRange`.
- **`double CableMultiplier { get; set; }`**
Gets/sets `Channel.CableMultiplier`.
- **`double SquibFireDelayMs { get; set; }`**
Gets/sets `Channel.SquibFireDelayMs`.
- **`double SquibFireCurrent { get; set; }`**
Gets/sets `Channel.SquibFireCurrent`.
- **`bool LimitDuration { get; set; }`**
Gets/sets `Channel.LimitDuration`.
- **`double SquibFireDurationMs { get; set; }`**
Gets/sets `Channel.SquibFireDurationMs` (clamped to min/max).
- **`double SquibFireResistanceLowOhm { get; set; }`**
Gets/sets `Channel.SquibFireResistanceLowOhm`.
- **`double SquibFireResistanceHighOhm { get; set; }`**
Gets/sets `Channel.SquibFireResistanceHighOhm`.
- **`IHardwareChannel HardwareChannel { get; }`**
Wrapped hardware channel instance.
- **`void SetITTSChannelRecord(ITTSChannelRecord channel)`**
Assigns/unassigns sensor to hardware; updates all dependent properties.
#### `TTSChannelRecord`
- **`int ChannelNumber { get; set; }`**
TTS channel number.
- **`string ChannelCode { get; set; }`**
Channel code (e.g., `"1650"`); raises validation flags in `Parent`.
- **`string JCodeOrDescription { get; set; }`**
J-code or description; sets `IsJCodeValid`.
- **`double ChannelRange { get; set; }`**
Channel range (e.g., 05V); sets `IsRangeValid`.
- **`string ChannelRangeString { get; set; }`**
String representation of `ChannelRange`; parses to `ChannelRange`.
- **`int ChannelFilterHz { get; set; }`**
Filter cutoff in Hz (e.g., 1650, 1000, 300, 100, 17); sets `IsFilterValid`.
- **`string FilterString { get; set; }`**
String representation of filter; validates against known values.
- **`string SensorSerialNumber { get; set; }`**
Sensor serial number.
- **`string SensorEID { get; set; }`**
Electronic ID of sensor.
- **`double SensorSensitivity { get; set; }`**
Sensor sensitivity.
- **`double SensorExcitationVolts { get; set; }`**
Excitation voltage.
- **`double SensorCapacity { get; set; }`**
Sensor capacity.
- **`string SensorEU { get; set; }`**
Engineering unit label.
- **`bool SensorPolarity { get; set; }`**
`true` = positive polarity.
- **`ToyotaBridgeType ChannelType { get; set; }`**
Channel type enum (e.g., `FullBridge`, `HalfBridge`, `IRTRACC`).
- **`string Description { get; set; }`**
Sensor description.
- **`bool ProportionalToExcitation { get; set; }`**
Whether sensitivity is proportional to excitation.
- **`double BridgeResistance { get; set; }`**
Bridge resistance (ohms).
- **`double InitialOffsetVoltage { get; set; }`**, **`InitialOffsetVoltageTolerance { get; set; }`**
Offset voltage and tolerance.
- **`bool RemoveOffset { get; set; }`**
Whether to remove initial offset.
- **`ToyotaZeroMethods ZeroMethod { get; set; }`**
Zeroing method enum.
- **`double CableMultiplier { get; set; }`**
Cable gain multiplier.
- **`double InitialEUInMV { get; set; }`**, **`InitialEUInEU { get; set; }`**
Initial offset in mV and EU.
- **`double IRTraccExponent { get; set; }`**, **`PolynomialConstant { get; set; }`**, etc.
Non-linear calibration coefficients.
- **`string ISOCode { get; set; }`**, **`ISODescription { get; set; }`**, **`ISOPolarity { get; set; }`**
ISO 14229-related fields.
- **`bool IsSquib { get; set; }`**, **`IsDigitalInput { get; set; }`**, **`IsDigitalOutput { get; set; }`**
Channel type flags.
- **`IHardwareChannel HardwareChannel { get; set; }`**
Assigned hardware channel.
- **`bool IsEmptyRecord { get; }`**
`true` if `ChannelCode == "None"` and `SensorSerialNumber` is whitespace.
- **`bool IsChannelCodeValid { get; set; }`**, **`IsJCodeValid { get; set; }`**, **`IsRangeValid { get; set; }`**, **`IsFilterValid { get; set; }`**
Validation flags.
- **`bool Disabled { get; set; }`**
Channel disabled flag.
- **`SquibFireMode SquibFireMode { get; set; }`**
Squib fire mode.
- **`double SquibFireDelayMs { get; set; }`**
Squib fire delay.
- **`double SquibFireCurrent { get; set; }`**
Squib current limit.
- **`bool LimitDuration { get; set; }`**
Squib duration limiting flag.
- **`double SquibFireDurationMs { get; set; }`**
Squib fire duration (clamped to min/max).
- **`double SquibFireResistanceLowOhm { get; set; }`**, **`SquibFireResistanceHighOhm { get; set; }`**
Squib resistance tolerance.
- **`DigitalInputModes DigitalInputMode { get; set; }`**
Digital input mode.
- **`DigitalOutputModes DigitalOutputMode { get; set; }`**
Digital output mode.
- **`double DigitalOutputDelay { get; set; }`**, **`DigitalOutputDuration { get; set; }`**
Digital output timing.
- **`bool DiagnosticsMode { get; set; }`**
Diagnostics

View File

@@ -0,0 +1,49 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Properties/AssemblyInfo.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Properties/Settings.Designer.cs
generated_at: "2026-04-16T04:50:04.681006+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "dad870cb48725e31"
---
# Properties
## Documentation: TTSImport Module (Assembly)
### 1. Purpose
This module (`TTSImport`) is an assembly responsible for handling test setup import functionality—specifically for TTS (presumably *Test Template System* or a domain-specific acronym)—within the DataPRO platform. It provides configuration storage for user-scoped settings (e.g., default import method) and is structured as a .NET class library with standard assembly metadata (title, version, COM visibility control). Its role is foundational: it enables consistent configuration management for downstream import logic (not included in these files), likely consumed by other modules in the `DataPRO.Modules.TestSetups.Imports.TTS` namespace.
### 2. Public Interface
The module exposes only one public type:
- **`TTSImport.Properties.Settings`**
- *Type*: `internal sealed partial class` inheriting from `System.Configuration.ApplicationSettingsBase`.
- *Access*: Accessed via the static property `Settings.Default`.
- *Behavior*: Provides user-scoped application settings. Currently defines one setting:
- `int DefaultTestImportMethod { get; set; }`
- Default value: `"0"` (as specified by `DefaultSettingValueAttribute`).
- Marked with `UserScopedSettingAttribute`, meaning it persists per-user (e.g., in user.config).
- Notable: The class is `internal`, so it is only accessible within the same assembly. External consumers would need to reference the assembly and access it via reflection or if exposed by another public type (not present here).
### 3. Invariants
- The `Settings.Default` instance is lazily initialized and synchronized via `ApplicationSettingsBase.Synchronized`, ensuring thread-safe access to the default instance.
- The `DefaultTestImportMethod` value is guaranteed to be an `int` (no validation beyond type safety); its semantics (e.g., what values are valid) are not defined in this file.
- Assembly version is fixed at `1.0.0.0` (both `AssemblyVersion` and `AssemblyFileVersion`).
- `ComVisible(false)` ensures no types in this assembly are exposed to COM by default.
### 4. Dependencies
- **Dependencies *of* this module**:
- `System.Configuration` (for `ApplicationSettingsBase`, `UserScopedSettingAttribute`, etc.)
- `System.Runtime.CompilerServices`, `System.Runtime.InteropServices`, `System.Diagnostics` (for attributes)
- **Dependencies *on* this module**:
- Not inferable from these files alone. However, given the path `DataPRO/Modules/TestSetups/Imports/TTS/`, it is likely consumed by other modules in the `DataPRO.Modules.TestSetups.Imports` hierarchy (e.g., a main TTS import handler).
- The `Guid` (`a8ff540f-f22a-45ae-a63b-4984ed74c654`) suggests potential COM interop usage, though `ComVisible(false)` disables it.
### 5. Gotchas
- The `Settings` class is `internal`, so external assemblies cannot directly reference `Settings.Default` without reflection or an additional public wrapper.
- The `DefaultTestImportMethod` setting has no documented valid range or semantic meaning (e.g., is `0` a "manual" mode? `1` "auto"?). This must be determined from consuming code or external documentation.
- Auto-generated comment in `Settings.Designer.cs` warns that manual changes will be lost on regeneration—likely triggered by Visual Studios settings designer.
- `AssemblyVersion("1.0.0.0")` with `AssemblyFileVersion("1.0.0.0")` suggests this is an initial release; no versioning strategy is evident here.
- No public API surface beyond `Settings.Default`; the modules primary functionality (test import logic) resides elsewhere.

View File

@@ -0,0 +1,81 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/Resources/StringResources.ja.Designer.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Resources/TranslateExtension.cs
- DataPRO/Modules/TestSetups/Imports/TTS/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T04:49:54.783331+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "977bda595f1f1bda"
---
# Resources
## Documentation: TTS Import Localization Resources
### 1. Purpose
This module provides localized string resources and a WPF `MarkupExtension` for internationalization within the TTS (Test Setup) import functionality. It enables UI elements and messages to be displayed in the users preferred language (currently Japanese, based on the `StringResources.ja.Designer.cs` file name) by retrieving localized strings from embedded `.resx`-generated resources. The `TranslateExtension` allows declarative binding of localized text in XAML, while `StringResources` provides strongly-typed access to all localized strings used in the import pipeline.
### 2. Public Interface
#### `TranslateExtension` class
- **Namespace**: `TTSImport`
- **Inherits**: `MarkupExtension`
- **Constructor**:
```csharp
public TranslateExtension(string key)
```
Initializes the extension with a resource key.
- **Fields**:
```csharp
public const string NotFound = "#stringnotfound#";
```
Fallback value returned when a resource lookup fails.
- **Method**:
```csharp
public override object ProvideValue(IServiceProvider serviceProvider)
```
Returns the localized string corresponding to `_key`, or `NotFound` if `_key` is null/empty, or `NotFound + " " + _key` if the key exists but has no value in the resource manager.
#### `StringResources` class
- **Namespace**: `TTSImport.Resources`
- **Type**: Internal, auto-generated strongly-typed resource class
- **Properties**: All are `internal static string` properties with `get` accessors that call `ResourceManager.GetString(key, resourceCulture)`. Examples include:
- `string AAF_SLICE { get; }`
- `string Added { get; }`
- `string ImportTestSetup_DuplicateChannelCode { get; }`
- `string SensorNotFound { get; }`
*(Full list of keys is extensive; see `StringResources.Designer.cs` for all ~150 entries.)*
- **Static Properties**:
```csharp
internal static ResourceManager ResourceManager { get; }
internal static CultureInfo Culture { get; set; }
```
Provide access to the underlying resource manager and override culture for lookups.
### 3. Invariants
- **Resource key must be non-null/non-empty** for successful lookup; otherwise, `TranslateExtension.ProvideValue` returns `NotFound`.
- **Missing resource values** result in `NotFound + " " + _key` (e.g., `"#stringnotfound# MyKey"`), not `null`.
- **`StringResources` is auto-generated**; manual edits are overwritten. Changes must be made via `.resx` files.
- **Thread-safety**: `ResourceManager` and `Culture` are managed with static fields and lazy initialization; no explicit synchronization is present in the generated code.
- **No validation** is performed on resource keys; invalid keys silently return `NotFound` or the fallback string.
### 4. Dependencies
- **Depends on**:
- `System.Resources.ResourceManager` (for resource lookup)
- `System.Globalization.CultureInfo` (for culture-specific lookups)
- `System.Windows.Markup.MarkupExtension` (for `TranslateExtension`)
- `System` and `System.ComponentModel` (via attributes)
- **Used by**:
- WPF XAML UI elements via `{tts:Translate KeyName}` bindings (inferred from `MarkupExtension` usage).
- Other modules in `TTSImport` namespace (e.g., import logic, error handlers) via `StringResources.PropertyName` access.
- **No external dependencies beyond .NET Framework 4.0+** (based on runtime version in header comment).
### 5. Gotchas
- **Hardcoded fallback format**: `NotFound + " " + _key` is used for missing values, which may produce confusing output (e.g., `"#stringnotfound# MyKey"`). No logging or telemetry is included.
- **No support for parameterized strings in `TranslateExtension`**: While `StringResources` properties like `SensorNotFound` contain format placeholders (e.g., `{0}`), `TranslateExtension` does not support passing arguments—consumers must manually format strings (e.g., `string.Format(StringResources.SensorNotFound, sensorName)`).
- **Culture override via `StringResources.Culture`** affects *all* subsequent lookups globally; misuse may cause inconsistent localization.
- **Japanese-only resource file is present** (`StringResources.ja.Designer.cs`), but no other language variants are visible in the provided files. Localization for other languages may be missing or managed elsewhere.
- **`StringResources.ja.Designer.cs` is empty** in the provided source—this may indicate incomplete localization or a build artifact issue. The Japanese resource strings are actually in `StringResources.Designer.cs` (which lacks language-specific suffix), suggesting the `.ja.` file may be a placeholder or legacy artifact.
- **No null-safety for `ResourceManager.GetString`**: Returns `null` if key is missing, which `TranslateExtension` converts to the fallback string. However, if `ResourceManager` itself is misconfigured, lookups may fail silently.
- **No compile-time validation of resource keys**: Typos in XAML (e.g., `{tts:Translate MyKye}`) will only surface at runtime as `#stringnotfound#`.

View File

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

View File

@@ -0,0 +1,232 @@
---
source_files:
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/DigitalOutputChannelsViewModel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/LevelTriggerViewModel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/DigitalInputChannelsViewModel.cs
- DataPRO/Modules/TestSetups/Imports/TTS/ViewModel/TOMChannelsViewModel.cs
generated_at: "2026-04-16T04:50:15.817999+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "a0d4b98d2d85c9f6"
---
# Documentation: TTS Import Channel ViewModels
## 1. Purpose
This module provides view models for managing hardware channel assignments in TTS (Test Technology Suite) import workflows, specifically for digital output (DO), digital input (DI), TOM (Twin Oscillator Module, i.e., squib channels), and level trigger configurations. Each view model acts as a bridge between the UI and the underlying test setup data (`ITTSSetup`), hardware scan results (`IDASHardware`), and sensor-to-channel mapping (`EIDMappingEvent`). They handle real-time updates via Prism events, support interactive channel assignment/removal/enable/disable operations, and maintain UI state such as busy indicators and selection states. The module exists to decouple UI logic from core test setup management and to provide a consistent, event-driven pattern for channel configuration across different channel types.
## 2. Public Interface
### `DigitalOutputChannelsViewModel`
- **`DigitalOutputChannelsViewModel(IDigitalOutputChannelsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions, UI interaction requests, and view binding.
- **`IDigitalOutputChannelsView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for displaying notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmation dialogs.
- **`ObservableCollection<DASChannel> DASChannels { get; set; }`**
Collection of digital output channels discovered during hardware scan, with optional sensor assignments.
- **`DASChannel SelectedDASChannel { get; set; }`**
Currently selected channel in the UI.
- **`string EnableOrDisableText { get; }`**
UI text for the enable/disable button (e.g., “Enable” or “Disable”) based on channel state.
- **`bool IsBusy { get; set; }`**
Indicates whether a background operation is in progress.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags (not used in logic).
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs; no cleanup logic implemented.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs; initialization is handled via constructor event subscriptions.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
### `LevelTriggerViewModel`
- **`LevelTriggerViewModel(ILevelTriggerView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions and UI interaction requests.
- **`ILevelTriggerView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmations.
- **`ILevelTrigger[] LevelTriggers { get; }`**
Exposes `_setup.LevelTriggers` (read-only).
- **`bool IsBusy { get; set; }`**
Busy state indicator.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags.
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
### `DigitalInputChannelsViewModel`
- **`DigitalInputChannelsViewModel(IDigitalInputChannelsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions and UI interaction requests.
- **`IDigitalInputChannelsView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmations.
- **`ObservableCollection<DASChannel> DASChannels { get; set; }`**
Collection of digital input channels discovered during hardware scan.
- **`ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; }`**
Channels from the test setup that are not yet assigned to hardware.
- **`ITTSChannelRecord SelectedRemainingChannel { get; set; }`**
Currently selected unassigned channel.
- **`DASChannel SelectedDASChannel { get; set; }`**
Currently selected hardware channel.
- **`bool AssignEnabled`, `RemoveEnabled`, `EnableOrDisableEnabled { get; set; }`**
UI state flags for command buttons (set via `DetermineRemoveEnableStatus()`).
- **`string EnableOrDisableText { get; }`**
Button text for enable/disable operation.
- **`DelegateCommand AssignCommand { get; }`**
Command to assign a `RemainingChannels` item to a `DASChannel`.
- **`DelegateCommand RemoveCommand { get; }`**
Command to remove a hardware assignment from a `DASChannel`.
- **`DelegateCommand EnableOrDisableCommand { get; }`**
Command to toggle channel disabled state.
- **`bool IsBusy { get; set; }`**
Busy state indicator.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags.
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
### `TOMChannelsViewModel`
- **`TOMChannelsViewModel(ITOMChannelsView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`**
Constructor. Initializes event subscriptions and UI interaction requests.
- **`ITOMChannelsView View { get; set; }`**
Reference to the associated view.
- **`InteractionRequest<Notification> NotificationRequest { get; }`**
Prism interaction request for notifications.
- **`InteractionRequest<Confirmation> ConfirmationRequest { get; }`**
Prism interaction request for confirmations.
- **`ObservableCollection<Model.DASChannel> DASChannels { get; set; }`**
Collection of TOM (squib) channels discovered during hardware scan (every 2nd channel in hardware list).
- **`ObservableCollection<ITTSChannelRecord> RemainingChannels { get; set; }`**
Unassigned TOM channels from the test setup.
- **`ITTSChannelRecord SelectedRemainingChannel { get; set; }`**
Currently selected unassigned channel.
- **`Model.DASChannel SelectedDASChannel { get; set; }`**
Currently selected hardware channel.
- **`bool AssignEnabled`, `RemoveEnabled`, `EnableOrDisableEnabled { get; set; }`**
UI state flags for command buttons.
- **`string EnableOrDisableText { get; }`**
Button text for enable/disable operation.
- **`DelegateCommand AssignCommand { get; }`**
Command to assign a `RemainingChannels` item to a `DASChannel`.
- **`DelegateCommand RemoveCommand { get; }`**
Command to remove a hardware assignment.
- **`DelegateCommand EnableOrDisableCommand { get; }`**
Command to toggle channel disabled state.
- **`bool IsBusy { get; set; }`**
Busy state indicator.
- **`bool IsMenuIncluded`, `IsNavigationIncluded { get; set; }`**
UI layout flags.
- **`void Cleanup()`, `Task CleanupAsync()`**
No-op stubs.
- **`void Initialize(...)`, `Task InitializeAsync(...)`**
No-op stubs.
- **`void Activated()`**
No-op stub.
- **`event PropertyChangedEventHandler PropertyChanged`**
Standard `INotifyPropertyChanged` implementation.
- **`void OnPropertyChanged(string propertyName)`**
Raises `PropertyChanged` event.
## 3. Invariants
- **`_setup` and `_hardware` must be non-null** before `OnAssignedChannelsChangedEvent` (or equivalent) logic executes; otherwise, the method returns early.
- **`DASChannel` instances are constructed with an `IHardwareChannel` and optionally an `ITTSSetup`** (e.g., `new DASChannel(ch, _setup)` in `DigitalOutputChannelsViewModel`).
- **`DASChannel.SetITTSChannelRecord(ITTSChannelRecord)`** is used to associate a hardware channel with a logical channel record; passing `null` removes the association.
- **`DASChannel.EID` is populated from `_hardwareChannelIdToSensorId` (or `_sensorIdToChannelId` in `LevelTriggerViewModel`) only if the hardware channel ID exists as a key.**
- **`IsBusy` is updated only via `OnBusyIndicatorNotification(bool)`**, triggered by `BusyIndicatorChangeNotification` event.
- **`IsMenuIncluded` and `IsNavigationIncluded` are UI flags only; they do not affect business logic.**
- **`IsDirty` is declared but never set; it remains `false` throughout the lifetime of the view model.**
- **`EnableOrDisableText` is computed from `SelectedDASChannel?.Channel?.Disabled` and `StringResources` constants.**
- **`LevelTriggers` is read-only and derived from `_setup.LevelTriggers`; no direct modification is performed in `LevelTriggerViewModel`.**
- **`TOMChannelsViewModel` only processes hardware channels where `ch.IsSquib` is true, and iterates hardware channels in pairs (`i += 2`) to select squib channels.**
- **`DigitalInputChannelsViewModel` and `TOMChannelsViewModel` share identical command logic (`Assign`, `Remove`, `EnableOrDisable`) and state management (`DetermineRemoveEnableStatus`).**
## 4. Dependencies
### Internal Dependencies (from source)
- **`DTS.Common.Events.TTSImport`**
Events: `AssignedChannelsChangedEvent`, `TTSImportHardwareScanFinishedEvent`, `TTSImportReadFileStatusEvent`, `EIDMappingEvent`, `TTSImportSavedChangesStatusEvent`, `TTSImportTestSetupChangedEvent`, `RaiseNotification`, `BusyIndicatorChangeNotification`.
- **`DTS.Common.Interface.TestSetups.Imports.TTS.*`**
Interfaces: `IDigitalOutputChannelsView`, `IDigitalInputChannelsView`, `ITOMChannelsView`, `ILevelTriggerView`, `IDigitalOutputChannelsViewModel`, `IDigitalInputChannelsViewModel`, `ITOMChannelsViewModel`, `ILevelTriggerViewModel`.
- **`DTS.Common.Interface.DataRecorders`**
Interfaces: `IDASHardware`, `IHardwareChannel`.
- **`DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile`**
Interfaces: `ITTSSetup`, `ITTSChannelRecord`.
- **`TTSImport.Model`**
Classes: `DASChannel`, `TTSChannelRecord`.
- **`TTSImport.Resources`**
Static resources: `StringResources` (e.g., `Analog_Enable`, `AssignSensorPrompt`).
- **`Prism.Events`**
`IEventAggregator`, `PubSubEvent<T>`.
- **`Prism.Regions`**
`IRegionManager`.
- **`Unity`**
`IUnityContainer`.
- **`Prism.Commands`**
`DelegateCommand`.
- **`DTS.Common.DAS.Concepts`**
`DASChannel` (in `LevelTriggerViewModel`).
- **`DTS.Common.Enums`**
`ExcitationVoltageOptions`, `DigitalInputModes`.
- **`DTS.DASLib.Service`**
Referenced in `TOMChannelsViewModel` (no direct usage in provided code).
### External Dependencies
- **WPF (`System.Windows`, `System.Windows.Data`)**
Used for `ICollectionView`, `CollectionViewSource`, `Dispatcher`, `MessageBox`.
- **.NET Core/Standard libraries**
`System.Collections.ObjectModel`, `System.ComponentModel`, `System.Threading.Tasks`, `System.Linq`.
### Inferred Usage
- **`DigitalOutputChannelsViewModel`** is used when configuring digital output channels after hardware scan and EID mapping.
- **`DigitalInputChannelsViewModel`** and **`TOMChannelsViewModel`** are used for interactive assignment of unassigned channels to hardware, with similar UI patterns.
- **`LevelTriggerViewModel`** is used for level trigger configuration and relies on `TTSImportReadFileStatusEvent` and `TTSImportSavedChangesStatusEvent` to trigger `UpdateLevelTriggers()`.
- All view models depend on `AssignedChannelsChangedEvent` to refresh channel lists when assignments change elsewhere in the system.
## 5. Gotchas
- **`IsDirty` is never set to `true`** — it is declared but unused. Any change detection must be handled externally (e.g., via `TTSImportTestSetupChangedEvent`).
- **`Cleanup()` and `Initialize()` methods are no-ops** — no resource cleanup or initialization logic is implemented in these methods.
- **`LevelTriggers` is read-only** — `LevelTriggerViewModel` does not support creating or deleting level triggers; it only exposes existing ones.
- **`TOMChannelsViewModel` assumes squib channels are paired** — it iterates hardware channels in steps of 2 (`i += 2`) to select squib channels, which may not hold if hardware layout changes.
- **`DigitalInputChannelsViewModel` and `TOMChannelsViewModel` use `SelectedRemainingChannel` and `SelectedDASChannel` to control button states**, but selection changes may not trigger `DetermineRemoveEnableStatus()` if not handled via property setters (e.g., programmatic selection may require manual `OnPropertyChanged`).
- **`AssignWork()` in `DigitalInputChannelsViewModel` and `TOMChannelsViewModel` modifies `RemainingChannels` and `DASChannels` collections directly**, which may cause UI flicker or require `CollectionViewSource.GetDefaultView(...).Refresh()` to update.
- **`OnAssignedChannelsChangedEvent` in `DigitalOutputChannelsViewModel` creates new `TTSChannelRecord` instances for unassigned channels**, but does not add them to `_setup.Channels` — only the `DASChannel` is updated. This may lead to inconsistencies if `_setup.Channels` is expected to be authoritative.
- **`OnEIDComplete` in `DigitalOutputChannelsViewModel` inverts the sensor-to-channel mapping**, but only if the input dictionary is non-empty. If empty, `_hardwareChannelIdToSensorId` remains an empty dictionary.
- **`VoltageIsValid` in `LevelTriggerViewModel` catches all exceptions from `GetExcitationVoltageEnumFromMagnitude`**, which may hide invalid voltage inputs (e.g., negative or unsupported values).
- **`DigitalInputChannelsViewModel` and `TOMChannelsViewModel` use `MessageBox.Show` for confirmation prompts**, which is synchronous and may block the UI thread. The use of `Task.Run` around `MessageBox.Show` is unnecessary and misleading (UI calls must be on the UI thread).
- **`EnableOrDisableText` uses `StringResources.Analog_Enable` and `StringResources.Analog_Disable`** — misleading naming for digital channels.
- **`DASChannel.EID` is only set if the hardware channel ID exists in `_hardwareChannelIdToSensorId`** — if the mapping is incomplete, EID may be missing even if a sensor is physically present.
- **No validation is performed on `SelectedDASChannel` or `SelectedRemainingChannel` before assignment** — null checks are present in command handlers but not in property setters.
- **`LevelTriggerViewModel` does not expose `DASChannels` or `RemainingChannels`** — it only exposes `LevelTriggers`, making it impossible to view or edit channel assignments directly in this view model.

View File

@@ -0,0 +1,124 @@
---
source_files:
- DataPRO/Modules/TestSetups/TestSetupsList/TestSetupsListModule.cs
generated_at: "2026-04-16T04:49:23.313848+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "1fee89a0c4c9616a"
---
# TestSetupsList
## Documentation: `TestSetupsListModule`
---
### 1. **Purpose**
The `TestSetupsListModule` is a Prism-based modular component responsible for registering the view and view model for the *Test Setups List* UI section within the application. It integrates with the Unity dependency injection container to expose the `ITestSetupsListView` and `ITestSetupsListViewModel` types as singleton registrations, enabling the main shell to instantiate and display the test setups list UI. Additionally, it provides assembly-level metadata via custom attributes (`TestSetupsListModuleNameAttribute`, `TestSetupsListModuleImageAttribute`) used by the host application to render module information (e.g., name, icon, group, region) on the main screen.
---
### 2. **Public Interface**
#### `TestSetupsListModule` class
- **`TestSetupsListModule(IUnityContainer unityContainer)`**
Constructor. Accepts and stores a reference to the Unity container for later registration of types.
- **`void Initialize()`**
Registers two types as singletons in the Unity container:
- `ITestSetupsListView``TestSetupsListView`
- `ITestSetupsListViewModel``TestSetupsListViewModel`
This method is called both directly from the constructor (via `RegisterTypes`) and explicitly by Prism during module initialization.
- **`void OnInitialized(IContainerProvider containerProvider)`**
Currently empty. No logic is executed during Prisms `OnInitialized` phase.
- **`void RegisterTypes(IContainerRegistry containerRegistry)`**
Delegates to `Initialize()`, which performs the actual Unity registrations. Note: Although the parameter `containerRegistry` is of type `IContainerRegistry` (Prisms abstraction), the implementation ignores it and uses the injected `IUnityContainer` instance instead.
#### `TestSetupsListModuleNameAttribute` class
- **`TestSetupsListModuleNameAttribute()` / `TestSetupsListModuleNameAttribute(string s)`**
Constructor. Sets `AssemblyName` to `AssemblyNames.TestSetupsList.ToString()`.
- **`string AssemblyName { get; }`**
Returns `"TestSetupsList"` (value of `AssemblyNames.TestSetupsList.ToString()`).
- **`Type GetAttributeType()`**
Returns `typeof(TextAttribute)`.
- **`string GetAssemblyName()`**
Returns the value of `AssemblyName`.
#### `TestSetupsListModuleImageAttribute` class
- **`TestSetupsListModuleImageAttribute()` / `TestSetupsListModuleImageAttribute(string s)`**
Constructor. Loads the assembly image via `AssemblyInfo.GetImage("TestSetupsList")`.
- **`BitmapImage AssemblyImage { get; }`**
Returns the image loaded by `AssemblyInfo.GetImage("TestSetupsList")`.
- **`string AssemblyName { get; }`**
Returns `"TestSetupsList"`.
- **`string AssemblyGroup { get; }`**
Returns `"Prepare"` (value of `eAssemblyGroups.Prepare.ToString()`).
- **`eAssemblyRegion AssemblyRegion { get; }`**
Returns `eAssemblyRegion.TestSetupsListRegion`.
- **`Type GetAttributeType()`**
Returns `typeof(ImageAttribute)`.
- **`BitmapImage GetAssemblyImage()`**
Returns `AssemblyImage`.
- **`string GetAssemblyName()`**
Returns `AssemblyName`.
- **`string GetAssemblyGroup()`**
Returns `AssemblyGroup`.
- **`eAssemblyRegion GetAssemblyRegion()`**
Returns `AssemblyRegion`.
---
### 3. **Invariants**
- The `TestSetupsListModule` **must** be loaded *after* the Unity container is available and *before* any view resolution for `ITestSetupsListView` or `ITestSetupsListViewModel` occurs.
- `AssemblyNames.TestSetupsList`, `eAssemblyGroups.Prepare`, and `eAssemblyRegion.TestSetupsListRegion` must be defined elsewhere (e.g., in `DTS.Common`), and their values are assumed constant and correct at runtime.
- The `AssemblyInfo.GetImage(...)` call in `TestSetupsListModuleImageAttribute` must succeed and return a non-null `BitmapImage`; otherwise, the UI may fail to render the module icon.
- All registrations in `Initialize()` are **singleton** (default Unity behavior for `RegisterType<T, TImpl>()` without specifying lifetime).
- The `RegisterTypes` method is expected to be invoked by Prism during module initialization, and its side effects (registrations) must be idempotent (though Unity will throw if re-registering the same mapping without clearing, this is not guarded against in the source).
---
### 4. **Dependencies**
#### *Dependencies of this module:*
- **`DTS.Common`** — Provides core types: `AssemblyNames`, `eAssemblyGroups`, `eAssemblyRegion`, `AssemblyInfo`, `TextAttribute`, `ImageAttribute`.
- **`Prism.Modularity`** — Defines `IModule`, `IContainerProvider`, `IContainerRegistry`.
- **`Prism.Ioc`** — Defines `IContainerProvider`, `IContainerRegistry`.
- **`Unity`** — Defines `IUnityContainer`.
- **`System.ComponentModel.Composition`** — Used for `[Export]` attribute.
- **`System.Windows.Media.Imaging`** — Used for `BitmapImage`.
#### *Dependencies on this module:*
- The **main shell/application** depends on this module to provide the `ITestSetupsListView` and `ITestSetupsListViewModel` types for UI composition.
- Other modules or services may depend on the *presence* of the `TestSetupsListRegion` (via `eAssemblyRegion.TestSetupsListRegion`) to inject content into the correct region.
---
### 5. **Gotchas**
- **Redundant `Initialize()` call**: `RegisterTypes` calls `Initialize()`, but `Initialize()` is also called in the constructor. This means registrations occur *twice* during module startup — once in the constructor, and again via `RegisterTypes`. While Unity may silently ignore duplicate registrations (depending on version/config), this is inefficient and could mask bugs if registration logic changes.
- **`IContainerRegistry` ignored**: The `RegisterTypes` method receives a Prism `IContainerRegistry`, but uses the injected `IUnityContainer` instead. This tightly couples the module to Unity and breaks Prisms container abstraction. It may cause issues if the host switches to a different DI container (e.g., DryIoc, Microsoft.Extensions.DependencyInjection).
- **No error handling**: If `AssemblyInfo.GetImage(...)` returns `null` (e.g., missing image resource), the `AssemblyImage` property will be `null`, potentially causing UI rendering failures with no clear diagnostic.
- **Assembly-level attributes**: The `[assembly: ...]` attributes are applied at the assembly level, but their usage (e.g., discovery by the host) is not visible in this module. Their behavior depends on external logic (e.g., reflection scanning by the shell).
- **Unused parameter `s`**: Both attribute constructors accept a `string s` parameter but ignore it — likely legacy or placeholder.
- **Missing `OnInitialized` logic**: The `OnInitialized` method is empty; if future logic requires coordination with other modules, this will need implementation.
> **None identified from source alone.** *(Note: The above are inferred from code structure and patterns; they are not explicit bugs but represent design decisions or potential risks.)*

View File

@@ -0,0 +1,64 @@
---
source_files:
- DataPRO/Modules/TestSetups/TestSetupsList/Model/TestSetupComparer.cs
generated_at: "2026-04-16T04:51:41.503080+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c8e267fd60a22a5e"
---
# Model
### **Purpose**
The `TestSetupComparer` class provides a customizable comparison implementation for sorting collections of `ITestSetup` objects. It enables ordering test setups by various fields (e.g., name, description, timestamps) in either ascending or descending order, supporting UI-driven sorting scenarios (e.g., table column sorting). It serves as a concrete implementation of `IComparer<ITestSetup>` to integrate with .NETs sorting infrastructure (e.g., `List<T>.Sort`, LINQs `OrderBy`).
---
### **Public Interface**
#### `public class TestSetupComparer : IComparer<ITestSetup>`
A comparer that compares two `ITestSetup` instances based on configurable criteria.
- **`public TestSetupFields SortField { get; set; } = TestSetupFields.Name;`**
Gets or sets the field by which to sort. Defaults to `TestSetupFields.Name`. Must be a valid member of the `TestSetupFields` enum (defined in `DTS.Common.Enums.TestSetups.TestSetupList`).
- **`public bool SortAscending { get; set; } = true;`**
Gets or sets the sort direction. `true` for ascending order (default), `false` for descending.
- **`public int Compare(ITestSetup left, ITestSetup right)`**
Compares two `ITestSetup` instances (`left` and `right`) based on the current `SortField` and `SortAscending` settings. Returns:
- `< 0` if `left` < `right` (ascending) or `left` > `right` (descending),
- `0` if equal,
- `> 0` if `left` > `right` (ascending) or `left` < `right` (descending).
Handles `null` inputs: `null` is treated as *less than* any non-null value. If `SortField` is unrecognized, falls back to comparing hash codes.
---
### **Invariants**
- `SortField` must be one of the values defined in `TestSetupFields` (from `DTS.Common.Enums.TestSetups.TestSetupList`). Invalid values are *not* validated at runtime; they fall through to the hash-code comparison fallback.
- `null` is consistently ordered before non-null instances, regardless of `SortField` or `SortAscending`.
- If `left == right` (reference equality), `Compare` returns `0` *before* evaluating field values.
- The comparison for string fields (`Name`, `Description`, `LastModifiedBy`) is **case-insensitive** (`StringComparison.OrdinalIgnoreCase`).
- The comparison for numeric/enum fields (`RecordingMode`, `PreTriggerSeconds`, `PostTriggerSeconds`, `LastModified`, `IsComplete`) uses their respective `IComparable.CompareTo` implementations.
---
### **Dependencies**
- **Imports/References**:
- `DTS.Common.Enums.TestSetups.TestSetupList` → Provides `TestSetupFields` enum.
- `DTS.Common.Interface.TestSetups.TestSetupsList` → Defines `ITestSetup` interface (contract for test setup objects).
- **Depended upon by**:
- Any code requiring sorted `ITestSetup` collections (e.g., UI view models, data grids, or list processors in the `TestSetupsList` module or related layers).
- *Inferred*: Likely used in conjunction with `ITestSetup` implementations (e.g., concrete test setup classes implementing the interface).
---
### **Gotchas**
- **No validation of `SortField`**: If `SortField` is set to an undefined or future enum value, the `switch` falls back to `a.GetHashCode().CompareTo(b.GetHashCode())`, which yields *unstable* and *semantically meaningless* ordering.
- **Hash-code fallback is unsafe for sorting**: Using `GetHashCode()` as a tiebreaker (or primary fallback) does not guarantee transitivity or consistency across runs (hash codes may vary per process), potentially violating `IComparer` contract requirements.
- **No null-safety for `ITestSetup` properties**: The comparer assumes `a.Name`, `a.Description`, etc., are non-null. If any property (e.g., `LastModifiedBy`) is `null`, `string.Compare` or `CompareTo` may throw `NullReferenceException`.
- **Reference equality check before null checks**: The initial `if (left == right)` check is redundant with later `if (a == b)` after swapping, but harmless.
- **No handling of `DateTime` precision**: `LastModified` comparison relies on `DateTime.CompareTo`, which includes ticks—sub-millisecond differences may matter in edge cases.
- **Case-insensitive string comparison may be inconsistent across cultures**: `StringComparison.OrdinalIgnoreCase` is safe for English, but not fully culture-agnostic (e.g., Turkish 'i' issues are avoided, but other edge cases may exist).
*None identified beyond the above.*

View File

@@ -0,0 +1,62 @@
---
source_files:
- DataPRO/Modules/TestSetups/TestSetupsList/Properties/Settings.Designer.cs
- DataPRO/Modules/TestSetups/TestSetupsList/Properties/AssemblyInfo.cs
generated_at: "2026-04-16T04:51:28.954974+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ad8e54ff33790aba"
---
# Properties
## Documentation Page: `TestSetupsList.Properties.Settings`
---
### 1. **Purpose**
This module provides strongly-typed, application-scoped settings access for the `TestSetupsList` module via the .NET `ApplicationSettingsBase` infrastructure. It serves as the runtime accessor for user- or application-level configuration values (though no settings properties are currently defined in the generated code), enabling consistent retrieval of persisted configuration data using the standard .NET settings pattern. As a generated file, it is not intended for manual modification and exists solely to support the modules integration with Visual Studios settings designer.
---
### 2. **Public Interface**
- **`Settings.Default`**
```csharp
internal static Settings Default { get; }
```
A static property returning the singleton instance of the `Settings` class, synchronized for thread safety via `ApplicationSettingsBase.Synchronized`. This is the *only* public entry point to the settings system in this module. No additional properties or methods are defined in the source—any settings (e.g., `string TestSetupPath`, `bool AutoLoadLast`) would be auto-generated as instance properties on the `Settings` class but are not present in the provided snippet.
---
### 3. **Invariants**
- The `Settings` class is **sealed** and **internal**, preventing inheritance or external instantiation.
- Thread-safety is enforced via `ApplicationSettingsBase.Synchronized`, ensuring the singleton instance is safe for concurrent access.
- The `Default` property always returns the same instance (singleton behavior), initialized once on first access.
- The class inherits from `ApplicationSettingsBase`, which enforces that settings values conform to their declared types and default values as defined in the `.config` file or designer.
---
### 4. **Dependencies**
- **Dependencies *of* this module**:
- `System.Configuration` (for `ApplicationSettingsBase`)
- `System.Runtime.CompilerServices` (for `CompilerGeneratedAttribute`)
- `System.CodeDom.Compiler` (for `GeneratedCodeAttribute`)
- `System.Runtime.InteropServices` (for `ComVisibleAttribute`, referenced in `AssemblyInfo.cs`)
- **Dependencies *on* this module**:
- Other modules or classes within `TestSetupsList` (or the broader `DataPRO` solution) may consume `TestSetupsList.Properties.Settings.Default` to read persisted settings. However, no direct usages are visible in the provided source files.
---
### 5. **Gotchas**
- **No settings are currently defined**: The `Settings` class contains only boilerplate code (singleton accessor and attributes). No user-defined settings properties (e.g., `public string SomeSetting { get; set; }`) appear in the source—these would be auto-generated by Visual Studios settings designer and are absent here. Thus, `Settings.Default` currently exposes *no configurable values*.
- **Auto-generated file**: Manual edits will be overwritten on regeneration (e.g., after modifying settings in the IDE). Configuration changes must be made via the Visual Studio settings designer (`.settings` file) or directly in the `App.config`/`TestSetupsList.exe.config`.
- **Thread-safety overhead**: While `Synchronized()` ensures thread safety, it may introduce performance overhead in high-frequency access scenarios—though this is unlikely for settings, which are typically read infrequently.
- **Assembly versioning**: The assembly version is hardcoded to `1.0.0.0` (with `AssemblyFileVersion` identical), which may complicate version tracking or side-by-side deployments if not managed externally.
> **Note**: Since no settings properties are defined in the provided source, behavior beyond the singleton accessor cannot be documented. Any runtime settings usage must be inferred from other modules or files not included here.

View File

@@ -0,0 +1,80 @@
---
source_files:
- DataPRO/Modules/TestSetups/TestSetupsList/Resources/TranslateExtension.cs
- DataPRO/Modules/TestSetups/TestSetupsList/Resources/StringResources.Designer.cs
generated_at: "2026-04-16T04:51:19.579629+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "9ca0cf52c1c54e32"
---
# Resources
## Documentation: `TranslateExtension` Markup Extension
---
### 1. Purpose
The `TranslateExtension` class is a WPF `MarkupExtension` used to enable localized string binding in XAML. It resolves resource keys (e.g., `"Name"`, `"Description"`) to their corresponding localized string values at runtime by querying the strongly-typed `StringResources` class. This allows UI elements (e.g., `TextBlock.Text`, `HeaderedContentControl.Header`) to display culture-specific text without hardcoding strings, supporting internationalization of the TestSetupsList module.
---
### 2. Public Interface
#### `TranslateExtension` class
- **Constructor**
```csharp
public TranslateExtension(string key)
```
- **Parameters**:
- `key`: The resource key (e.g., `"Name"`, `"LastModifiedBy"`) used to look up a localized string in `StringResources`.
- **Behavior**: Stores the key for later resolution during `ProvideValue`.
- **`ProvideValue` method**
```csharp
public override object ProvideValue(IServiceProvider serviceProvider)
```
- **Returns**:
- If `_key` is `null` or empty → `"#stringnotfound#"`
- If `StringResources.ResourceManager.GetString(_key)` returns a non-null value → that string
- Otherwise → `"#stringnotfound# " + _key` (e.g., `"#stringnotfound# UnknownKey"`)
- **Behavior**: Performs the actual resource lookup. Does *not* use the `serviceProvider` parameter (per source).
---
### 3. Invariants
- `_key` is immutable after construction (no setter, no modification in `ProvideValue`).
- Resource keys are expected to match *exact* keys in the `.resx` file (e.g., `"Name"`, `"PreTriggerSeconds"`), case-sensitive.
- The fallback string `"#stringnotfound#"` is hardcoded and used for both missing keys and empty keys.
- `StringResources.ResourceManager.GetString(_key)` is called with the *current UI culture* (via `CultureInfo` stored in `StringResources.Culture`), not thread culture directly.
- `StringResources` is auto-generated; manual edits to `StringResources.Designer.cs` will be overwritten.
---
### 4. Dependencies
#### Dependencies *of* `TranslateExtension`:
- `System.Windows.Markup.MarkupExtension` (WPF base class)
- `TestSetupsList.Resources.StringResources` (strongly-typed resource class)
- Relies on `System.Resources.ResourceManager` and `System.Globalization.CultureInfo`
- Requires the `StringResources.resx` file to be compiled into the `TestSetupsList` assembly (implied by `"TestSetupsList.Resources.StringResources"` in `ResourceManager` constructor).
#### Dependencies *on* `TranslateExtension`:
- XAML files in the `TestSetupsList` module that use `{local:Translate KeyName}` syntax (where `local` maps to `TestSetupsList` namespace).
- No direct runtime dependencies beyond WPF and the resource assembly.
---
### 5. Gotchas
- **No null-safety for missing keys**: A key like `"NonExistent"` yields `"#stringnotfound# NonExistent"` — not `null`, not an exception. This may cause visible artifacts in UI if not handled.
- **Empty key handling**: Passing `""` or `null` to the constructor returns `"#stringnotfound#"` silently — no warning or exception.
- **No caching of resolved values**: `ProvideValue` calls `ResourceManager.GetString(_key)` on *every invocation* (e.g., if used in a `DataTemplate` with many items). This is likely acceptable for typical UI strings but could be optimized.
- **No support for format strings or parameters**: Unlike `String.Format`, this extension does *not* support placeholders (e.g., `"Hello {0}"`). Resource keys must resolve to fully formed strings.
- **Designer.cs auto-generation warning**: Manual changes to `StringResources.Designer.cs` will be lost on rebuild. Resource keys must be added/modified via the `.resx` designer or file.
- **No `serviceProvider` usage**: The `ProvideValue` method ignores the WPF-provided `IServiceProvider`, meaning it cannot resolve culture dynamically per context (e.g., per element). Relies solely on `StringResources.Culture`.
None identified beyond the above.

View File

@@ -0,0 +1,55 @@
---
source_files:
- DataPRO/Modules/TestSetups/TestSetupsList/View/TestSetupsListView.xaml.cs
generated_at: "2026-04-16T04:51:42.688811+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "41a808b797fa9251"
---
# View
### **1. Purpose**
This module implements the WPF view layer (`TestSetupsListView`) for the test setups list UI component. It serves as the concrete implementation of the `ITestSetupsListView` interface, handling user interactions such as column header clicks (for sorting), searchable column header events (for filtering), and double-clicks on list items (to trigger a view-model action). It bridges the UI (defined in `TestSetupsListView.xaml`) with the view model (`ITestSetupsListViewModel`) by translating WPF events into structured view-model method calls.
---
### **2. Public Interface**
The class itself is public and implements `ITestSetupsListView`, but the source file does **not expose any public methods or properties beyond the constructor**. All behavior is implemented via private event handlers wired in XAML (not shown). The public interface is therefore:
- **`TestSetupsListView()`**
Public constructor. Calls `InitializeComponent()` to load the XAML-defined UI. This is the standard WPF entry point for initializing the view.
> **Note**: All interaction logic resides in *private* event handlers (`ListViewHeader_Click`, `GridViewColumnHeaderSearchable_OnSearch`, `GridViewColumnHeader_OnClick`, `MouseDoubleClick`). These are invoked via XAML event bindings and are not directly callable from outside the class.
---
### **3. Invariants**
- The `DataContext` of the `ListView` (and thus the view) **must** be an instance implementing `ITestSetupsListViewModel`. This is assumed by all event handlers (e.g., `vm?.Sort(...)`, `vm.Filter(...)`, `vm.MouseDoubleClick(...)`).
- Column headers used for sorting **must** have their `Tag` property set to a valid sort key (typically a string or enum representing the column/field).
- For searchable column headers, the `Tag` property must be set to identify the column for filtering, and the `GridViewColumnHeaderSearchable` type must be used (from `DTS.Common.Controls`).
- The `MouseDoubleClick` handler assumes the `ListView` contains items in a one-to-one mapping with indices; it uses `ItemContainerGenerator.ContainerFromIndex` to resolve the visual item under the mouse.
---
### **4. Dependencies**
**Imports/References (from source):**
- `System.Windows.*` (WPF core: `Window`, `Controls`, `Data`, `Media`, `Input`)
- `DTS.Common.Controls` (provides `GridViewColumnHeaderSearchable`, `Utils.FindChild<T>`)
- `DTS.Common.Interface.TestSetups.TestSetupsList` (provides `ITestSetupsListView`, `ITestSetupsListViewModel`)
- `DTS.Common.Utils` (provides utility methods like `Utils.FindChild<T>`)
**Depended on by:**
- XAML (`TestSetupsListView.xaml`) — binds events to the private handlers.
- The view model (`ITestSetupsListViewModel` implementation) — must be assigned to `DataContext` for the view to function.
- Likely consumed by a parent view or navigation system that instantiates `TestSetupsListView` as a control.
---
### **5. Gotchas**
- **Ambiguous event routing**: Two handlers (`ListViewHeader_Click` and `GridViewColumnHeader_OnClick`) appear to handle column header clicks. `ListViewHeader_Click` assumes `e.OriginalSource` is a `GridViewColumnHeader`, while `GridViewColumnHeader_OnClick` uses `sender as GridViewColumnHeaderSearchable` and falls back to `Utils.FindChild<GridViewColumnHeaderSearchable>`. This suggests legacy or overlapping event wiring—caution is needed to avoid duplicate sorting/filtering logic.
- **Null-safety reliance**: The `MouseDoubleClick` handler uses `vm?.Sort(...)` and similar null-conditional operators, implying `DataContext` may sometimes be `null`. However, the view is likely unusable without a valid view model.
- **Index resolution fragility**: `GetCurrentIndex` iterates over `lv.Items.Count`, calling `ContainerFromIndex`—which may return `null` for virtualized or not-yet-realized items. This could cause double-clicks near the edge of the viewport to be missed.
- **Search handler signature mismatch**: `GridViewColumnHeaderSearchable_OnSearch` casts `e.OriginalSource` to `string` for `searchTerm`, but `RoutedEventArgs.OriginalSource` is typically a UI element (e.g., a `TextBox` or `ComboBox`). This suggests the XAML passes the search term via `CommandParameter` or similar, but the cast is unsafe and likely incorrect unless the event is routed from a custom control.
- **No public API for programmatic control**: The view offers no methods to programmatically trigger sorting/filtering—only via user interaction. This limits testability and integration flexibility.
- **Missing documentation**: The class inherits XML doc from `ITestSetupsListView`, but the interface itself is not included—behavioral details of `Sort`, `Filter`, and `MouseDoubleClick` are inferred from usage, not defined here.

View File

@@ -0,0 +1,119 @@
---
source_files:
- DataPRO/Modules/TestSetups/TestSetupsList/ViewModel/TestSetupsListViewModel.cs
generated_at: "2026-04-16T04:51:29.820169+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "ed9dca56ffa30a15"
---
# ViewModel
## Documentation: `TestSetupsListViewModel`
---
### 1. **Purpose**
This module implements the view model for the Test Setups list UI, responsible for managing the display, filtering, sorting, and selection of test setups in the application. It acts as the intermediary between the `ITestSetupsListView` (view) and the underlying data (`ITestSetup[]`), coordinating with Prisms event aggregation system to decouple UI interactions (e.g., selection, double-click) from other system components. It supports multi-field filtering, column-based sorting, busy state indication, and notification display via interaction requests.
---
### 2. **Public Interface**
#### **Properties**
| Property | Type | Description |
|---------|------|-------------|
| `View` | `ITestSetupsListView` | Reference to the associated view; views `DataContext` is set to `this` in constructor. |
| `NotificationRequest` | `InteractionRequest<Notification>` | Prism interaction request used to raise notification popups. |
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | Prism interaction request used to raise confirmation dialogs. |
| `SelectedTestSetupIndex` | `int` | Zero-based index of the currently selected item in the list view; defaults to `-1`. |
| `SelectedTestSetupItems` | `BulkObservableCollection<ITestSetup>` | Collection of currently selected test setups; raises `TestSetupsListTestSetupSelectedEvent` on change. |
| `TestSetups` | `ITestSetup[]` | Current filtered/sorted list of test setups displayed in the view. |
| `IsDirty` | `bool` | Read-only; always `false` (no dirty state tracked). |
| `IsBusy` | `bool` | Indicates whether a long-running operation is in progress; updated via `BusyIndicatorChangeNotification` event. |
| `IsMenuIncluded` | `bool` | Controls visibility of menu UI elements. |
| `IsNavigationIncluded` | `bool` | Controls visibility of navigation UI elements. |
| `ListViewId` | `string` | Returns `"TestSetupsListView"`; used for event scoping. |
#### **Methods**
| Method | Signature | Description |
|--------|-----------|-------------|
| `ClearAllFilters` | `public void ClearAllFilters()` | Clears all per-field search terms stored in `_currentSearchTermByField`. |
| `Unset` | `public void Unset()` | Resets internal state: clears `_allTestSetup` and `TestSetups`, clears filters, and publishes `ListViewStatusEvent` with status `Unloaded`. |
| `Sort` | `public void Sort(object o, bool bColumnClick)` | Sorts `TestSetups` by field (`o` as `string` tag parsed to `TestSetupFields`). If `bColumnClick` is `true`, toggles sort direction on repeated clicks of same column; otherwise, applies current sort without toggling. |
| `Filter` | `public void Filter(object objectTag, string term)` | Sets per-field search term for `TestSetupFields` parsed from `objectTag`, then invokes `Filter(string)`. |
| `Filter` | `public void Filter(string term)` | Applies global search `term` (case-insensitive substring match) across *all* fields using `ITestSetup.Filter(string)` and `TestSetupFilter`. Updates `TestSetups`. |
| `SetTestSetups` | `public void SetTestSetups(ITestSetup[] allTestSetupsForUser)` | Sets `_allTestSetup`, then applies current filter and sort to populate `TestSetups`. |
| `Cleanup` | `public void Cleanup()` | No-op. |
| `CleanupAsync` | `public Task CleanupAsync()` | Returns `Task.CompletedTask`. |
| `Initialize` / `InitializeAsync` | Multiple overloads | All no-ops; no initialization logic implemented. |
| `Activated` | `public void Activated()` | No-op. |
| `MouseDoubleClick` | `public void MouseDoubleClick(int index)` | If valid index and exactly one item selected, publishes `TestSetupsListEditTestSetupEvent` with the selected test setups `Name`. |
#### **Private Helpers**
| Method | Signature | Description |
|--------|-----------|-------------|
| `TestSetupFilter` | `private bool TestSetupFilter(ITestSetup t)` | Implements per-field filtering logic: for each field with a non-empty search term, checks case-insensitive substring match (or boolean conversion for `IsComplete`). Returns `false` if any field fails. |
| `FireSelectionChanged` | `private void FireSelectionChanged()` | Publishes `TestSetupsListTestSetupSelectedEvent` with array of selected test setup names. |
| `SelectedTestSetupItemsOnCollectionChanged` | `private void SelectedTestSetupItemsOnCollectionChanged(...)` | Handles `CollectionChanged`; skips re-firing selection event if `GetUpdating()` returns `true` and collection is non-null/non-empty (workaround for bug #18382). |
---
### 3. **Invariants**
- `TestSetups` is always a subset of `_allTestSetup`, filtered and sorted per current criteria.
- `_currentSearchTermByField` keys are exclusively `TestSetupFields` enum values.
- `SelectedTestSetupItems.CollectionChanged` event is subscribed exactly once per assignment (unsubscribes old, subscribes new).
- `IsBusy` is updated only via subscription to `BusyIndicatorChangeNotification` event.
- `ListViewId` is constant: `"TestSetupsListView"`.
- `SelectedTestSetupItems` defaults to a `BulkObservableCollection<ITestSetup>`; never `null` after construction.
- `TestSetups` is initialized as `new ITestSetup[0]` in `Unset()` and constructor; never `null`.
- `Sort()` ensures `TestSetups` is never left unsorted; if already sorted, flips direction and re-sorts.
---
### 4. **Dependencies**
#### **Imports/Usings (External)**
- `Prism.Events` (`IEventAggregator`, `EventBase`)
- `Prism.Regions` (`IRegionManager`)
- `Unity` (`IUnityContainer`)
- `DTS.Common.Events.*` (e.g., `RaiseNotification`, `BusyIndicatorChangeNotification`, `ListViewStatusEvent`, `TestSetupsListEditTestSetupEvent`, `TestSetupsListTestSetupSelectedEvent`)
- `DTS.Common.Interface.TestSetups.TestSetupsList` (`ITestSetupsListView`, `ITestSetup`)
- `DTS.Common.Enums.TestSetups.TestSetupList` (`TestSetupFields`, `ListViewStatusArg`)
- `DTS.Common.Interactivity` (`InteractionRequest<Notification>`, `InteractionRequest<Confirmation>`)
- `DTS.Common.Classes` (`BulkObservableCollection<T>`)
#### **Internal Dependencies**
- `TestSetupsList.Model` namespace (likely contains `TestSetupComparer`, `ITestSetup` implementations).
- `ITestSetup` interface must define:
- `Name`, `Description`, `RecordingMode`, `PreTriggerSeconds`, `PostTriggerSeconds`, `LastModified`, `LastModifiedBy`, `IsComplete` properties.
- `Filter(string term)` method for global search.
#### **Consumers (Inferred)**
- `TestSetupsListEditTestSetupEvent` subscribers (e.g., edit view model/controller).
- `TestSetupsListTestSetupSelectedEvent` subscribers (e.g., detail view or command handlers).
- `ListViewStatusEvent` subscribers (e.g., layout or state manager).
- `RaiseNotification` and `BusyIndicatorChangeNotification` publishers.
---
### 5. **Gotchas**
- **`IsDirty` is unused**: Always `false`; no dirty state tracking is implemented despite property existence.
- **`Initialize*` and `Cleanup*` methods are no-ops**: Despite implementing Prisms `INavigationAware`/`IInitializeAsync` patterns, no initialization or cleanup logic is present.
- **`Sort()` behavior on identical sequences**: If the list is already sorted, it flips `_sortAscending` and re-sorts — this may cause unexpected sort direction toggling on first sort if data was pre-sorted.
- **`TestSetupFilter` uses `Convert.ToBoolean(term)` for `IsComplete`**: Fails if `term` is not `"True"`/`"False"` (case-insensitive); throws `FormatException` for invalid strings.
- **`MouseDoubleClick` requires exactly one selected item**: Double-click only triggers edit if `SelectedTestSetupItems.Count == 1`; multi-select disables this behavior.
- **Bug workaround in `SelectedTestSetupItemsOnCollectionChanged`**: Skips `FireSelectionChanged()` when `GetUpdating()` returns `true` *and* collection is non-empty — relies on external `DTS.Common.Enums.SelectedItemsStatus.GetUpdating()` logic (not visible here).
- **No validation on `Filter` term**: Non-numeric `term` for `IsComplete` will cause `Convert.ToBoolean(term)` to throw.
- **`ClearAllFilters()` does not re-apply current global filter**: Only clears per-field terms; global `_currentSearchFilter` remains unchanged, but `TestSetups` is not recomputed until `Filter(string)` is called again.
- **Thread safety**: `OnBusyIndicatorNotification` uses `ThreadOption.PublisherThread`, but other event handlers (`OnRaiseNotification`) use default (likely background thread); UI updates (`IsBusy`, `NotificationRequest.Raise`) must be marshaled to UI thread — Prism handles this via `InteractionRequest`, but `IsBusy` property setter calls `OnPropertyChanged` directly (assumes `INotifyPropertyChanged` subscribers are thread-aware or dispatcher is used elsewhere).
---
*Documentation generated from `TestSetupsListViewModel.cs` alone. Behavior not derivable from source is marked as unknown.*