--- source_files: - Common/DTS.Common/Interface/DownloadEvent/IDownloadEvent.cs generated_at: "2026-04-16T03:00:13.552600+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "e451d0fb97802f82" --- # DownloadEvent ## Documentation Page: `IDownloadEvent` Interface --- ### 1. Purpose The `IDownloadEvent` interface defines the contract for a *download event*—a configurable unit representing a single downloadable test scenario or asset within the DTS (Device Test System) framework. It enables UI binding and dynamic state management (e.g., enabling/disabling, read-only status) of individual download events, while exposing metadata such as the associated test item, file path, and duration. As part of the `DTS.Common.Interface.DownloadEvent` namespace, it serves as the foundational abstraction for modeling downloadable content in test workflows, likely consumed by UI layers or orchestration logic for managing multi-event test sequences. --- ### 2. Public Interface #### `interface IDownloadEvent : INotifyPropertyChanged` Represents a single download event with configurable properties and change notification support. | Member | Type | Description | |--------|------|-------------| | `int EventNumber { get; set; }` | Property | Numeric identifier for the event (e.g., sequence index). | | `string EventNumberDisplay { get; set; }` | Property | Human-readable string representation of `EventNumber` (e.g., `"1"`, `"A"`, `"Main"`), likely used for UI labeling. | | `bool IsEnabled { get; set; }` | Property | Controls whether the event is active and should be processed/downloaded. | | `bool IsReadonly { get; set; }` | Property | Indicates if the event’s properties (e.g., `EventNumber`, `DTSFile`) are immutable in the UI. | | `bool IsDefault { get; }` | Property | *Read-only* flag indicating whether this event is the default/fallback option. | | `TimeSpan EventLength { get; set; }` | Property | Total duration of the downloadable content (e.g., video/audio length). | | `bool ShouldDisplayLength { get; set; }` | Property | Controls visibility of `EventLength` in the UI (e.g., hide for zero-length events). | | `string TestItem { get; set; }` | Property | Descriptive name or label for the test item associated with this event (e.g., `"BootSequence"`). | | `string DTSFile { get; set; }` | Property | Absolute or relative path to the downloadable file (e.g., `@"C:\Tests\BootSequence.dts"`). | > **Note**: All properties except `IsDefault` are read-write. The interface inherits `INotifyPropertyChanged`, enabling data binding to react to property changes. --- ### 3. Invariants - **`IsDefault` is read-only**: Its value cannot be modified via the interface (no setter), implying it is determined internally (e.g., by a factory or configuration loader). - **`EventLength` may be zero**: While `EventLength` is a `TimeSpan`, its value is not constrained—zero or negative values are *not* explicitly forbidden (validation, if any, occurs externally). - **`ShouldDisplayLength` is independent of `EventLength`**: A non-zero `EventLength` may still be hidden in the UI if `ShouldDisplayLength` is `false`. - **No semantic validation**: The interface does not enforce constraints such as: - Uniqueness of `EventNumber` or `DTSFile`. - Validity of `DTSFile` (e.g., file existence, correct extension). - Non-empty `TestItem` or `DTSFile`. --- ### 4. Dependencies - **Depends on**: - `System` (core types like `TimeSpan`, `String`). - `System.ComponentModel` (for `INotifyPropertyChanged`). - **Implied consumers**: - UI frameworks (e.g., WPF, WinForms) leveraging `INotifyPropertyChanged` for data binding. - Test orchestration logic that iterates over `IDownloadEvent` instances to trigger downloads. - Serialization/deserialization layers (e.g., JSON/XML converters) that map `IDownloadEvent` implementations to/from persisted configurations. - **No direct dependencies on other DTS modules** are visible in this file alone; usage context would require examining implementations (e.g., concrete classes implementing `IDownloadEvent`). --- ### 5. Gotchas - **`IsDefault` is read-only but may be misinterpreted**: Developers might assume `IsDefault` can be set externally (e.g., via UI), but it is likely computed (e.g., based on `EventNumber == 0` or configuration metadata). - **`EventNumberDisplay` is decoupled from `EventNumber`**: Changing `EventNumber` does not automatically update `EventNumberDisplay`—consumers must handle synchronization (e.g., via `PropertyChanged` events). - **No validation on `DTSFile`**: The interface accepts any string, including invalid paths or non-`.dts` files. Validation must occur in consuming code. - **`ShouldDisplayLength` is a UI concern only**: Its value has no impact on download logic—it is purely for presentation. - **`INotifyPropertyChanged` behavior is undefined here**: While the interface declares the event, it does not specify *which* property changes trigger notifications (e.g., all setters? only specific ones?). Implementations must document this. - **No default values specified**: Default values for properties (e.g., `EventLength = TimeSpan.Zero`, `IsEnabled = true`) are not guaranteed by the interface and must be enforced by implementations. > **None identified from source alone.**