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

5.5 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
DTS Viewer/DTS.Viewer/View/DockPanelVertical/ViewModel/DockPanelVerticalViewModel.cs
2026-04-16T14:04:21.621857+00:00 zai-org/GLM-5-FP8 1 0185c1c3d29b204b

DockPanelVerticalViewModel Documentation

1. Purpose

DockPanelVerticalViewModel is a ViewModel component for a vertical dock panel UI element within a WPF/Prism-based application. It serves as a container view model that manages notification and confirmation dialogs via Prism's InteractionRequest pattern, and exposes state properties for menu and navigation inclusion. The class inherits from BaseViewModel<IDockPanelVerticalViewModel> and implements the IDockPanelVerticalViewModel interface, participating in Prism's region navigation and event aggregation system.


2. Public Interface

Constructor

public DockPanelVerticalViewModel(
    IDockPanelVerticalView view, 
    IRegionManager regionManager, 
    IEventAggregator eventAggregator, 
    IUnityContainer unityContainer)

Initializes the view model, sets the View's DataContext to itself, creates NotificationRequest and ConfirmationRequest instances, and subscribes to the RaiseNotification event via the event aggregator.

Properties

Property Type Access
View IDockPanelVerticalView public get; private set
NotificationRequest InteractionRequest<Notification> public get; private set
ConfirmationRequest InteractionRequest<Confirmation> public get; private set
IsMenuIncluded bool public get; set
IsNavigationIncluded bool public get; set
IsBusy bool public get; set
IsDirty bool public get; private set

Events

public event PropertyChangedEventHandler PropertyChanged;

Declared but never invoked within this class.

Lifecycle Methods (All Throw NotImplementedException)

Method Signature
Initialize() public override void Initialize()
Initialize(object) public override void Initialize(object parameter)
Activated() public override void Activated()
Cleanup() public override void Cleanup()
CleanupAsync() public new Task CleanupAsync()
Initialize(object, object) public new void Initialize(object parameter, object model)
InitializeAsync() public override Task InitializeAsync()
InitializeAsync(object) public override Task InitializeAsync(object parameter)

Private Event Handler

private void OnRaiseNotification(NotificationContentEventArgs eventArgsWithTitle)

Handles RaiseNotification events by creating a new NotificationContentEventArgs (without title) and raising the NotificationRequest with both content and title extracted from the original event args.


3. Invariants

  1. DataContext Binding: The View's DataContext is always set to the ViewModel instance upon construction.
  2. InteractionRequest Initialization: NotificationRequest and ConfirmationRequest are never null after construction.
  3. Event Subscription: The view model is always subscribed to RaiseNotification event after construction (no unsubscribe logic is visible).
  4. IsDirty Encapsulation: IsDirty can only be modified internally (private setter).

4. Dependencies

This Module Depends On:

  • DTS.Common.Base — Provides BaseViewModel<T>
  • DTS.Common.Events — Provides RaiseNotification event class and NotificationContentEventArgs
  • DTS.Common.Interface — Provides IDockPanelVerticalViewModel, IViewModel, IDockPanelVerticalView
  • Microsoft.Practices.Prism.EventsIEventAggregator
  • Microsoft.Practices.Prism.Interactivity.InteractionRequestInteractionRequest<T>, Notification, Confirmation
  • Microsoft.Practices.Prism.RegionsIRegionManager
  • Microsoft.Practices.UnityIUnityContainer

What Depends On This Module:

Cannot be determined from source alone. The consumers of IDockPanelVerticalViewModel or DockPanelVerticalViewModel are not visible in this file.


5. Gotchas

  1. Incomplete Implementation: All lifecycle methods (Initialize, Activated, Cleanup, and their async variants) throw NotImplementedException. This class appears to be a stub or work-in-progress.

  2. Method Hiding with new Keyword:

    • CleanupAsync() and Initialize(object, object) use new instead of override, hiding base class members. This may cause unexpected behavior when calling through base class references.
  3. Field Shadowing: The _regionManager field is declared with new, suggesting it shadows a base class member. The reason for this is unclear from source alone.

  4. Unused PropertyChanged Event: The PropertyChanged event is declared but never raised. Property setters for IsMenuIncluded, IsNavigationIncluded, and IsBusy do not trigger change notifications, which may break UI binding updates.

  5. No Unsubscribe Logic: The subscription to RaiseNotification event in the constructor has no corresponding unsubscribe in any cleanup method. This could cause memory leaks if view model instances are not properly garbage collected.

  6. Data Transformation in OnRaiseNotification: The handler creates a new NotificationContentEventArgs object from the received one, separating title from content. This transformation may be intentional but appears redundant without additional context.