3.2 KiB
3.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T02:48:30.854477+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | b5b90e6c3d17fb4a |
Realtime
1. Purpose
This module defines the RealtimeChannelSelectedEvent, a Prism-based event used to propagate notifications across the application when a realtime communication channel is selected. It serves as a decoupling mechanism in the event-driven architecture, enabling subscribers (e.g., UI components, services, or modules) to react to channel selection changes—such as updating UI state, initializing connections, or switching data streams—without tight coupling to the publisher.
2. Public Interface
RealtimeChannelSelectedEvent- Type:
class(inherits fromCompositePresentationEvent<IRealtimeChannel>) - Behavior: A Prism event token used for publishing and subscribing to channel selection events. When published, it carries an
IRealtimeChannelinstance representing the newly selected channel. Subscribers receive this instance via their event handler. - Note: No additional public methods or properties are defined beyond those inherited from
CompositePresentationEvent<TPayload>(e.g.,Subscribe,Publish,GetSubscriptionToken).
- Type:
3. Invariants
- The payload passed via
Publishmust be a non-null instance ofIRealtimeChannel(enforced by convention, though not explicitly validated in this class). - The event is intended for thread-safe use within Prism’s event system (i.e., subscriptions/publishing may occur on any thread, with Prism handling dispatch to the UI thread if configured to do so).
- The event payload type is strictly
IRealtimeChannel; no other types are supported.
4. Dependencies
- Depends on:
DTS.Common.Interface.Realtime.IRealtimeChannel(interface defining the realtime channel contract)Microsoft.Practices.Prism.Events.CompositePresentationEvent<T>(Prism event infrastructure)
- Used by:
- Components that publish channel selection changes (e.g., a channel manager or UI view model).
- Subscribers (e.g., data handlers, logging modules, or UI elements) that need to respond to channel changes.
(Exact consumers are not visible in this file but are implied by the event’s purpose.)
5. Gotchas
- No explicit validation: The class does not validate the
IRealtimeChannelpayload; subscribers must handle null or invalid channel states defensively. - Lifetime management: Subscribers must manually unsubscribe (e.g., via
SubscriptionToken) to avoid memory leaks—especially critical for long-lived subscribers (e.g., views) in Prism’s event system. - Thread-safety assumptions: While Prism’s
CompositePresentationEventhandles thread dispatch, the behavior depends on the application’s Prism configuration (e.g.,ThreadOption.PublisherThreadvs.UIThread). - Naming ambiguity: The class name
RealtimeChannelSelectedEventimplies selection triggered by user action, but the source does not clarify whether it is also used for programmatic channel changes.