--- source_files: - Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsView.cs - Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsExportView.cs - Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsImportView.cs - Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelModel.cs - Common/DTS.CommonCore/Interface/CustomChannels/ICustomChannelsViewModel.cs generated_at: "2026-04-16T02:18:35.414312+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "d441dada7c96f903" --- # CustomChannels ## Documentation: Custom Channels Module ### 1. Purpose This module defines the core interfaces for a *Custom Channels* feature, enabling users to manage user-defined channel configurations through import/export workflows. It provides a separation of concerns between view layers (`ICustomChannelsView`, `ICustomChannelsImportView`, `ICustomChannelsExportView`), data models (`ICustomChannelModel`), and view-model logic (`ICustomChannelsViewModel`). The module serves as the contract layer for a UI-driven workflow where users can select, import from files, export to files, and toggle inclusion status of custom channels—likely in a data acquisition, signal processing, or configuration context. ### 2. Public Interface #### Interfaces - **`ICustomChannelsView`** *Namespace:* `DTS.Common.Interface` *Inherits:* `IBaseView` *Description:* Marker interface for the main custom channels view. No additional members beyond base view contract. - **`ICustomChannelsExportView`** *Namespace:* `DTS.Common.Interface.CustomChannels` *Inherits:* `IBaseView` *Description:* Marker interface for the export-specific view component. - **`ICustomChannelsImportView`** *Namespace:* `DTS.Common.Interface.CustomChannels` *Inherits:* `IBaseView` *Description:* Marker interface for the import-specific view component. - **`ICustomChannelModel`** *Namespace:* `DTS.Common.Interface.CustomChannels` *Properties:* - `string Name { get; }` — Immutable identifier/name of the custom channel. - `bool Included { get; set; }` — Read-write flag indicating whether the channel is included in current operations (e.g., import/export). - **`ICustomChannelsViewModel`** *Namespace:* `DTS.Common.Interface.CustomChannels` *Inherits:* `IBaseViewModel` *Properties:* - `ICustomChannelsImportView ImportView { get; set; }` — Reference to the import view instance. - `ICustomChannelsExportView ExportView { get; set; }` — Reference to the export view instance. - `string ExportFileName { get; set; }` — Path/filename for export operations. - `string ImportFileName { get; set; }` — Path/filename for import operations. - `ObservableCollection AllCustomChannels { get; }` — Collection of all available custom channel models; bound to UI for selection. *Methods:* - `void Unset()` — Likely clears references or resets state (e.g., view bindings). - `void OnSetActive(bool bImport)` — Activates the view for either import (`bImport == true`) or export (`bImport == false`) mode. - `void ReadImportFile()` — Reads and parses the file specified in `ImportFileName`, populating `AllCustomChannels`. - `void SelectAll()` — Sets `Included = true` for all items in `AllCustomChannels`. - `void ClearSelection()` — Sets `Included = false` for all items in `AllCustomChannels`. - `void Export()` — Executes export of selected (included) channels to `ExportFileName`. - `void Import()` — Executes import of selected (included) channels from `ImportFileName`. ### 3. Invariants - `AllCustomChannels` is an `ObservableCollection`—UI must be notified of changes via collection change events. - `Included` property on each `ICustomChannelModel` is mutable and controls inclusion state for import/export operations. - `ImportFileName` and `ExportFileName` must be set *before* calling `ReadImportFile()`, `Import()`, or `Export()`; otherwise, behavior is undefined. - `OnSetActive(bool)` must be called to switch between import/export modes before invoking import/export operations. - `Unset()` is expected to be called during view lifecycle teardown (e.g., view disposal), though exact semantics are not specified beyond resetting state. ### 4. Dependencies - **Depends on:** - `DTS.Common.Base` (specifically `IBaseView`, `IBaseViewModel`) - `System.Collections.ObjectModel` (for `ObservableCollection`) - **Depended on by (inferred):** - UI layers (e.g., WPF/WinForms views) implementing `ICustomChannelsView`, `ICustomChannelsImportView`, `ICustomChannelsExportView`. - View-model implementations (e.g., concrete `ICustomChannelsViewModel` classes) that consume file I/O, channel parsing, and export logic. - Likely used by a higher-level controller or shell module that orchestrates custom channel workflows. ### 5. Gotchas - **No file format specification**: The interfaces do not define the expected format for import/export files—implementation details (e.g., CSV, XML, JSON) are not visible here. - **Ambiguous `ReadImportFile()` semantics**: Does it *replace* `AllCustomChannels`, *append*, or *merge*? The interface does not clarify. - **No error handling in interface**: Methods like `Import()`, `Export()`, and `ReadImportFile()` have no declared exception behavior—consumers must infer or document error paths separately. - **`Unset()` is underspecified**: Its purpose (e.g., nulling view references, clearing collections) is not defined. - **No validation on `Name` or `Included`**: No constraints on `Name` (e.g., null/empty rules) or `Included` default value are specified. - **No thread-safety guarantees**: `ObservableCollection` is not thread-safe; concurrent access (e.g., async import) may require synchronization. - **None identified from source alone** for file I/O behavior, error handling, and lifecycle management—these require implementation context.