Files
2026-04-17 14:55:32 -04:00

8.2 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/Model/GraphPropertyObject.cs
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/Model/GraphObject.cs
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/Model/TreeViewChannels.cs
DTS Viewer/DTS.Viewer.Modules/DTS.Viewer.GraphList/Model/TreeViewIds.cs
2026-04-16T11:11:47.054703+00:00 zai-org/GLM-5-FP8 1 47d9a78e7853eabc

Documentation: DTS.Viewer.GraphList.Models

1. Purpose

This module provides the data model classes for the Graph List functionality within the DTS Viewer application. It defines the structure for individual graph objects (GraphObject, GraphPropertyObject) and the hierarchical view models required to populate WPF TreeView controls (TreeViewChannels, TreeViewIds). The module bridges raw data with UI-specific behaviors, implementing INotifyPropertyChanged for data binding and handling complex selection logic for channel and event navigation.

2. Public Interface

Class: GraphPropertyObject

Located in DTS.Viewer.GraphList.Model. A POCO-style class decorated with attributes for the Xceed WPF Toolkit PropertyGrid.

  • GraphPropertyObject(): Default constructor.
  • int Id: Read-only property categorized under "Information".
  • string Name: Read-only property categorized under "Information".
  • string Description: Read-only property categorized under "Information".
  • string Filter: Categorized under "Parameters"; uses ItemsSource(typeof(CFCFilterItemSource)).
  • string DataFlag: Categorized under "Parameters".
  • double ShiftT0: Categorized under "Parameters".
  • double EuMultiplier: Categorized under "Parameters".
  • double EuOffset: Categorized under "Parameters".

Class: GraphObject

Located in DTS.Viewer.GraphList.Model. Implements IBaseClass. Represents a single graph entity containing both data and display parameters.

  • GraphObject(): Constructor that calls LoadGraphs().
  • int RecordId: Gets or sets the record ID; notifies property change.
  • int Id: Gets or sets the ID; synchronizes with Property.Id.
  • string Name: Gets or sets the name; synchronizes with Property.Name.
  • string Description: Gets or sets the description; synchronizes with Property.Description.
  • CFCFilter Filter: Gets or sets the filter; synchronizes with Property.Filter (converted to string).
  • string DataFlag: Gets or sets the data flag; synchronizes with Property.DataFlag.
  • double ShiftT0: Gets or sets the T0 shift; synchronizes with Property.ShiftT0.
  • double EuMultiplier: Gets or sets the EU multiplier; synchronizes with Property.EuMultiplier.
  • double EuOffset: Gets or sets the EU offset; synchronizes with Property.EuOffset.
  • List<double> Data: Gets or sets the list of data points.
  • bool Visable: Gets or sets the visibility state.
  • GraphPropertyObject Property: Gets or sets the internal property object wrapper.
  • event PropertyChangedEventHandler PropertyChanged: Event for property change notification.
  • void OnPropertyChanged(string propertyName): Invokes the PropertyChanged event.

Class: TreeViewChannels

Located in DTS.Viewer.GraphList. Implements IBaseModel. Root node for binding a channel-based TreeView.

  • string Name: Gets or sets the node name.
  • ObservableCollection<TestGroup> Groups: Gets or sets the child groups; updates GroupsCount on set.
  • int GroupsCount: Gets or sets the count of groups.
  • string Path: Gets or sets the path.
  • bool IsSaved: Getter only (read-only).
  • bool IsExpanded: Gets or sets the expanded state of the TreeView node.
  • bool IsSelected: Gets or sets the selected state.

Class: TestGroup

Located in DTS.Viewer.GraphList. Child node for TreeViewChannels.

  • IBaseViewModel Parent: Gets or sets the parent ViewModel.
  • bool IsLocked: Gets or sets the locked state; calls ((IGraphMainViewModel)Parent).AddLockedGroupChannels(...) on set.
  • bool IsSelected: Gets or sets the selected state; calls ((IGraphMainViewModel)Parent).AddSelectedGroupChannels(...) on set. Ignores selection if Name starts with "Test Channels" or "Calculated Channels".
  • bool CanLock: Controls whether the item can be locked.
  • ObservableCollection<ITestChannel> Channels: Gets or sets the collection of channels.
  • Other Properties: Path, DTSFile, IsGraph, IsExpanded, TestName, Name, DisplayName, ChannelCount.

