--- source_files: - DTS Viewer/DTS.Viewer/View/DockPanelVertical/ViewModel/DockPanelVerticalViewModel.cs generated_at: "2026-04-16T11:25:25.613899+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "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 the data context for `IDockPanelVerticalView`, managing notification/confirmation dialogs and exposing panel configuration state flags. The class inherits from `BaseViewModel` and integrates with Prism's event aggregation and region management infrastructure. --- ## 2. Public Interface ### Constructor ```csharp public DockPanelVerticalViewModel( IDockPanelVerticalView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer) ``` Initializes the ViewModel, sets the View's DataContext to itself, creates interaction requests, and subscribes to the `RaiseNotification` event. ### Properties | Property | Type | Access | Description | |----------|------|--------|-------------| | `View` | `IDockPanelVerticalView` | `get` | Reference to the associated view instance. | | `NotificationRequest` | `InteractionRequest` | `get` | Prism interaction request for displaying notifications. | | `ConfirmationRequest` | `InteractionRequest` | `get` | Prism interaction request for displaying confirmations. | | `IsMenuIncluded` | `bool` | `get/set` | Flag indicating whether a menu is included in the panel. | | `IsNavigationIncluded` | `bool` | `get/set` | Flag indicating whether navigation is included in the panel. | | `IsBusy` | `bool` | `get/set` | Busy state indicator. | | `IsDirty` | `bool` | `get` (private set) | Dirty state indicator; read-only externally. | ### Events ```csharp public event PropertyChangedEventHandler PropertyChanged; ``` Declared but **never invoked** within this class. ### Methods | Method | Return Type | Behavior | |--------|-------------|----------| | `Initialize()` | `void` | Throws `NotImplementedException`. | | `Initialize(object parameter)` | `void` | Throws `NotImplementedException`. | | `Initialize(object parameter, object model)` | `void` | Throws `NotImplementedException`. Uses `new` keyword. | | `InitializeAsync()` | `Task` | Throws `NotImplementedException`. | | `InitializeAsync(object parameter)` | `Task` | Throws `NotImplementedException`. | | `Activated()` | `void` | Throws `NotImplementedException`. | | `Cleanup()` | `void` | Throws `NotImplementedException`. | | `CleanupAsync()` | `Task` | Throws `NotImplementedException`. Uses `new` keyword. | --- ## 3. Invariants - **DataContext Binding**: The View's `DataContext` is always set to `this` ViewModel instance upon construction. - **Event Subscription**: The ViewModel subscribes to `RaiseNotification` event during construction; the subscription lifetime is tied to the EventAggregator's scope. - **Notification Transformation**: `OnRaiseNotification` transforms `NotificationContentEventArgs` (with title) into `NotificationContentEventArgs` (without title) plus a separate Title string when raising the notification request. --- ## 4. Dependencies ### This module depends on: - `DTS.Common.Base` — `BaseViewModel` - `DTS.Common.Events` — `RaiseNotification` event, `NotificationContentEventArgs` - `DTS.Common.Interface` — `IViewModel`, `IDockPanelVerticalViewModel`, `IDockPanelVerticalView` - `Microsoft.Practices.Prism.Events` — `IEventAggregator` - `Microsoft.Practices.Prism.Interactivity.InteractionRequest` — `InteractionRequest`, `Notification`, `Confirmation` - `Microsoft.Practices.Prism.Regions` — `IRegionManager` - `Microsoft.Practices.Unity` — `IUnityContainer` ### What depends on this module: - **Unclear from source alone** — No consumers are visible in this file. Likely consumed by View implementations and/or DI container registrations. --- ## 5. Gotchas 1. **Incomplete Implementation**: All lifecycle methods (`Initialize`, `InitializeAsync`, `Activated`, `Cleanup`, `CleanupAsync`) throw `NotImplementedException`. This class appears to be a stub or work-in-progress. 2. **Member Hiding**: - The `_regionManager` field uses `new`, hiding a base class member of the same name. - `CleanupAsync()` and `Initialize(object parameter, object model)` also use `new`, hiding base implementations rather than overriding them. 3. **Unused `PropertyChanged` Event**: The event is declared but never raised. If property change notification is expected by consumers, it will not function. 4. **Unused `ConfirmationRequest`**: The `ConfirmationRequest` property is instantiated but never raised anywhere in this class. 5. **Unused State Properties**: `IsMenuIncluded`, `IsNavigationIncluded`, `IsBusy`, and `IsDirty` are declared but never read or written within this class (other than being auto-initialized). 6. **Potential Memory Leak**: The `RaiseNotification` event subscription does not appear to be unsubscribed in cleanup (though cleanup throws anyway). If the EventAggregator uses weak references, this may be safe; otherwise, it could cause memory retention issues.