12 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T13:54:46.702068+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 data within the DTS Viewer application. Both classes implement ITestSummaryListViewModel and serve as intermediaries between test summary data models and their associated views, handling user interactions, event-based communication via Prism's EventAggregator, and data binding for test summary lists. The module supports filtering, sorting, selection tracking, and notification of changes to other application components.
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) |
Casts parameter to IBaseWindowModel and assigns to Parent. |
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> |
Prism interaction request for notifications. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Prism 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 changed handlers, calls Subscribe(). |
Activated |
void Activated() |
Publishes FilterParameterChangedEvent with empty parameter. |
Cleanup |
void Cleanup() |
Clears all test summary collections, resets SelectedTestSummary, calls PublishSelectedTestSummaryList(). |
PublishSelectedTestSummaryList |
void PublishSelectedTestSummaryList() |
Publishes TestSummaryChangeNotification, TestSummaryCountNotification, and ResetZoomChangedEvent events. |
OnFilterChanged |
void OnFilterChanged(FilterParameterArgs args) |
Filters FilteredTestSummaryList based on args.Param matching SetupName, Id, or Description. |
RefreshDataFolder |
void RefreshDataFolder() |
Publishes DataFolderChangedEvent via dispatcher. |
SelectDataFolder |
void SelectDataFolder() |
Opens file dialog for .dts files, publishes DataFileSelectedEvent on selection. |
Properties:
| Property | Type | Description |
|---|---|---|
FilterView |
IFilterView |
Filter view instance. |
View |
ITestSummaryListView |
The associated view instance. |
NotificationRequest |
InteractionRequest<Notification> |
Prism interaction request for notifications. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Prism interaction request for confirmations. |
ContextNavigationRegion |
object |
Gets/sets DataContext of TestListRegion on the view. |
IsFilterEnabled |
bool |
Indicates if filtering is available (true when TestSummaryList has items). |
SelectedTestSummary |
TestSummary |
Currently selected test summary. |
SelectedTestSummaryList |
List<ITestSummary> |
List of selected test summaries. |
TestSummaryList |
ObservableCollection<ITestSummary> |
Full collection of test summaries. |
FilteredTestSummaryList |
ObservableCollection<ITestSummary> |
Filtered/sorted 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 option; setter triggers SortTestSummaryList(). |
Commands:
| Command | Type | Description |
|---|---|---|
RefreshDataFolderCommand |
DelegateCommand |
Executes RefreshDataFolder(). |
SelectDataFolderCommand |
DelegateCommand |
Executes SelectDataFolder(). |
Nested Types:
| Type | Description |
|---|---|
SortableAttribute (enum) |
Sort options: TimeStampDescending, Timestamp, FileDateDescending, FileDate, IdDescending, Id, TestSetupDescending, TestSetup. |
SortableAttributeHelper |
Helper class for localizing sort attribute display names via StringResources. |
3. Invariants
- Parent Assignment:
Initialize(object parameter)in both classes expectsparameterto be castable toIBaseWindowModel(TestSummaryViewModel) orIBaseViewModel(TestSummaryViewListModel); a null or incorrect type will cause an invalid cast exception. - Event Subscription Timing: Event subscriptions occur in the constructor (TestSummaryViewModel) or in
InitializeviaSubscribe()(TestSummaryViewListModel); events published before initialization may not be received. - Collection Synchronization: In
TestSummaryViewListModel,FilteredTestSummaryListis automatically synchronized withTestSummaryListviaTestSummaryList_CollectionChangedhandler. - Filter Ownership:
OnFilterChangedonly applies filtering whenFilterView.DataContext.Parentequalsthis. - Data Folder Event Handling:
OnDataFolderChangedinTestSummaryViewListModelonly processes events wherearg.ParentVMmatchesParent. - Property Setters with Side Effects:
SelectedDataFolderandSelectedDataFilesetters publish events; setting to null or empty string returns early without publishing. - Sort Index Default:
SelectedSortIndexdefaults to(int)SortableAttribute.TimeStampDescending(value 0).
4. Dependencies
External Dependencies (from imports):
| Namespace | Purpose |
|---|---|
DTS.Common.Base |
BaseViewModel<T> base class. |
DTS.Common.Classes.TestMetadata / DTS.Common.Classes.Viewer.TestMetadata |
TestSummary, ITestSummary interfaces. |
DTS.Common.Events |
Event types: RaiseNotification, DataFolderChangedEvent, ShowStatus, TestSummaryChangeNotification, TestSelectedChangedEvent, FilterParameterChangedEvent, RefreshTestRequestEvent, BusyIndicatorChangeNotification, TestSummaryCountNotification, ResetZoomChangedEvent, DataFileSelectedEvent. |
DTS.Common.Interface |
IBaseWindowModel, IBaseViewModel, IEventAggregator usage patterns. |
DTS.Common.Interface.TestDefinition |
ITestSummaryListViewModel, ITestSummaryListView. |
DTS.Common.Interactivity |
NotificationContentEventArgs. |
DTS.Viewer.TestSummaryList.Model |
TestSummaryModel for data loading. |
DTS.Viewer.TestSummaryList.Resources |
StringResources for localization. |
Microsoft.Practices.Prism.Events / Prism.Events |
EventAggregator pattern. |
Microsoft.Practices.Prism.Interactivity.InteractionRequest / Prism.Interactivity |
InteractionRequest<T>, Notification, Confirmation. |
Microsoft.Practices.Prism.Regions / Prism.Regions |
IRegionManager, region-based navigation. |
Microsoft.Practices.Unity / Unity |
IUnityContainer for dependency injection. |
Prism.Commands |
DelegateCommand. |
System.Windows.Forms |
OpenFileDialog for file selection. |
Internal Dependencies:
- TestSummaryModel: Both ViewModels instantiate
TestSummaryModelto callGetTestSummary()for loading data. - IFilterView / IFilterViewModel:
TestSummaryViewListModelresolves these via Unity container.
Consumers (inferred):
- Views:
TestSummaryView(referenced inTestSummaryViewModel.ContextNavigationRegion),TestSummaryListView(referenced inTestSummaryViewListModel.ContextNavigationRegion). - Any module subscribing to
TestSummaryChangeNotification,TestSummaryCountNotification,TestSelectedChangedEvent, orResetZoomChangedEvent.
5. Gotchas
Critical Issues:
-
NotImplementedException Methods in TestSummaryViewModel: The following methods throw
NotImplementedException:Activated(),Cleanup(),CleanupAsync(),InitializeAsync(), andInitializeAsync(object parameter). Calling these will crash the application. -
Misleading 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 class. -
Event Signature Mismatch:
TestSummaryViewModel.OnDataFolderChanged(string path)expects astringparameter, whileTestSummaryViewListModel.OnDataFolderChanged(DataFolderSelectionArg arg)expectsDataFolderSelectionArg. The eventDataFolderChangedEventis subscribed by both with incompatible signatures — unclear which signature the event actually uses. -
new Keyword Shadowing: Both classes use
newkeyword onPropertyChanged,OnPropertyChanged,IsBusy,IsDirty, andIsNavigationIncluded. This suggests the base classBaseViewModel<T>already defines these members, and the shadowing may cause unexpected behavior when casting to base type. -
Direct View Casting:
ContextNavigationRegionproperty directly casts the view interface to concrete types (TestSummaryVieworTestSummaryListView), breaking the interface abstraction pattern. -
Dispatcher Usage in RefreshDataFolder:
RefreshDataFolder()usesDispatcher.CurrentDispatcher.Invoke()withDispatcherPriority.Background, which may cause timing issues if called from a non-UI thread. -
Sort Implementation Rebuilds Collection:
SortTestSummaryList()clears and rebuildsFilteredTestSummaryListon every sort change, which may cause UI flicker and performance issues with large datasets. -
Missing Unsubscribe: Neither class unsubscribes from events in cleanup, potentially causing memory leaks if instances are not properly garbage collected.