5.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T04:48:08.293076+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 6ca4c92ee0b7d299 |
View
Documentation: RealtimeChannelSelectView
1. Purpose
RealtimeChannelSelectView is a WPF UI view responsible for rendering and managing user interaction with a channel selection control in the Realtime module. It implements the IRealtimeChannelSelectView interface and coordinates with its associated view model (IRealtimeChannelSelectViewModel) to handle search input and channel selection. Its role is to translate user actions (text input and selection changes in a ComboBox) into corresponding view model operations, enabling users to search for and select a real-time data channel.
2. Public Interface
The class itself is not a public API in the traditional sense (it is partial and tied to XAML), but it implements the IRealtimeChannelSelectView interface (from DTS.Common.Interface.Realtime). Since the interface definition is not provided in the source, only the publicly exposed behavior (via event handlers) is documented:
-
RealtimeChannelSelectView()
Constructor. Initializes the component by callingInitializeComponent()to wire up XAML-defined elements. -
private void Search_TextChanged(object sender, TextChangedEventArgs e)
Event handler forTextBox.TextChanged(or equivalentComboBox.Textchange). Updates the view model’s search text viavm.SetSearchText(cb.Text), ensures the dropdown remains open (cb.IsDropDownOpen = true), and does not modify selection state directly. -
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
Event handler forComboBox.SelectionChanged. When an item is selected:- Casts the selected item to
IRealtimeChannel. - Informs the view model via
vm.SetRealtimeChannel(channel). - Clears the selection (
cb.SelectedItem = null), resets the search text (vm.SetSearchText("")), and closes the dropdown (cb.IsDropDownOpen = false).
- Casts the selected item to
⚠️ Note: No other public methods or properties are defined in this file. All logic resides in private event handlers.
3. Invariants
- The
DataContextof theComboBoxmust always be an instance implementingIRealtimeChannelSelectViewModel. - The selected item in the
ComboBoxmust be an instance ofIRealtimeChannel. - After a channel is selected, the view model is guaranteed to receive:
SetRealtimeChannel(channel)SetSearchText("")
- The
ComboBoxdropdown is explicitly kept open during text input (Search_TextChanged) and closed after selection (ComboBox_SelectionChanged). - Selection is cleared (
SelectedItem = null) after handling to prevent re-triggering on the same item.
4. Dependencies
- External Interfaces:
DTS.Common.Interface.Realtime.IRealtimeChannel— Represents a real-time channel.DTS.Common.Interface.Realtime.IRealtimeChannelSelectView— The interface this class implements (inferred frominheritdoc).DTS.Common.Interface.Realtime.IRealtimeChannelSelectViewModel— The expected type ofDataContext.
- WPF Framework:
System.Windows.Controls.ComboBox,System.Windows.Controls.TextChangedEventArgs,System.Windows.Controls.SelectionChangedEventArgs.
- Inferred Usage:
- This view is consumed by XAML (likely
RealtimeChannelSelectView.xaml) and bound to a view model implementingIRealtimeChannelSelectViewModel. - The view model likely depends on other parts of the Realtime module (e.g., channel discovery, data subscription logic), but those are not visible here.
- This view is consumed by XAML (likely
5. Gotchas
- Selection clearing side effect:
cb.SelectedItem = nullis set after callingvm.SetRealtimeChannel(channel), which may be necessary to avoid re-selection loops, but could cause issues if the view model expects the selection to persist during its processing. - Search text reset:
vm.SetSearchText("")is called after channel selection, not during text input. This means the search text is cleared only upon selection, not on every keystroke. - Commented-out state flag: A
volatile bool _bHandleSelectionfield is commented out, suggesting a past attempt to prevent re-entrancy or double-handling of selection events. Its absence may indicate unresolved reentrancy risks or legacy tech debt. - No null-safety for
cb.SelectedItembeyondnullcheck: The handler assumescb.SelectedItemis castable toIRealtimeChannelif non-null; no validation is performed. - Assumes
cb.DataContextis alwaysIRealtimeChannelSelectViewModel: No null-check onvmis performed before calling methods on it, riskingNullReferenceExceptionif binding is misconfigured. - No explicit handling of deselection: If
SelectedItembecomesnullvia external means (e.g., programmatic reset), the handler does nothing — this may be intentional, but is not documented.
None identified beyond the above.