--- source_files: - Common/DTS.Common/Interface/CustomChannels/ICustomChannelsView.cs - Common/DTS.Common/Interface/CustomChannels/ICustomChannelsExportView.cs - Common/DTS.Common/Interface/CustomChannels/ICustomChannelsImportView.cs - Common/DTS.Common/Interface/CustomChannels/ICustomChannelModel.cs - Common/DTS.Common/Interface/CustomChannels/ICustomChannelsViewModel.cs generated_at: "2026-04-16T02:58:45.246089+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "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 (parameter `bImport` = `true` for import, `false` for 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 populates `AllCustomChannels` from the file specified in `ImportFileName`. - `ObservableCollection AllCustomChannels { get; }` — Collection of all known custom channels (read-only reference; modifications require collection operations). - `void SelectAll()` — Sets `Included = true` for all channels in `AllCustomChannels`. - `void ClearSelection()` — Sets `Included = false` for all channels in `AllCustomChannels`. - `void Export()` — Executes the export operation using `ExportFileName` and selected channels (`Included = true`). - `void Import()` — Executes the import operation using `ImportFileName` and selected channels (`Included = true`). ### View Interfaces (No public methods beyond inheritance) - **`ICustomChannelsView`** Base view interface for the custom channels UI. Inherits `IBaseView`. - **`ICustomChannelsImportView`** View interface for the import-specific UI. Inherits `IBaseView`. - **`ICustomChannelsExportView`** View interface for the export-specific UI. Inherits `IBaseView`. ## 3. Invariants - `AllCustomChannels` is an `ObservableCollection` and must be initialized before use (e.g., by `ReadImportFile()` or initialization logic). - `ImportFileName` and `ExportFileName` must be valid file paths before calling `ReadImportFile()`, `Import()`, or `Export()`; no validation is evident in the interface, so callers must ensure correctness. - `OnSetActive(bool bImport)` must be called before `Import()` or `Export()` 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). - `Included` property on each `ICustomChannelModel` instance 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` (standard .NET collection type). - **External Dependencies**: - The concrete implementations of `ICustomChannelsView`, `ICustomChannelsImportView`, `ICustomChannelsExportView`, and `ICustomChannelsViewModel` are not provided, so their dependencies (e.g., UI framework like WPF, file I/O libraries) cannot be inferred. - **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 `ICustomChannelsViewModel` to orchestrate the custom channels workflow. ## 5. Gotchas - **No error handling in interface**: Methods like `ReadImportFile()`, `Import()`, and `Export()` have no declared exceptions or return values. Callers must infer error handling (e.g., via logging, UI feedback) from implementation. - **Ambiguous `OnSetActive` semantics**: The interface does not specify whether `OnSetActive` must be called before `Import()`/`Export()`, or if it has side effects beyond toggling mode. Implementation may assume exclusive use (e.g., `Import()` calls `OnSetActive(true)` internally). - **No thread-safety guarantees**: `ObservableCollection` is not thread-safe; concurrent modifications to `AllCustomChannels` (e.g., from background file I/O) may cause exceptions. - **View interfaces are empty**: `ICustomChannelsView`, `ICustomChannelsImportView`, and `ICustomChannelsExportView` contain no members beyond `IBaseView`. 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.Name` has 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.