--- source_files: - Common/DTS.CommonCore/Interface/DownloadEvent/IDownloadEvent.cs generated_at: "2026-04-16T02:20:00.100876+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "089f2c1bff740fce" --- # DownloadEvent ### **Purpose** This module defines the `IDownloadEvent` interface, which represents a single download event in a multiple-download system. It serves as a contract for objects that model downloadable content units (e.g., media segments, files, or tasks), exposing metadata and state necessary for UI binding and orchestration—such as identification, enablement status, defaultness, and duration—while supporting data binding via `INotifyPropertyChanged`. --- ### **Public Interface** - **`int EventNumber { get; set; }`** Gets or sets a numeric identifier for the download event. Used for ordering or referencing the event programmatically. - **`string EventNumberDisplay { get; set; }`** Gets or sets a user-facing string representation of the event number (e.g., `"1"`, `"A"`, `"001"`), allowing formatting distinct from `EventNumber`. - **`bool IsEnabled { get; set; }`** Gets or sets whether the event is active and可 downloaded. When `false`, the event should be skipped or ignored during download operations. - **`bool IsReadonly { get; set; }`** Gets or sets whether the event’s properties (e.g., `EventNumber`, `IsEnabled`) are immutable in the UI or via programmatic modification. A `true` value indicates the event is locked for editing. - **`bool IsDefault { get; }`** Gets a read-only flag indicating whether this event is the default selection (e.g., pre-selected for download). *Cannot be set*—implementation-determined. - **`TimeSpan EventLength { get; set; }`** Gets or sets the total duration of the downloadable content for this event (e.g., video/audio length). Represents *available* content length, not necessarily downloaded. - **`bool ShouldDisplayLength { get; set; }`** Gets or sets whether the `EventLength` should be rendered in the UI. Allows conditional visibility of duration (e.g., hide for non-time-based downloads). *All properties raise `PropertyChanged` notifications via `INotifyPropertyChanged` when modified (as required by the interface inheritance).* --- ### **Invariants** - `IsDefault` is read-only (`get` only); its value must be determined and fixed by the implementing type and cannot be altered externally. - `EventLength` represents *available* content duration, not actual downloaded bytes or progress—its semantics are temporal, not volumetric. - `IsReadonly` and `IsEnabled` may be set independently, but UI behavior should ensure `IsReadonly = true` implies `IsEnabled` cannot be toggled by user action (though programmatic changes remain possible). - `EventNumberDisplay` is *not* required to match `EventNumber.ToString()`; implementations may format it arbitrarily (e.g., localized, padded, or symbolic). --- ### **Dependencies** - **Depends on**: - `System` (core types like `TimeSpan`, `EventHandler`) - `System.ComponentModel` (`INotifyPropertyChanged`) - **Depended on by**: - UI layers (e.g., WPF/WinForms view models) that bind to download event lists - Download orchestration logic that filters or prioritizes events based on `IsEnabled`, `IsDefault`, or `EventNumber` - Serialization/deserialization logic (e.g., for persisting download configurations) *No other internal module dependencies are visible in this file.* --- ### **Gotchas** - `EventLength` is named descriptively as *“total length available for download event”* in XML doc, but the property itself does not distinguish between *total available* vs. *downloaded*—consumers must infer semantics from naming and context. - `IsDefault` is read-only but has no documentation on *how* it is determined (e.g., by position, metadata, or configuration). Its behavior is implementation-specific. - `ShouldDisplayLength` is a UI hint only; it does not affect `EventLength`’s value or behavior in non-UI logic. Misusing it as a data filter may cause inconsistencies. - No validation rules are enforced by the interface (e.g., `EventNumber` may be negative; `EventLength` may be `TimeSpan.Zero` or negative unless guarded by implementation). - The file header comment `//FB 6399` suggests a feature/bug reference, but no context is provided—this may be relevant for historical debugging. *None identified beyond the above.*