5.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T11:03:50.028977+00:00 | zai-org/GLM-5-FP8 | 1 | 7e23a726984c27b1 |
Documentation: DTS.Viewer.PSDReport Views
1. Purpose
This module provides WPF view components for the PSD (Power Spectral Density) Report feature within the DTS Viewer application. It contains two partial classes that serve as code-behind for XAML views: PSDReportMainView acts as a minimal container view, while PSDReportMainViewGrid manages tab focus behavior in response to graph loading events via Prism's event aggregation system.
2. Public Interface
PSDReportMainView (class)
Implements: IPSDReportMainView
Location: DTS.Viewer.PSDReport namespace
| Member | Signature | Description |
|---|---|---|
| Constructor | public PSDReportMainView() |
Initializes the XAML component. Contains commented-out code for AvalonDock layout serialization. |
PSDReportMainViewGrid (class)
Implements: IPSDReportMainViewGrid
Location: DTS.Viewer.PSDReport namespace
| Member | Signature | Description |
|---|---|---|
| Constructor | public PSDReportMainViewGrid() |
Initializes the XAML component and attaches a Loaded event handler. |
_eventAggregator |
private IEventAggregator |
Backing field for the Prism event aggregator, resolved at runtime. |
SetFocus |
private void SetFocus() |
Selects and focuses the chartResultsTab element. |
PSDReportMainViewGrid_Loaded |
private void PSDReportMainViewGrid_Loaded(object sender, RoutedEventArgs e) |
Resolves IEventAggregator from the container and subscribes to GraphLoadedCountNotification events. |
OnGraphLoadedCountNotification |
private void OnGraphLoadedCountNotification(GraphLoadedCountNotificationArg arg) |
Event handler that waits 3 seconds then sets focus to the chart results tab via Dispatcher.BeginInvoke. |
3. Invariants
- Container Availability:
PSDReportMainViewGridrequiresContainerLocator.Containerto be properly initialized before theLoadedevent fires, otherwise_eventAggregatorwill be null. - DataContext Type: The
DataContextofPSDReportMainViewGridmust be castable toIBaseViewModelfor the event filtering logic inOnGraphLoadedCountNotificationto function correctly. - XAML Element Existence: The
chartResultsTabelement (referenced inSetFocus()) must be defined in the associated XAML file. - Event Matching: The
OnGraphLoadedCountNotificationhandler only executes its focus logic whenarg.ParentVMmatches the view'sDataContext(after casting toIBaseViewModel).
4. Dependencies
This module depends on:
DTS.Common.Interface— ProvidesIPSDReportMainView,IPSDReportMainViewGrid, andIBaseViewModelDTS.Common.Base— Referenced but specific types not visible in code-behindDTS.Common.Events— ProvidesGraphLoadedCountNotificationevent andGraphLoadedCountNotificationArgPrism.Ioc— ProvidesContainerLocatorfor service resolutionPrism.Events— ProvidesIEventAggregatorfor pub/sub messagingSystem—ActiondelegateSystem.Threading—Thread.SleepSystem.Threading.Tasks—Task.Run
What depends on this module:
- Not determinable from the provided source files alone. Consumers would be modules that instantiate
IPSDReportMainVieworIPSDReportMainViewGrid(likely via dependency injection or navigation).
5. Gotchas
-
Hardcoded 3-Second Delay: The
OnGraphLoadedCountNotificationmethod usesThread.Sleep(TimeSpan.FromSeconds(3))before setting focus. This is a magic number with no configuration or explanation—likely a workaround for timing issues with graph rendering completion. -
Commented-Out AvalonDock Code:
PSDReportMainViewcontains significant commented-out code for layout serialization usingXmlLayoutSerializerand a file path.\DataProViewerAvalonDock.config. This suggests dock panel persistence was previously implemented but intentionally disabled. -
Late Event Subscription: Per the comment "FB 14797", the event subscription occurs in the
Loadedevent handler rather than the constructor. This means anyGraphLoadedCountNotificationevents fired before the view is fully loaded will be missed. -
Silent Failure on Container Resolution: The
_eventAggregator?.GetEvent<...>()call uses a null-conditional operator. IfContainerLocator.Container.Resolve<IEventAggregator>()returns null, the subscription silently fails with no logging or error handling. -
Dispatcher Threading: The focus operation is marshaled to the UI thread via
Dispatcher.BeginInvoke, but the 3-second sleep runs on a background thread viaTask.Run. This is intentional but could be a source of race conditions if the view is unloaded during the wait period.