14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-17T15:28:35.741418+00:00 | zai-org/GLM-5-FP8 | 1 | 7d23a26eb40cb4f6 |
DTS.Common.Controls Documentation
1. Purpose
This module provides a collection of custom WPF controls and helper classes for the DTS application framework. It includes specialized controls for test ID generation and display, animated grid layouts, data grid enhancements with searchable/selectable column headers, popup dialogs for ISO input and channel code lookup, and utility classes for managing test ID prefixes and suffixes. The controls integrate with the Prism event aggregation system and support MVVM patterns through INotifyPropertyChanged implementations.
2. Public Interface
Classes
RoundedBox
A simple UserControl wrapper.
RoundedBox()— Default constructor, callsInitializeComponent().void Connect(int connectionId, object target)— Empty implementation (comment indicatesNotImplementedExceptionwas considered but disabled).
TestIDView
A minimal UserControl for test ID display.
TestIDView()— Default constructor, callsInitializeComponent().
checkbox
A partial class handling tooltip events via event aggregation.
void ToolTipEventHandler(object sender, ToolTipEventArgs e)— Marks event as handled, retrievesIEventAggregatorviaServiceLocator.Current, and publishes aHelpTextEventwith aHelpTextEventArgcontaining the sender and event args.
GridLengthAnimation
An AnimationTimeline subclass for animating GridLength values.
GridLengthAnimation()— Default constructor (no-op).GridLength From/GridLength To— Dependency properties defining animation range.Type TargetPropertyType— Returnstypeof(GridLength).object GetCurrentValue(object defaultOriginValue, object defaultDestinationValue, AnimationClock animationClock)— Interpolates betweenFromandTovalues based onanimationClock.CurrentProgress. PreservesGridUnitType.StarorGridUnitType.Pixelfrom theTovalue.Freezable CreateInstanceCore()— Returns a newGridLengthAnimationinstance.
ISOPopup
A Popup subclass for ISO-related text input with input validation.
ISOPopup()— Default constructor, callsInitializeComponent().void ISOPart_OnPreviewKeyUp(object sender, KeyEventArgs e)— Filters keyboard input to allow only: letters (A-Z), numbers (0-9, NumPad0-9), control keys (Enter, Return, Tab, OemBackTab, Delete, Back, Home, End), and OemQuestion. Setse.Handledto block disallowed keys.void ISOPart_OnGotMouseCapture(object sender, MouseEventArgs e)— Selects all text in theTextBoxsender.void ISOPart_OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)— Selects all text in theTextBoxsender.
LookupPopup
A Popup for selecting channel codes from a list.
IEnumerable<IChannelCode> AllChannelCodes— Public property (getter only, private setter).LookupPopup()— Default constructor, callsInitializeComponent().delegate void ChannelCodeSelectedEventHandler(object sender, string code, string name)— Event signature.event ChannelCodeSelectedEventHandler ChannelCodeSelected— Raised when a channel code is double-clicked.IList PossibleChannels— Dependency property for the list of selectable channels; defaults to an empty list of anonymous objects withCodeandNameproperties.void PossibleChannels_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)— RaisesChannelCodeSelectedwithCodeandNameextracted via reflection from the selected item.
TestIdPreFixSuffixHelper and Related Types
Enum TestIdFixedPrefixSuffixValues
NotFixed = -1None = 0TimeStamp = 1TestSetupName = 2
Class TestIdPreFixSuffix
TestIdFixedPrefixSuffixValues FixedValue— Read-only property, defaults toNotFixed.TestIdPreFixSuffix(TestIdFixedPrefixSuffixValues fixedPrefixSuffix)— Constructor that setsFixedValueand creates internal string"TESTID_PREFIX_SUFFIX_" + fixedPrefixSuffix.TestIdPreFixSuffix(string dbPrefixSuffix)— Constructor that stores the string directly.string ToString()— Returns the internal string.
Class TestIdPreFixSuffixHelper (extends Base.BasePropertyChanged)
TestIdPreFixSuffix TestIdPreFixSuffix— Read-only property.TestIdPreFixSuffixHelper(string testIdPreFixSuffix)— Constructs with a string value.TestIdPreFixSuffixHelper(TestIdFixedPrefixSuffixValues testIdPreFixSuffix)— Constructs with an enum value.string ToString()— Returns localized string fromStrings.Strings.ResourceManagerif available, otherwise the raw string.bool Equals(object obj)— ComparesFixedValueand, ifNotFixed, compares string values.
AutoSizedGridView
A GridView subclass that auto-sizes columns on item preparation.
void PrepareItem(ListViewItem item)— Override that tracks columns by hash code, identifies auto-width columns (double.IsNaN(Width)with no binding), and forces re-measurement. Also re-binds width bindings if lost.
DynamicGrid
A Grid subclass implementing INotifyPropertyChanged that auto-arranges children.
event PropertyChangedEventHandler PropertyChangedDynamicGrid()— Constructor, callsRefresh().byte GridColumns— Property (default 2); setter callsRefresh().void Refresh()— Clears and rebuildsColumnDefinitionsandRowDefinitions, arranges children left-to-right, top-to-bottom. Last column isStar-sized; others areAuto. Adds a finalStar-height row.void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)— Override that callsRefresh().
TestIDViewModel
A view model for test ID generation.
event PropertyChangedEventHandler PropertyChangedstring TestSetupLabel— Property; setter raisesPropertyChangedfor itself andTestSetupLabelVisibility.Visibility TestSetupLabelVisibility— ReturnsCollapsedif label is empty, otherwiseVisible.string TestIdEditableText— Property, defaultstring.Empty.string TestName— Property.TestIdPreFixSuffixHelper SelectedTestIdPrefixValueItem— DefaultTEST_ID_SUFFIX_VALUE_NONE_ITEM.TestIdPreFixSuffixHelper SelectedTestIdSuffixValueItem— DefaultTEST_ID_SUFFIX_VALUE_TIME_STAMP_ITEM.void PopulateAllTestIdPrefixSuffixValues(string[] serializedValues)— PopulatesAllTestIdPrefixSuffixValueswith built-in items (None, TimeStamp, TestSetupName) plus database values.TestIdPreFixSuffixHelper[] AllTestIdPrefixSuffixValues— Returns array of available prefix/suffix options.string GetTestId()— Builds test ID by joining prefix,TestSetupLabel,TestIdEditableText, and suffix with underscores.string GetTestIdTimestamp()— Returns formatted timestamp:"YYYY_MM_DD HH_MM".
TestIdControl
A UserControl implementing test ID generation (marked for removal).
- Same public interface as
TestIDViewModel(properties, methods). TestIdControl()— Constructor, callsInitializeComponent().- Note: Comment indicates this control should be removed after TTS module deletion and migration to new test setup wizard.
GridViewColumnHeaderSelectable
A UserControl for column headers with selection popup.
event PropertyChangedEventHandler PropertyChangedGridViewColumnHeaderSelectable()— Constructor, subscribes toListViewStatusEventviaIEventAggregator.string ListviewId— Dependency property.string HeaderTitle— Dependency property, default"Awesome".bool ToggleButtonIsChecked— Controls popup state; raisesOpenChangedevent.Geometry ToggleIconGeometry— Not fully implemented in code-behind (getter referencesdtsGridViewColumnHeaderresource lookup, but no field declaration visible).event RoutedEventHandler OpenChanged— Bubbling routed event.event RoutedEventHandler ClickHandler— Bubbling routed event.event RoutedEventHandler SelectAll— Bubbling routed event; raised by Select All/Clear All buttons.string ToString()— ReturnsHeaderTitle.
GridViewColumnHeaderSearchable
A UserControl for column headers with search functionality.
event PropertyChangedEventHandler PropertyChangedGridViewColumnHeaderSearchable()— Constructor, subscribes toListViewStatusEvent.string ListviewId— Dependency property.string HeaderTitle— Dependency property, default"Awesome".string HeaderSearchTerm— Dependency property; changes raiseSearchevent.bool ToggleButtonIsChecked— Controls popup state.Geometry ToggleIconGeometry— ReturnsDownArrowIconGeometryorFilterIconGeometrybased on whetherHeaderSearchTermis empty.event RoutedEventHandler OpenChanged— Bubbling routed event.event RoutedEventHandler ClickHandler— Bubbling routed event.event RoutedEventHandler Search— Bubbling routed event.
Class BoolToInvertedBoolConverter
object Convert(object value, ...)— Returns inverted boolean.object ConvertBack(...)— ThrowsNotImplementedException.
GridViewColumnHeaderSearchableCheckBox
A UserControl for column headers with search and boolean filter options.
event PropertyChangedEventHandler PropertyChangedGridViewColumnHeaderSearchableCheckBox()— Constructor, subscribes toListViewStatusEvent.string ListviewId— Dependency property.string HeaderTitle— Dependency property, default"Awesome".string HeaderSearchTerm— Dependency property.bool ToggleButtonIsChecked— Controls popup state.Geometry ToggleIconGeometry— Returns icon based on search term state.event RoutedEventHandler OpenChanged— Bubbling routed event.event RoutedEventHandler ClickHandler— Bubbling routed event.event RoutedEventHandler Search— Bubbling routed event (registered as"SearchCheckBox").event RoutedEventHandler Filter— Bubbling routed event; raised with"All","True", or"False".
3. Invariants
- GridLengthAnimation:
animationClock.CurrentProgressmust have a value (no null check); callingGetCurrentValuewhenCurrentProgressis null will throw. - ISOPopup: The
ISOPart_OnPreviewKeyUphandler only filters key input; paste operations are not explicitly handled. - LookupPopup:
PossibleChannels_OnMouseDoubleClickuses reflection to accessCodeandNameproperties; items inPossibleChannelsmust have these properties orNullReferenceExceptionmay occur. - DynamicGrid:
GridColumnsmust be at least 1 for meaningful layout (0 would clear all columns). - AutoSizedGridView: Column tracking uses
GetHashCode(); if column objects are replaced with equal-hash instances, the tracking may not update correctly. - GridViewColumnHeaderSelectable/Searchable/SearchableCheckBox: All require
ServiceLocator.Currentto return a validIEventAggregatorinstance at construction time.
4. Dependencies
External Dependencies (Imports)
System.Windows.*— WPF core assemblies (Controls,Input,Data,Media,Media.Animation,Navigation,Shapes,Controls.Primitives).Microsoft.Practices.ServiceLocation—ServiceLocatorfor service location.Microsoft.Practices.Prism.Events—IEventAggregator,ThreadOptionfor event aggregation.
Internal Dependencies
DTS.Common.Events—HelpTextEvent,HelpTextEventArg,ListViewStatusEvent,ListViewStatusArg.DTS.Common.Interface.Channels.ChannelCodes—IChannelCodeinterface.DTS.Common.Base—BasePropertyChanged,IBasePropertyChanged.DTS.Common.Utilities.Logging— Referenced but not directly used in visible code.Strings.Strings— Resource manager for localization inTestIdPreFixSuffixHelper.
Consumers
- Unknown from source alone; these are reusable controls likely consumed by various modules in the DTS application.
5. Gotchas
-
TestIdControl is deprecated: The class has a comment indicating it should be removed after TTS module deletion. New code should use
TestIDViewModelinstead. -
Reflection-based property access in LookupPopup:
PossibleChannels_OnMouseDoubleClickusesGetProperty("Code")andGetProperty("Name")via reflection. This is fragile and will fail silently (returning null) or throw if properties don't exist. -
GridLengthAnimation null progress risk:
GetCurrentValueaccessesanimationClock.CurrentProgress.Valuewithout null checking. If the animation clock hasn't started or progress is unavailable, this will throwInvalidOperationException. -
checkbox class naming: The class
checkboxviolates C# naming conventions (should be PascalCaseCheckbox). This may cause confusion or issues with XAML namespace mapping. -
RoundedBox.Connect is a stub: The
Connectmethod has a commented-outNotImplementedException. Its purpose is unclear—it may be an interface implementation requirement or leftover code. -
GridViewColumnHeaderSelectable.OnListviewStatusEvent has empty body: When
arg.Id == ListviewIdand status isUnloaded, the if-block is empty. This appears to be incomplete implementation. -
Duplicate code between TestIDViewModel and TestIdControl: These classes have nearly identical logic. This is technical debt from the migration mentioned in the deprecation comment.
-
DynamicGrid adds extra row:
Refresh()always adds a finalStar-height row definition even if no children exist, which may affect layout in unexpected ways. -
GridViewColumnHeaderSearchableCheckBox.Search event name mismatch: The routed event is registered with name
"SearchCheckBox"but the CLR event is namedSearch, which could cause confusion in XAML binding.