--- source_files: - Common/DTS.Common/Interface/Groups/GroupChannelList/IGroupChannelListView.cs - Common/DTS.Common/Interface/Groups/GroupChannelList/IGroupChannelSettingsListView.cs - Common/DTS.Common/Interface/Groups/GroupChannelList/IGroupChannelListViewModel.cs generated_at: "2026-04-16T03:07:18.365471+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "23212c4975e0f827" --- # GroupChannelList ### **Purpose** This module defines the interfaces and data structures for managing and displaying group channel lists in the DTS application. It serves as the abstraction layer between the UI (views) and the application logic (view model) for channel configuration within groups and test setups. Its primary role is to support dynamic column rendering, filtering, sorting, and channel manipulation (add, remove, reorder) based on sensor types, ISO view modes, and user permissions—enabling consistent interaction across different contexts (e.g., group editing vs. test setup editing). --- ### **Public Interface** #### **`IGroupChannelListView`** - **`void HandleColumns(IsoViewMode viewMode)`** Configures the columns displayed in the main channel list view based on the provided ISO view mode. #### **`IGroupChannelSettingsListView`** - **`void SetOrderMode(bool bUseTestSetupOrder)`** Toggles column ordering between *group order* and *test setup order*. - **`void SetDisplayOptions(bool bShowSensorChannelUserValues)`** Controls visibility of *User Value X* columns (e.g., `UserValue1`, `UserValue2`). - **`void HandleColumns(IsoViewMode viewMode)`** Configures columns for the settings view based on ISO view mode (distinct from `IGroupChannelListView.HandleColumns` in that it may apply additional settings-specific logic). - **`void SetFilterMode(PossibleFilters filterMode)`** Filters displayed channels by sensor type (e.g., analog, digital, temperature) via `PossibleFilters`. - **`int ViewDbVersion { get; set; }`** Stores the minimum client database version of the data in the view; used to conditionally enable/disable features based on version compatibility. #### **`IGroupChannelListViewModel`** - **`IGroupChannelListView View { get; set; }`** Reference to the main channel list view. - **`IGroupChannelSettingsListView SettingsView { get; set; }`** Reference to the settings view (e.g., column configuration panel). - **`IDictionary PopulateChannels(...)`** Populates channel data for display, using lookups for sensors, hardware, and defaults. Supports options for channel deletion, sensor push/pull, and preserving existing channels. - **`bool CreateVoltageInputChannels { get; set; }`** Enables/disables automatic creation of voltage input channels when dragging analog hardware onto blank channels. - **`bool CompareAndMarkChannelParameters(Channels.IGroupChannel ch)`** Compares channel parameter values against sensor database defaults and marks discrepancies (e.g., for UI highlighting). - **`void OnSetActive()`** Initializes state when the view becomes active (e.g., snapshots `SettingChannels`). - **`void Unset()`** Cleans up state when the view is unloaded. - **`void Filter(string term)`** Filters displayed channels by text search term. - **`string CapacityFormat { get; set; }`** Format string (e.g., `"N2"`) for numeric display of channel capacity values. - **`List AllChannels { get; }`** Unfiltered, unsorted list of all channels in the module. - **`Func> ChannelCodesFunc { get; }`** Delegate to fetch available channel codes (e.g., ISO codes, user codes). - **`ObservableCollection Channels { get; set; }`** Channels currently displayed in the main list view (post-filter/sort). - **`ObservableCollection SettingChannels { get; set; }`** Snapshot of `Channels` in `OnSetActive`, excluding blank channels (used in settings view). - **`bool SettingsViewLoaded { get; set; }`** Indicates whether `SettingsView` has been loaded. - **`bool SettingChannelsLoaded { get; set; }`** Indicates whether `SettingChannels` UI elements have been created. - **`IGroup Group { get; set; }`** The group currently being edited (when in group-edit mode). - **`ITestSetup TestSetup { get; set; }`** The test setup currently being edited (when in test setup-edit mode). - **`bool UseISOCodeFilterMapping { get; set; }`** Forces synchronization between CFC and ISO code filters. - **`void SetFilter(PossibleFilters bridgeFilter)`** Filters channels by sensor type (e.g., `PossibleFilters.Analog`, `Digital`). - **`bool ShowISOCodes { get; }`** Indicates whether ISO code columns should be shown. - **`bool ShowUserCodes { get; }`** Indicates whether user code columns should be shown. - **`bool ShowDallasIdColumn { get; set; }`** Controls visibility of the Dallas ID column (per case 31802). - **`IsoViewMode ISOViewMode { get; set; }`** Gets/sets the current ISO view mode (e.g., `IsoViewMode.Standard`, `IsoViewMode.Comprehensive`). - **`bool ShowISOStringBuilder { get; set; }`** Enables/disables the ISO string builder UI component. - **`bool UniqueISOCodesRequired { get; set; }`** Enforces uniqueness of ISO codes across channels. - **`bool ShowChannelCodeLookupHelper { get; set; }`** Toggles the channel code lookup helper UI. - **`bool UseTestSetupOrder { get; }`** Indicates whether channels are ordered by test setup order (read-only; derived from `UseTestSetupOrder` setting). - **`bool ShowSensorChannelUserValues { get; set; }`** Controls display of user-defined sensor value columns. - **`void MoveDown/MoveBottom/MoveUp/MoveTop(Channels.IGroupChannel[] channel)`** Reorders channels within the list (e.g., drag-and-drop support). - **`void Filter(PossibleFilters filter)`** Overload of `Filter` that accepts a `PossibleFilters` enum (sensor-type filter). - **`void AddChannels(...)`** Overloads to add channels from sensors, hardware channels, or existing group channels. - **`void Remove(Channels.IGroupChannel channel, bool notifyChanged = true)`** Removes a channel; optionally suppresses change notifications. - **`IGroup CreateGroupIfNeeded(ITestSetup testSetup, string groupName)`** Creates a group if it does not exist for a given test setup. - **`void SetIncludedHardware(IDASHardware[] hardwares)`** Updates the hardware list used for channel counting (e.g., for header labels). - **`bool ApplySensorDataToBlankChannels { get; set; }`** Controls whether sensor metadata (e.g., name, units) is auto-applied to blank channels on drag. - **`bool AllowChannelDeletionByNonAdminUser { get; set; }`** Permission flag for non-admin users to delete channels. - **`bool UserIsAdmin { get; set; }`** Indicates admin status of the current user. - **`bool AllowSensorPushAndPull { get; set; }`** Enables/disables sensor data synchronization (push/pull) between channels and sensors. - **`void SetRange(CACOption option)`** Applies a range configuration (e.g., min/max) to all analog sensors. - **`void Sort(object columnTag, bool bUserClick)`** Sorts channels by a specified column (e.g., channel name, value). - **`bool ReadOnlyParametersMode { get; set; }`** Locks parameter editing in the Parameters step. - **`bool ReadOnlyChannelsMode { get; set; }`** Locks channel editing (add/remove/reorder). - **`int UserID { get; set; }`** ID of the current user (used for permission checks). --- ### **Invariants** - `Channels` and `SettingChannels` are always synchronized in content during `OnSetActive`, but `SettingChannels` excludes blank channels. - `ViewDbVersion` must be set before rendering UI elements that depend on version-specific features (e.g., Dallas ID column). - `ISOViewMode` and `UseISOCodeFilterMapping` jointly determine ISO code column behavior (e.g., if `UseISOCodeFilterMapping` is `true`, CFC and ISO filters are coupled). - `AllowChannelDeletionByNonAdminUser` and `UserIsAdmin` must be set before `PopulateChannels` to enforce deletion permissions correctly. - `SettingChannels` is only populated in `OnSetActive`; prior to that, it may be `null` or stale. - `AllChannels` is the source of truth for `Channels`/`SettingChannels` and must be updated before filtering/sorting operations. --- ### **Dependencies** - **Depends on:** - `DTS.Common.Base` (`IBaseView`, `IBaseViewModel`) - `DTS.Common.Enums` (`IsoViewMode`, `PossibleFilters`) - `DTS.Common.Enums.Sensors` (`PossibleFilters`) - `DTS.Common.Interface.Channels` (`IGroupChannel`, `IChannelSetting`) - `DTS.Common.Interface.Sensors` (`ISensorData`, `IDragAndDropItem`) - `DTS.Common.Interface.DataRecorders` (`IDASHardware`) - `DTS.Common.Interface.TestSetups.TestSetupsList` (`ITestSetup`) - `DTS.Common.Interface.Groups.GroupList` (`IGroup`) - `DTS.Common.Interface.Pagination` (`IFilterableListView`) - **Depended on by:** - UI implementations of `IGroupChannelListView` and `IGroupChannelSettingsListView` (e.g., WPF views). - Concrete implementations of `IGroupChannelListViewModel` (e.g., `GroupChannelListViewModel` in the application layer). - Modules handling channel import/export, test setup editing, and group configuration. --- ### **Gotchas** - `SettingChannels` is a *snapshot* of `Channels` taken in `OnSetActive` and excludes blank channels; it is not dynamically updated. Modifying `Channels` after `OnSetActive` will not reflect in `SettingChannels`. - `HandleColumns` in `IGroupChannelListView` and `IGroupChannelSettingsListView` may behave differently despite identical signatures—implementation details are view-specific. - `UseTestSetupOrder` is read-only (`bool UseTestSetupOrder { get; }`), but its value is likely derived from a setting (e.g., user preference or test setup configuration) not exposed in the interface. - `PopulateChannels` has many optional parameters (e.g., `allowChannelDeletionByNonAdminUser`, `keepExistingChannels`); incorrect combinations may lead to inconsistent state (e.g., deletion allowed but `UserIsAdmin` not set). - `CompareAndMarkChannelParameters` only marks *differences*; it does not auto-correct them. UI must handle the visual feedback. - `SetRange(CACOption option)` applies to *all analog sensors*, not just filtered channels—ensure this aligns with user intent. - `ShowISOCodes` and `ShowUserCodes` are read-only; their values are likely computed from `ISOViewMode` or `UseISOCodeFilterMapping`, but the logic is not exposed here. - `CreateVoltageInputChannels` and `ApplySensorDataToBlankChannels` both affect drag-and-drop behavior but serve distinct purposes (one for channel creation, the other for metadata propagation).