6.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T13:51:13.371255+00:00 | zai-org/GLM-5-FP8 | 1 | cd4107fac05f80cd |
GraphViewModel Documentation
1. Purpose
GraphViewModel is a ViewModel within the DTS.Viewer.Graph module that manages graph visualization and coordinates data series display. It serves as a mediator between parent ViewModels (IViewerMainViewModel or IPSDReportMainViewModel) and the graph rendering components, handling event-driven communication for channel selection, test summaries, and data loading progress. The class follows the MVVM pattern using Prism and Unity, providing bindable properties for UI state management and interaction requests for user notifications.
2. Public Interface
Constructor
public GraphViewModel(
IGraphView view,
IRegionManager regionManager,
IEventAggregator eventAggregator,
IUnityContainer unityContainer)
Initializes the ViewModel, sets the View's DataContext, and creates NotificationRequest and ConfirmationRequest instances.
Public Properties
| Property | Type | Description |
|---|---|---|
View |
IGraphView |
The associated graph view instance. |
Parent |
IBaseViewModel (internal) |
Reference to the parent ViewModel. |
DataSeriesView |
ITestDataSeriesView |
The data series view used for chart rendering. |
NotificationRequest |
InteractionRequest<Notification> |
Interaction request for displaying notifications. |
ConfirmationRequest |
InteractionRequest<Confirmation> |
Interaction request for displaying confirmations. |
ContextGraphRegion |
object |
Gets/sets the content of the GraphRegion on the View. |
MessageText |
string |
User-facing message text. Default: "Please select Event(s) to export data". |
MessageVisibility |
bool |
Controls visibility of the message panel. |
ProgressPercent |
double |
Progress percentage for data loading operations. Default: 0D. |
ProgressText |
string |
Progress message text. Default: "Reading channel data...". |
ProgressVisibility |
bool |
Controls visibility of the progress indicator. |
GraphInfoVisibility |
bool |
Controls visibility of graph information. |
GraphVisibility |
bool |
Computed as !MessageVisibility. |
HeaderInfo |
string |
Returns constant "GraphRegion". |
IsBusy |
bool |
Busy state indicator. |
IsDirty |
bool |
Always returns false (read-only). |
Public Methods
public override void Initialize()
Empty override; performs no initialization.
public override void Initialize(object parameter)
Performs context-specific initialization based on parameter type:
- If
parameterisIViewerMainViewModel: CallsSubscribe()and initializesDataSeriesView. - If
parameterisTuple<IBaseViewModel, string>whereItem1isIPSDReportMainViewModel: CallsSubscribeDataSelect()orSubscribeResult()based onItem2value, and configures chart scrollbars/actions accordingly.
3. Invariants
IsDirtyalways returnsfalseand cannot be modified.HeaderInfoalways returns the string"GraphRegion".GraphVisibilityis always the logical inverse ofMessageVisibility.- Event handlers (
OnTestSelectedCountChanged,OnGraphSelectedCountChanged,OnGraphChannelsReadCompleted,OnGraphChannelReadCalcProgressChangedEvent) check thatParentorthismatches the event argument's source before processing. OnGraphChannelsReadCompletedreturns early ifargisnull.OnGraphChannelReadCalcProgressChangedEventonly updatesProgressPercentif the value is>= 0.
4. Dependencies
This Module Depends On
| Namespace | Purpose |
|---|---|
C1.WPF.C1Chart |
ComponentOne charting controls (AxisScrollBar). |
DTS.Common.Base |
Base classes (BaseViewModel<T>, IBaseModel, IBaseViewModel). |
DTS.Common.Events |
Event types: RaiseNotification, GraphSelectedChannelCountNotification, TestSummaryCountNotification, TestModificationChangedEvent, GraphChannelsReadCompletedNotification, GraphChannelReadCalcProgressChangedEvent. |
DTS.Common.Interactivity |
InteractionRequest<T>, Notification, Confirmation. |
DTS.Common.Interface |
IGraphViewModel, ITestDataSeriesView, ITestDataSeriesViewModel, IViewerMainViewModel, IPSDReportMainViewModel. |
Prism.Events |
IEventAggregator, ThreadOption. |
Prism.Regions |
IRegionManager. |
Unity |
IUnityContainer. |
External Types Referenced (Not Defined Here)
GraphView- Concrete view type cast inContextGraphRegionproperty.TestDataSeriesView- Concrete data series view cast for chart configuration.TestDataSeriesViewModel- Concrete ViewModel cast for callingSubscribePSD().ITestModificationModel- Parameter type forOnTestModificationChanged.- Various event argument types:
TestSummaryCountNotificationArg,GraphSelectedChannelCountNotificationArg,NotificationContentEventArgs,GraphChannelsReadCompletedNotificationArgs,GraphChannelReadCalcProgressChangedEventArgs.
5. Gotchas
-
Member Hiding with
newKeyword: The class usesnewto hide multiple base class members (Model,ConfirmationRequest,PropertyChanged,OnPropertyChanged,IsBusy,IsDirty). This can cause unexpected behavior when casting to base types. -
Code Duplication in Subscribe Methods:
Subscribe(),SubscribeDataSelect(), andSubscribeResult()have nearly identical implementations. The only difference isSubscribe()includesTestModificationChangedEventsubscription, while the others do not—butOnTestModificationChangedis an empty method body. -
Empty Event Handler:
OnTestModificationChanged(ITestModificationModel obj)is subscribed but contains no implementation. -
Concrete Type Casting: The code casts interfaces to concrete types (
GraphView,TestDataSeriesView,TestDataSeriesViewModel) which breaks abstraction and could cause runtime failures if implementations change:((AxisScrollBar)((TestDataSeriesView)DataSeriesView).MainChart.View.AxisX.ScrollBar).Visibility = ... ((TestDataSeriesView)DataSeriesView).MainChart.Actions.Clear(); ((TestDataSeriesViewModel)viewModel).SubscribePSD(); -
Hardcoded String Comparisons: The
Initialize(object parameter)method uses string literals ("DataSelect","Graph") for control flow, which is fragile. -
Unused Private Field: The
Modelproperty is set but never accessed elsewhere in the visible code. -
ReSharper Suppressions: The file contains numerous ReSharper directive suppressions, suggesting known code quality issues that were disabled rather than addressed.