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,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.