4.9 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:37:48.788166+00:00 | zai-org/GLM-5-FP8 | 1 | 9dcac2937b5c346b |
Documentation: PSDReportSettingsViewModel
1. Purpose
PSDReportSettingsViewModel is a Prism-based ViewModel responsible for managing Power Spectral Density (PSD) report settings within the DTS Viewer application. It serves as a mediator between graph visualization components and report settings, responding to user interactions such as channel selection and axis changes, and publishing those changes to other system components via the event aggregator. The class extends BaseViewModel<IPSDReportSettingsModel> and implements IPSDReportSettingsViewModel.
2. Public Interface
Properties
| Property | Type | Description |
|---|---|---|
View |
IBaseView |
Gets or sets the associated view instance. |
Parent |
IBaseViewModel |
Gets or sets the parent ViewModel reference. |
Model |
IPSDReportSettingsModel |
Gets or sets the model instance. Uses new keyword to hide base class property. Raises OnPropertyChanged("Model") on set. |
NotificationRequest |
InteractionRequest<Notification> |
Interaction request for displaying notifications to the user. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Interaction request for displaying confirmation dialogs. Uses new keyword to hide base class property. |
Constructor
public PSDReportSettingsViewModel(
IPSDReportSettingsView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
Creates a new instance, initializes the view's DataContext, and creates interaction request objects.
Methods
public override void Initialize()
Empty override. No initialization logic performed.
public override void Initialize(object parameter)
Initializes the ViewModel with a parent reference (cast to IBaseViewModel), subscribes to events, resolves the IPSDReportSettingsModel from the Unity container, and sets the model's Parent property.
public void PublishChanges()
Publishes a PSDReportSettingsChangedEvent with a PSDReportSettingsChangedEventArg containing the current Model and ParentVM reference.
3. Invariants
- Parent Filtering: Event handlers (
OnChartAxisChanged,OnGraphSelectedChannelsChanged) ignore events wherearg.ParentVMdoes not matchParent. - Publish Guard: When handling X-axis changes,
Model.CanPublishChangesis set tofalsebefore modifyingDataStart/DataEnd, then restored totruebefore callingPublishChanges(). This prevents potential recursive event propagation. - Model Resolution: The
Modelis resolved from the Unity container duringInitialize(object parameter), not in the constructor.
4. Dependencies
This Module Depends On
| Namespace/Module | Usage |
|---|---|
DTS.Common.Base |
BaseViewModel<T> base class |
DTS.Common.Events |
Event types: GraphSelectedChannelsNotification, GraphClearNotification, ChartAxisChangedEvent, PSDReportSettingsChangedEvent and their argument types |
DTS.Common.Interactivity |
InteractionRequest<T>, Notification, Confirmation |
DTS.Common.Interface |
IBaseView, IBaseViewModel, IPSDReportSettingsModel, IPSDReportSettingsView, IPSDReportSettingsViewModel |
Prism.Events |
IEventAggregator |
Prism.Regions |
IRegionManager |
Unity |
IUnityContainer for dependency resolution |
What Depends On This Module
- Unclear from source alone: The module publishes
PSDReportSettingsChangedEvent, indicating subscribers elsewhere in the system consume this ViewModel's output, but specific consumers are not visible in this file.
5. Gotchas
-
Property Hiding: Both
ModelandConfirmationRequestuse thenewkeyword to hide base class members. This can lead to unexpected behavior if the ViewModel is accessed via a base class reference. -
Commented-Out Code: Several features appear incomplete or disabled:
Standaloneproperty is commented out- Y-axis handling in
OnChartAxisChangedis commented out PublishChanges()call inOnGraphSelectedChannelsChangedis commented outCursorsAlailableChangedEventsubscription is commented outView.DataContext = Modelassignment inInitialize(object parameter)is commented out
-
Empty
Initialize()Override: The parameterlessInitialize()method is empty. All initialization logic resides in the overloaded version. -
Unused
OnRaiseNotificationMethod: This private method exists but is never called within the visible source. It may be wired via event subscription not shown in this file. -
Async Pattern Absent: Despite importing
System.Threading.Tasks, no async operations are performed in this class.