7.5 KiB
7.5 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||
|---|---|---|---|---|---|---|---|
|
2026-04-16T03:13:50.172717+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 8f7a27f97cbd53de |
ChannelCodes
Documentation: Channel Codes List Module
1. Purpose
This module defines the core interfaces for a UI component that manages and displays channel codes—specifically distinguishing between ISO-standardized codes and user-defined codes. It provides a structured contract for a list-based view (IChannelCodesListView) and its associated view model (IChannelCodesListViewModel), enabling data binding, editing, validation, and manipulation (copy, delete, filter, sort) of channel code entries. The module exists to decouple UI presentation logic from data persistence while enforcing consistent behavior across implementations for channel code management in the DTS system.
2. Public Interface
IChannelCodesListView
- Inherits:
IBaseView - Description: A marker interface representing the view layer for the channel codes list. It has no additional members beyond inheritance, implying it relies on conventions or base view infrastructure for implementation.
IChannelCodesListViewModel
-
Inherits:
IBaseViewModel -
Properties:
IChannelCodesListView View { get; set; }
Gets or sets the associated view instance (MVVM pattern).ObservableCollection<IChannelCode> ISOChannelCodes { get; set; }
Collection of ISO-standard channel codes displayed in the list.ObservableCollection<IChannelCode> UserChannelCodes { get; set; }
Collection of user-defined channel codes displayed in the list.Func<IList<IChannelCode>> ChannelCodesFunc { get; }
A delegate returning the complete list of channel codes (both ISO and user) for external use (e.g., saving, validation).IChannelCode[] SelectedCodes { get; }
Returns the currently selectedIChannelCodeitems in the UI.bool ShowISOStringBuilder { get; set; }
Controls visibility of the ISO code builder UI component.bool UniqueISOCodesRequired { get; set; }
Enables/disables validation requiring ISO codes to be unique.bool ShowChannelCodeLookupHelper { get; set; }
Controls visibility of a helper UI for looking up channel codes.bool IsReadOnly { get; set; }
Iftrue, disables editing operations (e.g., paste, delete, copy).
-
Methods:
void Unset()
Releases resources or clears state associated with the current view (e.g., detaching event handlers).void SetPage(object page)
Associates the view model with a specific page instance (likely for navigation or context).void OnSetActive()
Invoked when the view becomes active (e.g., on navigation to the page); likely triggers data refresh or initialization.bool Save()
Persists changes to the channel codes; returnstrueon success,falseotherwise.bool Validate(bool bDisplayWindow)
Validates the current state of channel codes (e.g., uniqueness, required fields); ifbDisplayWindowistrue, shows validation errors in a UI dialog.void CopySelected()
Copies the selectedIChannelCodeitems to the clipboard (likely in a structured format).void DeleteSelected()
Deletes the selectedIChannelCodeitems from their respective collections.void Filter(object columnTag, string searchTerm)
Filters the displayed list based onsearchTermin the column identified bycolumnTag.void Sort(object columnTag, bool bColumnClick)
Sorts the displayed list by the column identified bycolumnTag;bColumnClickindicates if the sort was triggered by a user clicking the column header (likely toggles sort direction).
IChannelCode
- Properties:
int Id { get; }
Database identifier for the channel code.string Code { get; set; }
The code value (e.g.,"ISO-8601"or"CUSTOM-A").string Name { get; set; }
Human-readable name associated with the code (e.g.,"Date Format"or"Custom Input").ChannelEnumsAndConstants.ChannelCodeType CodeType { get; }
Enum value indicating whether the code isISOorUSER-defined (fromDTS.Common.Enums.Channels).ICommand PasteCommand { get; set; }
Command handler for pasting multi-row or CSV data into a single field (e.g., pasting multiple codes into theCodeorNamefield).UIItemStatus ItemStatus { get; set; }
Current UI validation status (e.g.,Success,Warning,Error) for the item (fromDTS.Common.Enums).
3. Invariants
ISOChannelCodesandUserChannelCodescollections are mutually exclusive in type (IChannelCode.CodeTypemust match the collection’s semantic purpose).ChannelCodesFuncmust return a complete list containing all items from bothISOChannelCodesandUserChannelCodes(order unspecified).SelectedCodesmust reflect the current selection state at the time of access (no caching delay).IsReadOnly = truemust prevent all mutation operations (DeleteSelected,CopySelected,PasteCommand, and edits toCode/Name).ValidatewithbDisplayWindow = truemust display errors to the user; withfalse, it must only perform validation silently (e.g., for pre-save checks).UniqueISOCodesRequired = trueimpliesValidatemust enforce uniqueness ofCodevalues only amongISOChannelCodes.
4. Dependencies
- Depends on:
DTS.Common.Base(forIBaseView,IBaseViewModel).System.Collections.ObjectModel(forObservableCollection<T>).DTS.Common.Enums(forUIItemStatus,ChannelCodeType).System.Windows.Input(forICommand).
- Depended on by:
- Concrete implementations of
IChannelCodesListView(e.g., WPFUserControlorWindow),IChannelCodesListViewModel(e.g.,ChannelCodesListViewModel), andIChannelCode(e.g.,ISOChannelCode,UserChannelCode). - Likely consumed by higher-level modules managing channel configuration or system setup (inferred from namespace
DTS.Common.Interface.Channels).
- Concrete implementations of
5. Gotchas
PasteCommandis defined onIChannelCode, but its behavior (e.g., parsing CSV, splitting rows) is not specified—implementation must handle multi-row pasting consistently.ChannelCodesFuncis a delegate, not a property returning a collection directly; callers must invoke it to get the latest list (risk of stale data if cached).SelectedCodesis an array (IChannelCode[]), not a collection—consumers must not modify the array (it is likely a snapshot).SetPage(object page)usesobjectinstead of a typed interface (e.g.,IPage), suggesting tight coupling to a specific UI framework (e.g., WPFPage).FilterandSortuseobject columnTagwithout defining expected values—implementation must rely on conventions (e.g., string column names or enum values).- No explicit thread-safety guarantees;
ObservableCollectionupdates are likely expected on the UI thread. - Critical ambiguity:
Validate’s behavior whenUniqueISOCodesRequired = trueis not enforced in the interface—implementation must ensure uniqueness only for ISO codes, but the interface does not clarify if user codes must also be unique or if they may overlap with ISO codes.