6.2 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |||||
|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T02:58:45.246089+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 6e9d98c29d4f1064 |
CustomChannels
1. Purpose
This module defines the interface contracts for the Custom Channels feature, which enables users to manage custom channel configurations via import/export workflows. It establishes a layered MVVM (Model-View-ViewModel) architecture for handling custom channel data: ICustomChannelModel represents individual channel entities, while ICustomChannelsViewModel orchestrates import/export operations, file I/O, and selection state. The view interfaces (ICustomChannelsView, ICustomChannelsImportView, ICustomChannelsExportView) serve as abstractions for UI presentation layers, inheriting from IBaseView to integrate with the broader UI framework.
2. Public Interface
Interfaces
-
ICustomChannelModel
Represents a single custom channel.string Name { get; }— Immutable identifier/name of the channel.bool Included { get; set; }— Mutable flag indicating whether the channel is selected for import/export.
-
ICustomChannelsViewModel
Coordinates the custom channels workflow (import/export, selection, file handling).ICustomChannelsImportView ImportView { get; set; }— View instance for the import UI.ICustomChannelsExportView ExportView { get; set; }— View instance for the export UI.void Unset()— Resets internal state (e.g., clears file paths, selections).void OnSetActive(bool bImport)— Notifies the ViewModel that either import or export mode is active (parameterbImport=truefor import,falsefor export). Likely configures UI behavior based on mode.string ExportFileName { get; set; }— Path/filename for the export target file.string ImportFileName { get; set; }— Path/filename for the import source file.void ReadImportFile()— Reads and populatesAllCustomChannelsfrom the file specified inImportFileName.ObservableCollection<ICustomChannelModel> AllCustomChannels { get; }— Collection of all known custom channels (read-only reference; modifications require collection operations).void SelectAll()— SetsIncluded = truefor all channels inAllCustomChannels.void ClearSelection()— SetsIncluded = falsefor all channels inAllCustomChannels.void Export()— Executes the export operation usingExportFileNameand selected channels (Included = true).void Import()— Executes the import operation usingImportFileNameand selected channels (Included = true).
View Interfaces (No public methods beyond inheritance)
ICustomChannelsView
Base view interface for the custom channels UI. InheritsIBaseView.ICustomChannelsImportView
View interface for the import-specific UI. InheritsIBaseView.ICustomChannelsExportView
View interface for the export-specific UI. InheritsIBaseView.
3. Invariants
AllCustomChannelsis anObservableCollection<ICustomChannelModel>and must be initialized before use (e.g., byReadImportFile()or initialization logic).ImportFileNameandExportFileNamemust be valid file paths before callingReadImportFile(),Import(), orExport(); no validation is evident in the interface, so callers must ensure correctness.OnSetActive(bool bImport)must be called beforeImport()orExport()to configure mode-specific behavior (e.g., enabling/disabling UI controls).Unset()must be called to reset state (e.g., before re-initializing with new data).Includedproperty on eachICustomChannelModelinstance reflects selection state for import/export operations.
4. Dependencies
- Internal Dependencies:
DTS.Common.Base.IBaseView(base interface for all views).DTS.Common.Base.IBaseViewModel(base interface for all view models).System.Collections.ObjectModel.ObservableCollection<T>(standard .NET collection type).
- External Dependencies:
- The concrete implementations of
ICustomChannelsView,ICustomChannelsImportView,ICustomChannelsExportView, andICustomChannelsViewModelare not provided, so their dependencies (e.g., UI framework like WPF, file I/O libraries) cannot be inferred.
- The concrete implementations of
- Depended Upon:
- UI layers (e.g., WPF/XAML views) likely depend on the view interfaces for binding and composition.
- Higher-level controllers or services likely depend on
ICustomChannelsViewModelto orchestrate the custom channels workflow.
5. Gotchas
- No error handling in interface: Methods like
ReadImportFile(),Import(), andExport()have no declared exceptions or return values. Callers must infer error handling (e.g., via logging, UI feedback) from implementation. - Ambiguous
OnSetActivesemantics: The interface does not specify whetherOnSetActivemust be called beforeImport()/Export(), or if it has side effects beyond toggling mode. Implementation may assume exclusive use (e.g.,Import()callsOnSetActive(true)internally). - No thread-safety guarantees:
ObservableCollection<T>is not thread-safe; concurrent modifications toAllCustomChannels(e.g., from background file I/O) may cause exceptions. - View interfaces are empty:
ICustomChannelsView,ICustomChannelsImportView, andICustomChannelsExportViewcontain no members beyondIBaseView. This suggests they may be marker interfaces or placeholders for future extension, increasing risk of misuse (e.g., assuming they expose UI-specific properties/methods). - No validation on
Name:ICustomChannelModel.Namehas no constraints (e.g., nullability, length, uniqueness). Implementations may assume non-null/non-empty names, but this is not guaranteed by the interface.
None identified from source alone.