45 lines
2.4 KiB
Markdown
45 lines
2.4 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/Modules/Hardware/HardwareList/Converters/FirstUseDateConverter.cs
|
||
|
|
- DataPRO/Modules/Hardware/HardwareList/Converters/StandInFieldConverter.cs
|
||
|
|
generated_at: "2026-04-17T16:45:06.957738+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "efc40e7dad9708c9"
|
||
|
|
---
|
||
|
|
|
||
|
|
# HardwareList.Converters Documentation
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides WPF `IValueConverter` implementations for the HardwareList UI layer. These converters transform `HardwareModel` data into display-friendly values for data-bound controls, handling edge cases such as missing data, invalid states, and stand-in hardware representations. The converters ensure consistent display formatting (e.g., returning `"---"` or `"N/A"` placeholders) across the hardware list views.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### `FirstUseDateConverter`
|
||
|
|
|
||
|
|
**Implements:** `System.Windows.Data.IValueConverter`
|
||
|
|
|
||
|
|
| Method | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `Convert` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns the first use date display value. If `value` is not a `HardwareModel`, returns `Strings.Table_NA`. If `model.IsFirstUseValid` is `false`, returns `Strings.NotApplicable`. If `model.FirstUseDate` is non-null, returns that date. Otherwise returns `Strings.Table_NA`. |
|
||
|
|
| `ConvertBack` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns the input `DateTime` unchanged if `value` is a `DateTime`; otherwise returns `Strings.Table_NA`. |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `StandInFieldConverter`
|
||
|
|
|
||
|
|
**Implements:** `System.Windows.Data.IValueConverter`
|
||
|
|
|
||
|
|
| Method | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `Convert` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns field values for non-stand-in hardware. If `value` is not a `HardwareModel`, returns `Strings.Table_NA`. If `model.Hardware` is not an `IISOHardware`, returns `string.Empty`. If `isoHW.StandIn` is `true`, returns `Strings.Table_NA`. Otherwise, uses the string `parameter` to select: `"CalDueDate"` → `model.CalDueDate`, `"CalDate"` → `model.CalDate`, `"Firmware"` → `model.Firmware`. Unrecognized parameters return `Strings.Table_NA`. |
|
||
|
|
| `ConvertBack` | `(object value, Type targetType, object parameter, CultureInfo culture) → object` | Returns the input `DateTime` unchanged if `value` is a `DateTime`; otherwise returns `Strings.Table_NA`. |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 3. Invariants
|
||
|
|
|
||
|
|
-
|