8.4 KiB
8.4 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T11:03:20.289994+00:00 | zai-org/GLM-5-FP8 | 1 | 280cd655454826b4 |
Documentation: PSDReportMainViewModel
1. Purpose
The PSDReportMainViewModel class serves as the primary view model for the PSD Report module within the DTS Viewer application. It acts as a central coordinator, managing the lifecycle and composition of various child views (graphs, tests, settings, navigation) via Prism's RegionManager and Unity dependency injection. This module handles user interactions related to data selection, calibration settings, and channel view modes, while maintaining state for loaded and selected tests/graphs and communicating changes to other components via an IEventAggregator.
2. Public Interface
Constructor
PSDReportMainViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)- Initializes the view model, creates interaction requests (
NotificationRequest,ConfirmationRequest), resolves the main view (IPSDReportMainViewGrid), and sets the DataContext.
- Initializes the view model, creates interaction requests (
Properties
IBaseView View { get; set; }: Gets or sets the associated view instance.InteractionRequest<Notification> NotificationRequest { get; }: Request object for triggering notifications.InteractionRequest<Confirmation> ConfirmationRequest { get; }: Request object for triggering confirmation dialogs.- Region Context Properties:
object ContextNavigationRegion: Content for the Navigation region.object ContextGraphsRegion: Content for the GraphList region. Note: Getter/Setter referencesGraphListRegion.object ContextGraphListRegion: Content for the GraphList region. Note: Identical toContextGraphsRegion.object ContextTestsRegion: Content for the Tests region.object ContextLegendRegion: Content for the Legend region.object ContextPropertyRegion: Auto-property; does not appear to interact with the View.object ContextChartOptionsRegion: Content for the ChartOptions region.object ContextViewerSettingsRegion: Content for the Settings region.object ContextReportDataSelectRegion: Content for the DataSelect region.object ContextGraphRegion: Content for the Graph region.object ContextReportChartOptionsRegion: Content for the ReportChartOptions region.object ContextReportResultsRegion: Content for the ReportResults region.
string ConfigPath { get; set; }: ThrowsNotImplementedException.string TitleTests { get; set; }: Title for the Tests section, updated based on selection counts.int TotalSelectedTests { get; set; }: Count of selected tests; updatesTitleTests.int TotalLoadedTests { get; set; }: Count of loaded tests; updatesTitleTests.string TitleGraphs { get; set; }: Title for the Graphs section.int TotalSelectedGraphs { get; set; }: Count of selected graphs.int TotalLoadedGraphs { get; set; }: Count of loaded graphs.string SelectedDataFolder { get; set; }: Sets the data folder and publishesDataFolderChangedEvent. Ignores null/empty values.string SelectedDataFile { get; set; }: Sets the data file and publishesDataFolderChangedEvent. Ignores null/empty values.IsoViewMode ChannelCodeViewMode { get; set; }: Gets or sets the channel view mode; publishesChannelCodesViewChangedEvent.CalibrationBehaviors CalibrationBehaviorSetting { get; set; }: Gets or sets calibration behavior; publishesCalibrationBehaviorSettingChangedEvent.bool CalibrationBehaviorSettableInViewer { get; set; }: Determines if calibration is settable; publishesCalibrationBehaviorSettableInViewerChangedEventand manipulates View tab selection directly.Visibility SettingsVisibility { get; }: Controls visibility of settings.bool IsBusy { get; set; }: Controls busy indicator visibility.string IsBusyMessage { get; set; }: Text displayed when busy.bool IsMenuIncluded { get; set; }: Flag for menu inclusion.bool IsNavigationIncluded { get; set; }: Flag for navigation inclusion.bool IsDirty: ThrowsNotImplementedException.
Methods
List<FrameworkElement> GetRegions(): Retrieves child elements named "Region" from theMainShell.void Initialize(): CallsSubscribe()to register event listeners.void Initialize(object parameter): Sets theParentwindow model, updates parent properties, and subscribes to events.void LeftKeyPress(): ThrowsNotImplementedException.void RightKeyPress(): ThrowsNotImplementedException.void ZoomReset(): PublishesResetZoomChangedEvent.void SelectAndIncludeDataFile(string value): Sets the selected file and publishes aDataFolderChangedEventwithSetSelectedflag.event PropertyChangedEventHandler PropertyChanged: Event for property change notifications (hides base event).
3. Invariants
- View Resolution: The
Viewproperty is expected to be an instance ofPSDReportMainViewGrid(resolved viaIPSDReportMainViewGrid). All region properties castViewto this concrete type, implying the interfaceIPSDReportMainViewGridis not used for region access, or the concrete type is strictly required for UI element access. - Event Aggregator: The class relies heavily on
_eventAggregatorbeing non-null for almost all property setters and initialization logic. - Parent Type: In
Initialize(object parameter), theparametermust be castable toIBaseWindowModel. - Busy Counter: The private
readsinteger is used to track nested "busy" states during graph channel reading; it assumes a balanced start/stop notification pattern.
4. Dependencies
External Dependencies (Inferred from usings)
- Prism:
IEventAggregator,IRegionManager,InteractionRequest,Notification,Confirmation. - Unity:
IUnityContainer. - System.Windows:
FrameworkElement,Visibility.
Internal Dependencies (DTS Namespace)
- Common:
BaseViewModel,IBaseView,IBaseWindowModel,IBaseViewModel,Utils. - Enums:
IsoViewMode,CalibrationBehaviors. - Events:
DataFolderChangedEvent,ChannelCodesViewChangedEvent,CalibrationBehaviorSettingChangedEvent,LoadViewModulEvent,TestLoadedCountNotification, etc. - Views/ViewModels (Resolved via Unity):
IPSDReportMainViewGridINavigationView/INavigationViewModelIPSDReportResultsView/IPSDReportResultsViewModelIPSDReportSettingsView/IPSDReportSettingsViewModelIChartOptionsView/IChartOptionsViewModelIGraphView/IGraphViewModelIGraphMainView/IGraphMainViewModelIViewerSettingsView/IViewerSettingsViewModelITestSummaryListView/ITestSummaryListViewModel
5. Gotchas
- Not Implemented Members: Several members throw
NotImplementedException(ConfigPath,IsDirty,LeftKeyPress,RightKeyPress). These are likely interface requirements that have not been fulfilled. - Duplicate Region Properties:
ContextGraphsRegionandContextGraphListRegionare functionally identical; both access((PSDReportMainViewGrid)View).GraphListRegion.Content. This may be a copy-paste error or redundant API surface. - MVVM Violation (View Coupling): The
CalibrationBehaviorSettableInViewersetter directly manipulates View UI elements (graphsTab,testsTab,chartResultsTab) by castingViewtoPSDReportMainViewGrid. This breaks the separation of concerns typically enforced in MVVM and creates a hard dependency on the concrete View type. - Member Hiding: The
newkeyword is used to hide inherited members (IsBusy,IsBusyMessage,IsMenuIncluded,IsNavigationIncluded,PropertyChanged,OnPropertyChanged). This suggests a mismatch between the base class implementation and the requirements of this specific view model, which could lead to confusion if the object is referenced via a base type pointer. - Unused Property:
ContextPropertyRegionis defined as an auto-property but is never assigned or used within the class logic, unlike other region properties. - Magic Strings: Region names (e.g., "Graph", "DataSelect") and property names in
OnPropertyChangedare passed as string literals.