Class: TreeViewIds

Located in DTS.Viewer.GraphList. Implements IBaseModel. Root node for binding an ID/Event-based TreeView.

  • IBaseViewModel Parent: Gets or sets the parent ViewModel.
  • int TreeIndex: Gets or sets the index of this tree node.
  • ObservableCollection<ITestEvent> Events: Gets or sets child events.
  • bool IsSelected: Gets or sets the selected state; manages cascading selection to children via SetChildNodes.
  • void SetChildNodes(bool isSelected): Iterates through Events and sets their IsSelected property.
  • static void SetIsItemSelected(UIElement element, bool value): Attached property setter for IsItemSelectedProperty.

Class: TestEvent

Located in DTS.Viewer.GraphList. Implements ITestEvent. Child node for TreeViewIds.

  • bool IsSelected: Complex setter that handles Shift/Ctrl key logic for multi-selection. Interacts with IExportGraphMainViewModel to manage selection lists (AddToSelectedEvents, RemoveFromSelectedEvents).
  • bool IsLocked: Gets or sets locked state; calls ((IExportGraphMainViewModel)parent).AddLockedEvents(...) on set.
  • Other Properties: Path, Parent, IsGraph, IsExpanded, CanLock, TestName, Name, TestSetupName, TestItem, DTSFile, DataType, Events, TestId, TreeIndex.

3. Invariants

  • Synchronization: When GraphObject.Id, Name, Description, Filter, DataFlag, ShiftT0, EuMultiplier, or EuOffset are set, the corresponding property on the internal GraphPropertyObject instance (accessed via Property) must be updated immediately.
  • Type Conversion: GraphObject.Filter is of type CFCFilter (enum), but it is stored as a string in GraphPropertyObject.Filter.
  • Collection Counts: Setting TreeViewChannels.Groups automatically updates GroupsCount. Setting TestGroup.Channels automatically updates ChannelCount. Setting TreeViewIds.Events automatically updates EventCount.
  • Parent Interface Requirements:
    • TestGroup requires its Parent to be castable to IGraphMainViewModel.
    • TreeViewIds and TestEvent require their Parent to be castable to IExportGraphMainViewModel.

4. Dependencies

Internal Dependencies (Inferred from imports):

  • DTS.Common: Uses CFCFilter enum and CFCFilterItemSource.
  • DTS.Common.Base: Uses IBaseClass, IBaseModel.
  • DTS.Common.Interface: Uses IBaseViewModel, ITestChannel, ITestEvent, IGraphMainViewModel, IExportGraphMainViewModel.

External Dependencies:

  • Xceed.Wpf.Toolkit.PropertyGrid.Attributes: Used for Category, DisplayName, ReadOnly, Description, and ItemsSource attributes in GraphPropertyObject.
  • System.Windows: Used for DependencyProperty, UIElement, Input.Keyboard, Controls.ItemsControl.

5. Gotchas

  • Typo in Property Name: GraphObject.Visable appears to be a typo for "Visible".
  • Silent Failures in Selection Logic: In TreeViewIds.IsSelected, if Parent is null or not of type IExportGraphMainViewModel, the setter returns early without setting the backing field or notifying property change.
  • Complex Setter Logic (Side Effects):
    • Setting TestGroup.IsSelected or TestEvent.IsSelected triggers logic in the parent ViewModel that modifies global state (selection lists).
    • TestEvent.IsSelected reads static keyboard state (Keyboard.IsKeyDown) directly within the property setter. This ties the model tightly to the UI input state and can cause unpredictable behavior if the property is set programmatically rather than via user interaction.
  • **Hardcoded String Comparisons