7.3 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-17T15:58:43.555476+00:00 | zai-org/GLM-5-FP8 | 1 | d3939bb26e2af959 |
GroupChannelListView Documentation
1. Purpose
GroupChannelListView is a WPF UserControl (code-behind) that provides the view layer for displaying and managing a list of group channels in a tabular format. It handles user interactions including drag-and-drop sensor/hardware assignment, channel reordering, column visibility management based on view modes, and navigation events. This view implements IGroupChannelListView and serves as the UI component within the Groups module for configuring channel assignments in test setups and group configurations.
2. Public Interface
Properties
| Signature | Description |
|---|---|
bool ReadOnlyChannelsMode { get; } |
Returns whether user input controls should be read-only. Delegates to IGroupChannelListViewModel.ReadOnlyChannelsMode if DataContext is valid; otherwise returns false. |
Methods
| Signature | Description |
|---|---|
void HandleColumns(IsoViewMode viewMode) |
Dynamically configures column visibility based on the specified IsoViewMode. Manages Group, ISO Code, User Code, Dallas ID, and Test Setup Order columns. Reads global setting "ShowGroups" to determine group column visibility. |
Constructor
| Signature | Description |
|---|---|
GroupChannelListView() |
Initializes the component and subscribes to ListViewStatusEvent via IEventAggregator to handle scroll-to-bottom requests. |
Event Handlers (Private, wired to XAML)
| Method | Trigger | Behavior |
|---|---|---|
Clear_Click(object sender, RoutedEventArgs e) |
Clear button click | Calls viewModel.Clear(channel) and viewModel.NotifyChannelsChanged() for the affected IGroupChannel. |
Delete_Click(object sender, RoutedEventArgs e) |
Delete button click | Publishes GroupChannelDeleteRequestEvent with GroupChannelDeleteRequestEventArgs. Special handling for blank channels with order values (bug fix 14546). |
MoveTop_Click, MoveUp_Click, MoveDown_Click, MoveBottom_Click |
Move button clicks | Calls corresponding vm.MoveTop(), vm.MoveUp(), vm.MoveDown(), vm.MoveBottom() methods. Supports multi-selection via GetSelectedChannelsOrdered(). |
ChannelList_Drop(object sender, DragEventArgs e) |
Drop operation | Handles DragAndDropPayload.FORMAT for sensor assignment and DTS.Common.Classes.Hardware.DragAndDropPayload.FORMAT for hardware assignment via vm.DoSensorAssignment() and vm.DoHardwareAssignment(). |
TextBox_Drop(object sender, DragEventArgs e) |
Drop on text box | Same drop handling as ChannelList_Drop, but extracts IGroupChannel from Control.DataContext or TextBlock.DataContext. |
ChannelCodeBuilder_OnChannelCodeSelected(object sender, string code, string name, ChannelEnumsAndConstants.ChannelCodeType codeType) |
Channel code selection | Sets IsoCode/IsoChannelName or UserCode/UserChannelName based on codeType. Calls viewModel.MarkModified(channel). |
ChannelNameBuilder_OnChannelCodeSelected(...) |
Channel name selection | Similar to above but sets name first, then code. |
ISOCode_LostFocus(object sender, RoutedEventArgs e) |
ISO Code field loses focus | If UseISOCodeFilterMapping is true, retrieves software filters and calls channel.GetFilterClassFromISOCode() to set FilterClass. |
Hyperlink_Click(object sender, RoutedEventArgs e) |
Hyperlink click | Publishes PageNavigationRequestEvent with destination Sensor for navigation. |
3. Invariants
- DataContext Contract: Most operations assume
DataContextis eitherIGroupChannelListViewModelorGroupChannelListViewModel. Operations silently return if this contract is violated. - Column Management:
ChannelListListView.Viewmust be of typeDTS.Common.Controls.AutoSizedGridViewfor column manipulation methods to function. - Drag-Drop Payload Formats: The view recognizes specific format strings:
DragAndDropPayload.FORMATandDragAndDropPayload.ALT_FORMATfor sensor payloadsDTS.Common.Classes.Hardware.DragAndDropPayload.FORMATfor hardware payloads
- Selection Ordering:
GetSelectedChannelsOrdered()returns channels sorted by their index inChannelListListView.Items, preserving visual order. - Order Column Exclusivity: Either
TestSetupOrderColumnorGroupOrderColumnis displayed at index 0, never both simultaneously.
4. Dependencies
Imports (This module depends on)
| Namespace | Purpose |
|---|---|
DTS.Common.Classes.Groups |
GroupChannel entity |
DTS.Common.Classes.Sensors.SensorsList |
Sensor-related types |
DTS.Common.Controls |
AutoSizedGridView, GridViewColumnHeaderSearchable |
DTS.Common.Enums |
IsoViewMode enum |
DTS.Common.Enums.Channels |
ChannelEnumsAndConstants |
DTS.Common.Events |
PageNavigationRequestEvent, PageNavigationRequest |
DTS.Common.Events.Groups.GroupChannelList |
ListViewStatusEvent, ListViewStatusArg, GroupChannelDeleteRequestEvent, GroupChannelDeleteRequestEventArgs |
DTS.Common.Interface.Channels |
IHardwareChannel |
DTS.Common.Interface.DataRecorders |
Data recorder interfaces |
DTS.Common.Interface.Groups.GroupChannelList |
IGroupChannelListView, IGroupChannelListViewModel, IGroupChannel |
DTS.Common.Settings |
SettingsDB.GetGlobalValueBool() |
DTS.Common.Utils |
MouseUtilities for drag-drop coordinate handling |
Prism.Ioc |
ContainerLocator for service resolution |
Prism.Events |
IEventAggregator for pub/sub messaging |
DTS.SensorDB |
SoftwareFilter.GetSoftwareFilters() (referenced in ISOCode_LostFocus) |
Known Dependents
Not determinable from this source file alone.
5. Gotchas
-
Drag-Drop Mouse Position: The code explicitly uses
MouseUtilities.GetMousePosition(target)instead of standard WPF mechanisms because "during a drag-drop operation, the WPF mechanisms for getting the coordinates behave strangely." -
Blank Channel Deletion (Bug 14546): Blank channels may still have
TestSetupOrderorGroupChannelOrderassigned. The delete logic allows deletion of blank channels only if their order value is greater than 0, depending onUseTestSetupOrdermode. -
Modifier Key Format Mutation: During drag operations, the code mutates format strings by prepending
"ALT_"or"CTRL_"based onDragDropKeyStates. This creates format strings like"ALT_FORMAT"that must match expected payload constants. -
Inconsistent Drag-Over Behavior:
ChannelList_DragOverallowsDragAndDropPayload.ALT_FORMATbutTextBox_DragOverhandles it differently—some formats that are allowed in list-level drag-over are rejected in text-box drag-over. -
Hardcoded Column Dependencies:
AddDallasIdColumn()relies onHardwareColumnexisting to determine insertion index. IfHardwareColumnis not in the view, the insertion logic may fail or insert at an unexpected position. -
Empty Event Handler:
ChannelListListView_SelectionChangedis wired but contains no implementation. -
Global Setting Dependency:
HandleColumnsreads"ShowGroups"global setting viaSettingsDB.GetGlobalValueBool()with defaulttrue. This creates implicit runtime configuration dependency.