11 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:16:50.405785+00:00 | zai-org/GLM-5-FP8 | 1 | b27cef2360f72751 |
Documentation: TestSummaryList ViewModels
1. Purpose
This module provides two ViewModel implementations (TestSummaryViewModel and TestSummaryViewListModel) for managing and displaying test summary lists within a modular WPF application built on the Prism framework. These ViewModels serve as intermediaries between test summary data models and views, handling user interactions, data folder/file selection, filtering, sorting, and event-based communication with other application components via IEventAggregator. The module appears to support a data viewer scenario where users can browse, filter, and select test summaries from DTS files.
2. Public Interface
TestSummaryViewModel
Constructor:
public TestSummaryViewModel(ITestSummaryListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
Initializes the ViewModel, sets the view's DataContext, creates interaction requests, and subscribes to RaiseNotification and DataFolderChangedEvent events.
Methods:
| Method | Signature | Description |
|---|---|---|
Initialize |
void Initialize() |
Empty override. |
Initialize |
void Initialize(object parameter) |
Sets Parent property from parameter (cast to IBaseWindowModel). |
Activated |
void Activated() |
Throws NotImplementedException. |
Cleanup |
void Cleanup() |
Throws NotImplementedException. |
CleanupAsync |
Task CleanupAsync() |
Throws NotImplementedException. |
InitializeAsync |
Task InitializeAsync() |
Throws NotImplementedException. |
InitializeAsync |
Task InitializeAsync(object parameter) |
Throws NotImplementedException. |
PublishSelectedTestSummaryList |
void PublishSelectedTestSummaryList() |
Publishes TestSummaryChangeNotification and TestSelectedChangedEvent events with current selection. |
Properties:
| Property | Type | Description |
|---|---|---|
TestSummaryListView |
ITestSummaryListView |
The associated view instance. |
NotificationRequest |
InteractionRequest<Notification> |
Interaction request for notifications. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Interaction request for confirmations. |
ContextNavigationRegion |
object |
Gets/sets content of TestListRegion on the view. |
SelectedTestSummary |
TestSummary |
Currently selected test summary. |
SelectedTestSummaryList |
List<ITestSummary> |
List of selected test summaries. |
TestSummaryList |
ObservableCollection<ITestSummary> |
Collection of all test summaries. |
HeaderInfo |
string |
Returns "TestSummaryRegion". |
IsBusy |
bool |
Busy indicator state. |
IsDirty |
bool |
Dirty state flag. |
IsNavigationIncluded |
bool |
Navigation inclusion flag. |
TestSummaryViewListModel
Constructor:
public TestSummaryViewListModel(ITestSummaryListView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
Initializes the ViewModel, sets the view's DataContext, creates interaction requests, and stores dependencies.
Methods:
| Method | Signature | Description |
|---|---|---|
Initialize |
void Initialize() |
Empty override. |
Initialize |
void Initialize(object parameter) |
Sets Parent, initializes FilterView, attaches collection change handlers, and subscribes to events. |
Activated |
void Activated() |
Publishes FilterParameterChangedEvent with empty parameter. |
Cleanup |
void Cleanup() |
Clears all test summary collections, resets SelectedTestSummary, and publishes selection change events. |
PublishSelectedTestSummaryList |
void PublishSelectedTestSummaryList() |
Publishes TestSummaryChangeNotification, TestSummaryCountNotification, and ResetZoomChangedEvent events. |
OnFilterChanged |
void OnFilterChanged(FilterParameterArgs args) |
Filters FilteredTestSummaryList based on SetupName, Id, or Description containing the parameter string (case-insensitive). |
RefreshDataFolder |
void RefreshDataFolder() |
Publishes DataFolderChangedEvent via dispatcher with current selected folder. |
SelectDataFolder |
void SelectDataFolder() |
Opens OpenFileDialog for DTS files and publishes DataFileSelectedEvent on selection. |
Properties:
| Property | Type | Description |
|---|---|---|
FilterView |
IFilterView |
Filter view instance resolved from container. |
View |
ITestSummaryListView |
The associated view instance. |
NotificationRequest |
InteractionRequest<Notification> |
Interaction request for notifications. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Interaction request for confirmations. |
ContextNavigationRegion |
object |
Gets/sets DataContext of TestListRegion on the view. |
IsFilterEnabled |
bool |
Indicates if filtering is enabled (true when TestSummaryList has items). |
SelectedTestSummary |
TestSummary |
Currently selected test summary. |
SelectedTestSummaryList |
List<ITestSummary> |
List of selected test summaries. |
TestSummaryList |
ObservableCollection<ITestSummary> |
Collection of all test summaries; setter updates IsFilterEnabled and FilteredTestSummaryList. |
FilteredTestSummaryList |
ObservableCollection<ITestSummary> |
Filtered view of test summaries. |
HeaderInfo |
string |
Returns "TestSummaryRegion". |
IsBusy |
bool |
Busy indicator state. |
IsDirty |
bool |
Dirty state flag. |
IsNavigationIncluded |
bool |
Navigation inclusion flag. |
SelectedDataFolder |
string |
Selected data folder path; setter publishes DataFolderChangedEvent. |
SelectedDataFile |
string |
Selected data file path; setter publishes DataFolderChangedEvent. |
SortableAttributes |
List<string> |
List of localized sortable attribute names. |
SelectedSortIndex |
int |
Index of selected sort attribute; setter triggers SortTestSummaryList(). |
Commands:
| Command | Type | Description |
|---|---|---|
RefreshDataFolderCommand |
DelegateCommand |
Refreshes the current data folder. |
SelectDataFolderCommand |
DelegateCommand |
Opens file dialog to select a DTS file. |
Nested Types:
SortableAttribute(enum):TimeStampDescending,Timestamp,FileDateDescending,FileDate,IdDescending,Id,TestSetupDescending,TestSetupSortableAttributeHelper(class): Helper for convertingSortableAttributeto localized string viaStringResources.ResourceManager.
3. Invariants
-
Event Subscription Timing: Both ViewModels subscribe to events in their constructors.
TestSummaryViewListModeladditionally callsSubscribe()duringInitialize(object parameter). -
Parent Parameter Casting:
TestSummaryViewModel.Initialize(object parameter)casts toIBaseWindowModelTestSummaryViewListModel.Initialize(object parameter)casts toIBaseViewModel
-
Collection Synchronization: In
TestSummaryViewListModel, settingTestSummaryListautomatically updatesFilteredTestSummaryListandIsFilterEnabled. -
Property Change Propagation:
TestSummaryViewListModel.TestSummaryList_CollectionChangedattaches/detachesPropertyChangedhandlers to items implementingINotifyPropertyChanged. -
Sorting Behavior:
SortTestSummaryList()clears and repopulatesFilteredTestSummaryListin-place based onSelectedSortIndex. -
Filter Matching:
OnFilterChangedperforms case-insensitiveContainsmatching onSetupName,Id, andDescriptionfields.
4. Dependencies
External Dependencies (from imports):
- Prism Framework:
Microsoft.Practices.Prism.Events,Microsoft.Practices.Prism.Interactivity.InteractionRequest,Microsoft.Practices.Prism.Regions,Prism.Events,Prism.Regions,Prism.Commands - Unity:
Microsoft.Practices.Unity,Unity - System.Windows.Forms: Used for
OpenFileDialoginTestSummaryViewListModel.SelectDataFolder()
Internal Dependencies (DTS.* namespaces):
DTS.Common.Base(BaseViewModel<T>)DTS.Common.Classes.TestMetadata(TestSummary)DTS.Common.Classes.Viewer.TestMetadataDTS.Common.Events(RaiseNotification,DataFolderChangedEvent,TestSummaryChangeNotification,TestSelectedChangedEvent,ShowStatus,FilterParameterChangedEvent,RefreshTestRequestEvent,TestSummaryCountNotification,ResetZoomChangedEvent,DataFileSelectedEvent)DTS.Common.Interface(IBaseWindowModel,IBaseViewModel,IFilterView,IFilterViewModel)DTS.Common.Interface.TestDefinition(ITestSummary,ITestSummaryListViewModel,ITestSummaryListView)DTS.Common.InteractivityDTS.Viewer.TestSummaryList.Model(TestSummaryModel)DTS.Viewer.TestSummaryList.Resources(StringResources)
Dependents:
- Views:
TestSummaryView,TestSummaryListView(referenced via casting inContextNavigationRegionproperties)
5. Gotchas
-
Stale XML Documentation: The constructor XML comment in
TestSummaryViewModelstates "Creates a new instance of the TechnologyDoFrontEditViewModel" — this appears to be a copy-paste error from another ViewModel. -
NotImplementedException Methods: In
TestSummaryViewModel, the following methods throwNotImplementedException:Activated()Cleanup()CleanupAsync()InitializeAsync()InitializeAsync(object parameter)
These indicate incomplete implementation or placeholder code.
-
Member Hiding with
newKeyword: Both ViewModels usenewto hide inherited members (PropertyChanged,OnPropertyChanged,IsBusy,IsDirty,IsNavigationIncluded). This can lead to unexpected behavior when casting to base types. -
Inconsistent Event Signatures:
TestSummaryViewModel.OnDataFolderChanged(string path)takes astringparameterTestSummaryViewListModel.OnDataFolderChanged(DataFolderSelectionArg arg)takes aDataFolderSelectionArgparameter
Both subscribe to
DataFolderChangedEvent, suggesting the event payload type changed or the ViewModels are used in different contexts. -
WinForms Interop in WPF:
TestSummaryViewListModel.SelectDataFolder()usesSystem.Windows.Forms.OpenFileDialograther than a WPF dialog, requiring WinForms integration. -
Internal Field Assignment: Both ViewModels create
TestSummaryModelinstances and set the private_eventAggregatorfield directly (e.g.,td._eventAggregator = _eventAggregator), which bypasses encapsulation and suggests tight coupling. -
Typo in Property Name:
TestSummaryViewListModel._selctedSortIndex(missing 'e' in "selected") — minor but could cause confusion during debugging.