Files

44 lines
3.8 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/ViewModel/GraphMainViewModel.cs
generated_at: "2026-04-17T15:56:47.220918+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "2bd73de841af2654"
---
# Documentation: GraphMainViewModel
## 1. Purpose
The `GraphMainViewModel` class serves as the presentation logic controller for the Graph List module within the DTS Viewer application. Its primary responsibility is to manage the display, filtering, selection, and locking of test channels (including graph channels, calculated channels, and raw test channels) derived from `ITestSummary` objects. It acts as a bridge between the data layer (test summaries) and the UI layer (tree views, lists), coordinating user interactions via Prism's `IEventAggregator` to publish channel selections and notify other modules of state changes.
## 2. Public Interface
### Properties
* **`IFilterView FilterView`**: Gets the filter view instance associated with this model.
* **`IGraphMainView View`**: Gets or sets the associated view interface.
* **`IBaseViewModel Parent`**: Gets or sets the parent ViewModel (checked specifically for `IPSDReportMainViewModel` during initialization).
* **`InteractionRequest<Notification> NotificationRequest`**: Gets the interaction request for displaying notifications.
* **`InteractionRequest<Confirmation> ConfirmationRequest`**: Gets the interaction request for displaying confirmations.
* **`bool IsFilterEnabled`**: Gets or sets a value indicating whether the filter UI is enabled (true when `ChannelList` has items).
* **`string SelectedGroupName`**: Gets or sets the name of the currently selected group.
* **`string LockedGroupName`**: Gets or sets the name of the currently locked group.
* **`List<ITestChannel> LockedChannelList`**: Gets or sets the list of channels currently locked by the user.
* **`List<ITestChannel> SelectedChannelList`**: Gets or sets the list of channels currently selected by the user.
* **`ObservableCollection<ITestChannel> ChannelList`**: Gets or sets the full list of available channels.
* **`ObservableCollection<ITestChannel> FilteredChannelList`**: Gets or sets the list of channels displayed after filtering.
* **`ObservableCollection<TreeViewChannels> TestChannelsTree`**: Gets or sets the hierarchical tree structure of channels displayed in the UI.
* **`object ContextGraphMainRegion`**: Gets or sets the data context for the `GraphMainRegion` within the view.
* **`string HeaderInfo`**: Returns the constant string "GraphRegion".
* **`bool TestModified`**: Gets or sets a flag indicating if the test has been modified.
### Methods
* **`void Initialize()`**: Overrides base method. Empty implementation.
* **`void Initialize(object parameter)`**: Initializes the ViewModel, sets the parent, determines if locked-only mode is required, initializes the filter view, and subscribes to events.
* **`void PublishSelectedChannels()`**: Publishes the current lists of locked and selected channels via `GraphSelectedChannelsNotification` and `GraphSelectedChannelCountNotification`.
* **`void OnFilterChanged(FilterParameterArgs args)`**: Filters the `ChannelList` based on the string parameter provided in `args`, updating `FilteredChannelList`.
* **`void AddLockedGroupChannels(string testName, string groupName, List<ITestChannel> channels, bool isLocked)`**: Adds or removes a group of channels to/from the `LockedChannelList`.
* **`void AddLockedChannel(ITestChannel channel, bool isLocked)`**: Adds or removes a single channel to/from the `LockedChannelList`.
* **`void AddSelectedGroupChannels(string groupName, List<ITestChannel> channels)`**: Selects a specific group of channels, resetting previous selections.
* **`void AddSelectedGroup(TestGroup group)`**: Marks a specific `TestGroup` as selected.
* **`void AddSelectedChannel(ITestChannel channel, bool reset)`**: