6.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:46:59.687984+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | a7a7f5755050a82e |
View
Purpose
GroupChannelListView is the WPF view implementation for displaying and interacting with a list of channels associated with a test group or test setup. It provides UI controls for channel management—including reordering, deletion, clearing, filtering, and drag-and-drop assignment of sensors and hardware—while dynamically adjusting column visibility and layout based on the current view mode (IsoViewMode), group/test context, and global settings (e.g., ShowGroups). It acts as the presentation layer for GroupChannelListViewModel, synchronizing UI state with the view model via data binding and event-driven interactions.
Public Interface
The class implements IGroupChannelListView (inferred from partial class GroupChannelListView : IGroupChannelListView) and exposes the following public members:
-
bool ReadOnlyChannelsMode { get; }
Returnstrueif user input controls in the channel list should be read-only. Delegates toIGroupChannelListViewModel.ReadOnlyChannelsMode, returningfalseifDataContextis unset or not aIGroupChannelListViewModel. -
void HandleColumns(IsoViewMode viewMode)
Dynamically configures the columns ofChannelListListView(anAutoSizedGridView) based onviewModeand global settings (ShowGroups,UseTestSetupOrder,ShowDallasIdColumn). Adds/removes columns for:- Group order (
GroupColumn,GroupOrderColumn) - Test setup order (
TestSetupOrderColumn) - User code/name (
UserCodeColumn,UserChannelNameColumn) - ISO code/name (
ISOCodeColumn,ISOChannelNameColumn) - Dallas ID (
DallasIdColumn)
Ensures column ordering respectsusingTestSetupcontext.
- Group order (
Invariants
The following must hold during operation:
ChannelListListViewmust be initialized beforeHandleColumns()is called, as all column operations assumeChannelListListView.Viewis anAutoSizedGridView.DataContextmust be set to aGroupChannelListViewModel(orIGroupChannelListViewModel) for most functionality. IfDataContextisnullor of the wrong type, methods silently return (e.g.,OnListViewEvent,Clear_Click,Delete_Click,MoveUp_Click, etc.).- Drag-and-drop operations require
e.Datato be non-null and contain supported formats (e.g.,DragAndDropPayload.FORMAT,DTS.Common.Classes.Hardware.DragAndDropPayload.FORMAT). Unsupported formats result inDragDropEffects.None. - Channel deletion for blank channels requires valid ordering:
- If
UseTestSetupOrder,channel.TestSetupOrder > 0must hold. - Otherwise,
channel.GroupChannelOrder > 0must hold.
(Per issue #14546 comment inDelete_Click.)
- If
ReadOnlyChannelsModeisfalseifDataContextisnullor not aIGroupChannelListViewModel.- Column insertion/removal preserves ordering:
TestSetupOrderColumn/GroupOrderColumnare always first (index0).- User/ISO columns are inserted at indices
0or1depending onusingTestSetup.
Dependencies
Imports/References (from source):
DTS.Common.*: Core domain classes (Groups,Sensors,Controls,Enums,Events,Interface,Settings,Utils).Prism.Ioc,Prism.Events: ForIEventAggregator,ContainerLocator, and event publication/subscription (ListViewStatusEvent,GroupChannelDeleteRequestEvent,PageNavigationRequestEvent).- WPF namespaces (
System.Windows.*): ForListView,DragEventArgs,Hyperlink, etc.
Key External Dependencies (inferred):
GroupChannelListViewModel: Required asDataContextfor all interactive logic.IGroupChannel: Interface implemented by channel objects (e.g.,GroupChannel).AutoSizedGridView: Custom WPF control (fromDTS.Common.Controls) used asChannelListListView.View.MouseUtilities: Used inIsMouseOverTarget()for drag-drop hit-testing (fromDTS.Common.Utils).DTS.SensorDB.SoftwareFilter: Used inISOCode_LostFocusto fetch filter classes.- Global settings via
SettingsDB.GetGlobalValueBool("ShowGroups", true).
Depended upon by:
GroupChannelListViewModel(viaIGroupChannelListViewinterface).- Event handlers (
ListViewStatusEvent,GroupChannelDeleteRequestEvent,PageNavigationRequestEvent) suggest integration with broader Prism-based navigation and state management.
Gotchas
- Silent failures: Most event handlers and property getters return early if
DataContextisnullor of incorrect type (e.g.,Clear_Click,Delete_Click,MoveUp_Click,HandleColumns). No exceptions or logging occur—debugging requires inspecting call stacks. - Drag-drop modifier key handling is fragile:
ALT/CTRLkey states are checked via bitwise operations onDragDropKeyStates, but formats are mutated in-place (e.g.,"ALT_FORMAT"), which may cause issues ife.Data.GetFormats()is called multiple times.TextBox_DropandChannelList_Dropduplicate logic for format handling—risk of divergence if updated in one place but not the other.
ReadOnlyChannelsModeis read-only and computed: It does not raise change notifications; UI consumers must re-query it whenDataContextchanges.HandleColumnsassumesChannelListListView.Viewis alwaysAutoSizedGridView: If the view is changed (e.g., toGridView), column operations will silently fail.MoveUp/MoveDownvia keyboard (Alt+↑/↓) usesChannelListListView.SelectedItemsorder, butGetSelectedChannelsOrdered()sorts by view index—this may differ from selection order if items are selected non-contiguously.ISOCode_LostFocusmutatesFilterClassbased on ISO code, but only ifUseISOCodeFilterMappingistrue. No fallback or error handling ifGetFilterClassFromISOCodefails.Delete_Clickallows deletion of blank channels with valid orders (per issue #14546), but blocks deletion if order ≤ 0—this may confuse users expecting blank channels to be deletable unconditionally.TextBoxSourceUpdatedhandles group name changes, but the comment implies complex group reorganization logic inGroupNameChanged—behavior is not visible in this file.
None identified from source alone.