Files

42 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/Enums/TestSetups/RealtimeGraphsEnum.cs
generated_at: "2026-04-16T03:21:20.643645+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "53144cdff253078c"
---
# TestSetups
### 1. Purpose
This module defines the `RealtimeGraphsEnum` enumeration, which specifies the supported configurations for the number of real-time graphs displayed in the user interface—specifically, one, three, or six graphs. It serves as a strongly-typed, descriptively annotated constant set used throughout the system to ensure consistency in UI layout and backend graph management logic. The enum is decorated with `[TypeConverter(typeof(EnumDescriptionTypeConverter))]`, enabling localized or custom string representation via the `DescriptionAttribute` values during UI binding or serialization.
### 2. Public Interface
- **`RealtimeGraphsEnum`**
An enumeration with three named values:
- `RealtimeGraphsEnum.One` (value `1`) — Represents a single real-time graph layout.
- `RealtimeGraphsEnum.Three` (value `3`) — Represents a three-graph layout (e.g., 1×3 or 3×1 grid).
- `RealtimeGraphsEnum.Six` (value `6`) — Represents a six-graph layout (e.g., 2×3 or 3×2 grid).
Each member is annotated with a `[Description(...)]` attribute containing a string key (e.g., `"RealtimeGraphs_One"`) intended for localization or lookup by the `EnumDescriptionTypeConverter`.
### 3. Invariants
- The enum values are strictly `1`, `3`, and `6`; no other integer values are defined or intended.
- The `DescriptionAttribute` values are fixed string keys (not raw display strings) and must be resolved externally (e.g., via resource files) using the `EnumDescriptionTypeConverter`.
- The enum is not extensible at runtime; new values require source code changes and recompilation.
- The `[TypeConverter]` attribute is required for proper deserialization/binding in XAML or UI frameworks that rely on `TypeConverter` for enum-to-string conversion.
### 4. Dependencies
- **Depends on**:
- `System.ComponentModel` (for `DescriptionAttribute` and `TypeConverter`)
- `DTS.Common.Converters.EnumDescriptionTypeConverter` (custom type converter for resolving descriptions)
- **Used by**:
- UI layers (e.g., WPF/XAML bindings) that consume this enum to configure graph panel layouts.
- Backend services or view models that validate or route logic based on graph count (e.g., initializing the correct number of chart instances).
*(Exact consumers are not visible in this file alone but are implied by the enums purpose.)*
### 5. Gotchas
- The `DescriptionAttribute` values (e.g., `"RealtimeGraphs_One"`) are *keys*, not human-readable labels. The actual display text must be resolved via the `EnumDescriptionTypeConverter`, likely by looking up these keys in a resource manager. Assuming the description string is the literal display text (e.g., "RealtimeGraphs_One") will cause incorrect UI output.
- The enum values (`1`, `3`, `6`) are non-sequential and non-power-of-two; avoid bitwise operations or assuming arithmetic relationships.
- The `EnumDescriptionTypeConverter` must be registered or available in the target framework context (e.g., WPF); otherwise, binding or serialization may fall back to the enums name (`"One"`, `"Three"`, `"Six"`) instead of the description key.
- No validation is enforced at the enum level—calling code must ensure only valid values are used (e.g., `6` is valid, but `2` is not defined and would require explicit handling).