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,48 @@
---
source_files:
- Common/DTS.CommonCore/Classes/Sensors/SensorsList/DragAndDropPayload.cs
generated_at: "2026-04-16T02:41:47.536416+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c4ab033f3383cdef"
---
# SensorsList
### 1. **Purpose**
The `DragAndDropPayload` class encapsulates data transferred during drag-and-drop operations involving sensor items in the UI. It serves as a serializable container that wraps an array of `IDragAndDropItem` objects, enabling consistent handling of drag-and-drop payloads across components that interact with sensors (e.g., reordering, copying, or moving sensors in a list). Its inclusion of multiple format strings supports different drag contexts (e.g., standard, Alt-modified, Ctrl-modified operations), facilitating platform-agnostic or framework-specific drag-and-drop mechanisms.
### 2. **Public Interface**
- **`public IDragAndDropItem[] Items { get; }`**
A read-only property exposing the array of drag-and-drop items contained in the payload. The array is set at construction and cannot be modified afterward.
- **`public DragAndDropPayload(IDragAndDropItem[] items)`**
Constructor that initializes the payload with the provided array of `IDragAndDropItem` instances. The array is stored directly (no defensive copy is made, per source).
- **`public const string FORMAT`**
A constant string `"DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing the primary data format identifier for the payload.
- **`public const string ALT_FORMAT`**
A constant string `"ALT_DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing an alternative format, likely used when the Alt key is held during drag.
- **`public const string CTRL_FORMAT`**
A constant string `"CTRL_DTS.Common.Classes.Sensors.SensorsList.DragAndDropPayload"` representing a format used when the Ctrl key is held during drag (e.g., for copy vs. move semantics).
### 3. **Invariants**
- `Items` is non-null and initialized to the exact array passed to the constructor (no validation or defensive copying is performed in the constructor).
- The `FORMAT`, `ALT_FORMAT`, and `CTRL_FORMAT` constants are immutable and uniquely identify the payload type in drag-and-drop operations.
- The class is immutable from the callers perspective after construction (only `Items` is exposed, and it is read-only via the property).
### 4. **Dependencies**
- **Depends on**:
- `DTS.Common.Interface.Sensors.SensorsList.IDragAndDropItem` (via the `Items` property type). This interface defines the contract for items that can be dragged/dropped in the sensors list context.
- **Depended on by**:
- UI components or services that handle drag-and-drop for sensors (e.g., drag source initiators, drop target handlers) would serialize/deserialize payloads using the `FORMAT`/`ALT_FORMAT`/`CTRL_FORMAT` strings.
- Serialization logic (e.g., for clipboard or drag-drop operations) likely relies on these format strings to reconstruct `DragAndDropPayload` instances.
### 5. **Gotchas**
- **No defensive copy**: The constructor assigns the `items` array directly to the `Items` property. Modifications to the array *after* construction (if the caller retains a reference) will mutate the payloads contents, violating immutability expectations. Callers must not retain or modify the passed array.
- **No null/empty validation**: The constructor does not validate that `items` is non-null or non-empty. Passing `null` or an empty array is allowed and may lead to downstream `NullReferenceException`s or unexpected behavior if not handled.
- **Format string semantics are not self-documenting**: While the constants suggest context-specific behavior (e.g., `ALT_FORMAT`, `CTRL_FORMAT`), their exact usage (e.g., how they map to operations like copy vs. move) is not defined in this file and must be inferred from consumers.
- **No serialization attributes**: The class lacks explicit serialization attributes (e.g., `[Serializable]`, `[DataContract]`), implying reliance on framework-specific drag-drop serialization (e.g., `DataObject` in WinForms or `DragEventArgs` in WPF). Compatibility may be fragile if used outside intended UI frameworks.
- **No documentation on format string usage**: It is unclear how `ALT_FORMAT` and `CTRL_FORMAT` are registered or consumed—e.g., whether they are used as fallbacks or in parallel with `FORMAT`.