14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T04:55:26.671118+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 3e435356eaf751fb |
Documentation: HeadReportViewModel and TRLReportViewModel
1. Purpose
These two view models (HeadReportViewModel and TRLReportViewModel) serve as shared data contexts for input and output views in the Pedestrian and Head Reports module of the DataPRO application. They implement Prism-based MVVM patterns to manage UI state (e.g., busy indicators, dirty state, inclusion flags for menu/navigation), handle notification/confirmation interactions via InteractionRequest, and expose properties for report configuration (e.g., time/acceleration units, channel selections). HeadReportViewModel is a simpler implementation focused on generic report UI state, while TRLReportViewModel extends this with domain-specific properties and initialization logic tied to a DTS.Serialization.Test object, including channel population and unit filtering. Both are exported as views (IHeadReportInputView/IHeadReportOutputView and ITRLReportInputView/ITRLReportOutputView) and are intended to coordinate data flow between UI and backend (though current functionality is limited to XML string exchange per comments).
2. Public Interface
HeadReportViewModel
-
HeadReportViewModel(IHeadReportInputView inputView, IHeadReportOutputView outputView, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
Constructor. Assigns views, sets upDataContext, initializesInteractionRequests, and subscribes toRaiseNotificationandBusyIndicatorChangeNotificationevents. -
IHeadReportInputView InputView { get; set; }
Reference to the input view instance. -
IHeadReportOutputView OutputView { get; set; }
Reference to the output view instance. -
InteractionRequest<Notification> NotificationRequest { get; }
Prism interaction request used to trigger notification popups (e.g., alerts). -
InteractionRequest<Confirmation> ConfirmationRequest { get; }
Prism interaction request used to trigger confirmation dialogs. -
bool IsDirty { get; }
Read-only property indicating whether the model has unsaved changes. Currently never set totruein source. -
bool IsBusy { get; set; }
Bindable property indicating whether the UI is busy. Set viaOnBusyIndicatorNotification(bool)event handler. -
bool IsMenuIncluded { get; set; }
Bindable property indicating whether the report should include the menu. Defaults tofalse. -
bool IsNavigationIncluded { get; set; }
Bindable property indicating whether the report should include navigation. Defaults tofalse. -
string HeaderInfo { get; }
Returns the literal string"MainRegion". -
void OnPropertyChanged(string propertyName)
Raises thePropertyChangedevent for the specified property. -
event PropertyChangedEventHandler PropertyChanged
StandardINotifyPropertyChangedevent. -
Lifecycle methods (no-op):
Cleanup(),CleanupAsync(),Initialize(),Initialize(object),Initialize(object, object),InitializeAsync(),InitializeAsync(object),Activated()
All are empty stubs; no behavior implemented. -
OnRaiseNotification(NotificationContentEventArgs)(private)
Event handler that reformatsNotificationContentEventArgsand raisesNotificationRequest. -
OnBusyIndicatorNotification(bool)(private)
Event handler that setsIsBusyto the incoming boolean.
TRLReportViewModel
-
TRLReportViewModel(ITRLReportInputView inputView, ITRLReportOutputView outputView, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer, DTS.Serialization.Test test)
Constructor. InitializesTest,AvailableTimeUnits,SelectedTimeUnits,AvailableAccelerationUnits, andSelectedAccelerationUnit. CallsPopulateChannels()to populate channel arrays. Assigns views, sets upDataContext, initializesInteractionRequests, and subscribes to events. -
ITRLReportInputView InputView { get; set; }
Reference to the input view instance. -
ITRLReportOutputView OutputView { get; set; }
Reference to the output view instance. -
InteractionRequest<Notification> NotificationRequest { get; }
Prism interaction request for notifications. -
InteractionRequest<Confirmation> ConfirmationRequest { get; }
Prism interaction request for confirmations. -
DTS.Serialization.Test Test { get; set; }
The test object used to populate channels and metadata. -
bool IsDirty { get; }
Read-only property indicating unsaved changes. Currently never set totrue. -
bool IsBusy { get; set; }
Bindable busy state. Set viaOnBusyIndicatorNotification(bool). -
bool IsMenuIncluded { get; set; }
Bindable flag for menu inclusion. Defaults tofalse. -
bool IsNavigationIncluded { get; set; }
Bindable flag for navigation inclusion. Defaults tofalse. -
string HeaderInfo { get; }
Returns"MainRegion". -
string TestNumber { get; set; }
Bindable string for test number. -
string DateTimeText { get; set; }
Bindable string representation of_dateTime. Getter usesCultureInfo.CurrentCulture; setter parses viaDateTime.Parse. -
string CarName { get; set; }
Bindable string for car name. -
string Model { get; set; }
Bindable string for model. -
string TestTemperature { get; set; }
Bindable string for test temperature. -
string MeasurementPoint { get; set; }
Bindable string for measurement point. -
string CrashVelocity { get; set; }
Bindable string for crash velocity. -
string ImpactorID { get; set; }
Bindable string for impactor ID. -
string[] AvailableImpactorTypes => throw new NotImplementedException();
Unimplemented; throwsNotImplementedException. -
string SelectedImpactor { get; set; }
Bindable string for selected impactor. -
string ImpactorWeight { get; set; }
Bindable string for impactor weight. -
string Examiner { get; set; }
Bindable string for examiner name. -
string Reserved1 { get; set; }
Bindable string for reserved field 1. -
string Reserved2 { get; set; }
Bindable string for reserved field 2. -
DTS.SensorDB.FilterClass[] AvailableCFCs => throw new NotImplementedException();
Unimplemented; throwsNotImplementedException. -
DTS.SensorDB.FilterClass SelectedCFC { get; set; }
Bindable filter class. -
DTS.SensorDB.MeasurementUnit[] AvailableAccelerationUnits { get; set; }
Array of available acceleration units (initialized to"m/sec^2"and"g"). -
DTS.SensorDB.MeasurementUnit SelectedAccelerationUnit { get; set; }
Selected acceleration unit. Defaults to first inAvailableAccelerationUnits. -
ConstantsAndEnums.TimeUnits[] AvailableTimeUnits { get; set; }
Array of available time units (Seconds,MilliSeconds). -
ConstantsAndEnums.TimeUnits SelectedTimeUnits { get; set; }
Selected time unit. Defaults toSeconds. -
Event.Module.AnalogInputChannel[] AccelerationChannels { get; set; }
Array of acceleration channels (populated inPopulateChannels()). -
Event.Module.Channel SelectedAccelerationChannel { get; set; }
Selected acceleration channel. -
Event.Module.AnalogInputChannel[] AvailableBendingChannels { get; set; }
Array of bending channels (populated inPopulateChannels()). -
Event.Module.Channel SelectedBendingChannel { get; set; }
Selected bending channel. -
Event.Module.AnalogInputChannel[] AvailableShearChannels { get; set; }
Array of shear channels (populated inPopulateChannels()). -
Event.Module.Channel SelectedShearChannel { get; set; }
Selected shear channel. -
void PopulateChannels()(private)
FiltersTest.Channelsinto acceleration, bending, and shear channel arrays based on engineering units. UsesDTS.SensorDB.MeasurementUnitList.GetMeasurementUnit()for unit lookups. -
void OnPropertyChanged(string propertyName)
RaisesPropertyChangedevent. -
event PropertyChangedEventHandler PropertyChanged
StandardINotifyPropertyChangedevent. -
Lifecycle methods (no-op):
Same asHeadReportViewModel:Cleanup(),CleanupAsync(),Initialize(),Initialize(object),Initialize(object, object),InitializeAsync(),InitializeAsync(object),Activated()— all empty. -
OnRaiseNotification(NotificationContentEventArgs)(private)
Same behavior as inHeadReportViewModel. -
OnBusyIndicatorNotification(bool)(private)
Same behavior as inHeadReportViewModel.
3. Invariants
- View-ViewModel Binding: Both
InputViewandOutputViewhave theirDataContextset tothisin the constructor. This binding is immutable after construction. - Event Subscription: Both view models subscribe to
RaiseNotificationandBusyIndicatorChangeNotificationevents during construction. Subscriptions are not cleaned up (noUnsubscribecalls). IsBusyState:IsBusyis always set viaOnBusyIndicatorNotification(bool)and never modified directly elsewhere in the code.IsDirtyState:IsDirtyis read-only and never set totruein the provided code. Its value remainsfalsefor the lifetime of the object.HeaderInfo: Always returns"MainRegion"; no dynamic behavior.TestObject: InTRLReportViewModel,Testmust be non-null beforePopulateChannels()is called (called in constructor), orTest.Channelswill throwNullReferenceException.- Channel Population Logic:
PopulateChannels()only processes channels wherech.emc is Event.Module.AnalogInputChannel. Non-analog channels are skipped. - Unit Matching: Channel filtering uses
unit.UnitMatches(emc.EngineeringUnits)— behavior depends on implementation ofUnitMatches, not visible in source.
4. Dependencies
Internal Dependencies (from imports)
- Prism Framework:
Microsoft.Practices.Prism.Events(IEventAggregator,RaiseNotification,BusyIndicatorChangeNotification)Microsoft.Practices.Prism.Interactivity.InteractionRequest(InteractionRequest<T>,Notification,Confirmation)Microsoft.Practices.Prism.Regions(IRegionManager)Microsoft.Practices.Prism.Commands(DelegateCommand, commented out but referenced)
- Unity Container:
Microsoft.Practices.Unity(IUnityContainer) - Common Libraries:
DTS.Common.Events(RaiseNotification,BusyIndicatorChangeNotification,NotificationContentEventArgs)DTS.Common.Interface(IHeadReportInputView,IHeadReportOutputView,ITRLReportInputView,ITRLReportOutputView,IHeadReportViewModel,ITRLReportViewModel)DTS.Common.Utils(unused in visible code)DTS.Serialization.Test(Testproperty inTRLReportViewModel)DTS.SensorDB.MeasurementUnitList,DTS.SensorDB.FilterClass,DTS.SensorDB.MeasurementUnitPedestrianAndHeadReports.Classes(ConstantsAndEnums.TimeUnits)DTS.Slice.Control(unused in visible code)
- System Libraries:
System.ComponentModel(INotifyPropertyChanged)System.Threading.Tasks(Task)System.Linq(Where,AddRange)System.Collections.Generic(List<T>,Array)System.Text(unused in visible code)
External Dependencies
- UI Framework: WPF (inferred from Prism usage,
InteractionRequest, andOpenFileDialogin commented code). - Export Contracts:
IHeadReportInputView,IHeadReportOutputView(forHeadReportViewModel)ITRLReportInputView,ITRLReportOutputView(forTRLReportViewModel)
These interfaces must be implemented by views in the UI layer.
What Depends on This Module?
- The application shell or region manager must import and display views of type
IHeadReportInputView,IHeadReportOutputView,ITRLReportInputView, andITRLReportOutputView. - Event publishers for
RaiseNotificationandBusyIndicatorChangeNotificationmust exist (e.g., a global busy indicator manager or notification service).
5. Gotchas
IsDirtyis never updated: Both view models exposeIsDirtyas a read-only property, but it is never set totrue. This may mislead consumers expecting change tracking.NotImplementedExceptioninTRLReportViewModel:AvailableImpactorTypesandAvailableCFCsthrowNotImplementedException. Any binding to these properties will crash at runtime.DateTimeTextsetter is unsafe: UsesDateTime.Parse(value)without culture or exception handling. May throwFormatExceptionorOverflowExceptionon invalid input.- No cleanup logic:
Cleanup()andCleanupAsync()are empty stubs. Event subscriptions (_eventAggregator.GetEvent<...>().Subscribe(...)) are never unsubscribed, risking memory leaks. - Channel population assumes non-null
Test:PopulateChannels()accessesTest.Channelswithout null checks. IfTestisnull, aNullReferenceExceptionoccurs during construction. UnitMatchesbehavior unknown: Filtering channels relies onunit.UnitMatches(...), whose implementation is not visible. May cause incorrect channel inclusion/exclusion.- Redundant code: Both view models duplicate identical logic for
OnRaiseNotification,OnBusyIndicatorNotification, and lifecycle methods. Consider refactoring to a base class. - Commented-out import logic: Both files contain commented-out
ImportBrowseCommandand related code. This suggests incomplete or deprecated functionality; avoid relying on it. - Namespace
PedestrianAndHeadReports: Despite the namespace,HeadReportViewModelis not used for pedestrian reports (per file path and naming), only head reports.TRLReportViewModelappears to handle TRL (Test Report Layout) reports. HeaderInfois hardcoded: Returns"MainRegion"literally — likely a placeholder or legacy value with no dynamic meaning.