Files
DP44/enriched-qwen3-coder-next/Common/DTS.CommonCore/Events/ChannelCodes.md
2026-04-17 14:55:32 -04:00

5.5 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Events/ChannelCodes/ChannelCodesViewChangedEvent.cs
Common/DTS.CommonCore/Events/ChannelCodes/ChannelCodeCommittedEvent.cs
2026-04-16T02:48:23.376026+00:00 Qwen/Qwen3-Coder-Next-FP8 1 ada2b2e64b345605

ChannelCodes

Documentation: Channel Codes Event Definitions

1. Purpose

This module defines Prism-based event types used for inter-module communication related to channel code management in the DTS system. Specifically, ChannelCodesViewChangedEvent signals when the user switches between different view modes (e.g., list, grid) for channel codes UI, while ChannelCodeCommittedEvent broadcasts when one or more channel codes have been successfully saved or submitted by a user, including metadata about the operation (e.g., code value, name, type, and user privileges). These events decouple UI components (e.g., views, view models) from business logic or persistence layers involved in channel code handling.

2. Public Interface

ChannelCodesViewChangedEvent

  • Type: class (inherits from CompositePresentationEvent<DTS.Common.Enums.IsoViewMode>)
  • Payload: DTS.Common.Enums.IsoViewMode
  • Behavior: A Prism event used to notify subscribers when the current view mode for the channel codes UI has changed. Subscribers receive the new IsoViewMode value (e.g., List, Grid, etc., per the enum definition).

ChannelCodeCommittedEvent

  • Type: class (inherits from CompositePresentationEvent<ChannelCodeCommittedEventArgs[]>)
  • Payload: ChannelCodeCommittedEventArgs[] (array of committed channel code entries)
  • Behavior: A Prism event published after one or more channel codes are committed (e.g., saved to a backend or cache). Subscribers receive an array of ChannelCodeCommittedEventArgs, each describing a single committed code.

ChannelCodeCommittedEventArgs

  • Type: class
  • Properties:
    • ChannelCodeType: ChannelEnumsAndConstants.ChannelCodeType — immutable; indicates the category or domain of the channel code (e.g., Network, Device, Service).
    • Code: string — immutable; the actual code string (e.g., "NET_001").
    • Name: string — immutable; the human-readable name/description of the code (e.g., "Primary Network").
    • CanUserCommitChannelCodes: bool — immutable; true if the user submitting the event has write permissions for channel codes; false otherwise.
  • Constructor:
    public ChannelCodeCommittedEventArgs(
        ChannelEnumsAndConstants.ChannelCodeType channelCodeType,
        string code,
        string name,
        bool canUserCommitChannelCodes)
    
    Initializes a new instance with the specified values. All properties are set at construction and remain read-only thereafter.

3. Invariants

  • ChannelCodeCommittedEventArgs instances are immutable after construction: all properties have private set accessors and are assigned only in the constructor.
  • ChannelCodeCommittedEvent always carries an array of ChannelCodeCommittedEventArgs, even if empty (i.e., no null payload is implied by the source, but callers may choose to publish with zero-length arrays).
  • The CanUserCommitChannelCodes flag reflects the submitting users privilege at the time of commit, not necessarily the current users privilege (e.g., in multi-user or background scenarios).
  • IsoViewMode values are constrained to the members defined in DTS.Common.Enums.IsoViewMode (not shown in source; assumed to be an enum defined elsewhere).

4. Dependencies

  • Dependencies on other modules/types:
    • Microsoft.Practices.Prism.Events (Prism library for event aggregation)
    • DTS.Common.Enums (for IsoViewMode)
    • DTS.Common.Enums.Channels (for ChannelEnumsAndConstants.ChannelCodeType)
  • Depended on by:
    • UI components (e.g., views/view models) that need to react to view mode changes or channel code commits (e.g., refreshing displays, updating audit logs, enforcing permissions).
    • Likely consumed by modules handling channel code persistence, audit logging, or UI state synchronization.

5. Gotchas

  • Namespace inconsistency: ChannelCodesViewChangedEvent resides in DTS.Common.Events, while ChannelCodeCommittedEvent and its args are in DTS.Common.Events.ChannelCodes. This may cause confusion during subscription (e.g., eventAggregator.GetEvent<ChannelCodesViewChangedEvent>().Subscribe(...))—ensure correct namespace resolution.
  • No validation guarantees: The source provides no indication that Code or Name are non-null/non-empty; callers must validate inputs before publishing ChannelCodeCommittedEvent.
  • Privilege flag semantics: CanUserCommitChannelCodes is set at event publication time and may become stale if user permissions change between commit and event handling. Handlers should not assume this flag reflects the current user state.
  • Array payload: ChannelCodeCommittedEvent uses an array, implying batch commits are supported. Handlers must iterate the array and not assume a single item.
  • No error handling: The event is named CommittedEvent, suggesting success only. There is no corresponding failure/error event defined here; error handling must be separate.
  • Missing documentation for IsoViewMode: The actual values/states of IsoViewMode are not visible in the source, so behavior tied to specific modes (e.g., List vs Grid) cannot be fully specified.