54 lines
2.0 KiB
Markdown
54 lines
2.0 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DataPRO/Modules/Menu/HamburgerMenu/ViewModel/HamburgerMenuViewModel.cs
|
||
|
|
generated_at: "2026-04-17T16:00:35.473048+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "5984a297f98a5ac4"
|
||
|
|
---
|
||
|
|
|
||
|
|
# HamburgerMenuViewModel Documentation
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
`HamburgerMenuViewModel` is a Prism/Unity-based ViewModel that manages a hamburger menu's context menu construction, UI state (enabled/busy states), and event-driven communication within the application. It serves as the presentation logic layer for `IHamburgerMenuView`, handling menu item configuration, notification popups, and test lifecycle state changes via event aggregation. The class is designed as a shared singleton via MEF's `[PartCreationPolicy(CreationPolicy.Shared)]`.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### Constructor
|
||
|
|
```csharp
|
||
|
|
public HamburgerMenuViewModel(
|
||
|
|
IHamburgerMenuView view,
|
||
|
|
IRegionManager regionManager,
|
||
|
|
IEventAggregator eventAggregator,
|
||
|
|
IUnityContainer unityContainer)
|
||
|
|
```
|
||
|
|
Initializes the ViewModel, sets the View's DataContext, creates interaction requests, and subscribes to three events: `RaiseNotification`, `BusyIndicatorChangeNotification`, and `TestEvent`.
|
||
|
|
|
||
|
|
### Properties
|
||
|
|
|
||
|
|
| Property | Type | Access |
|
||
|
|
|----------|------|--------|
|
||
|
|
| `View` | `IHamburgerMenuView` | get/set |
|
||
|
|
| `NotificationRequest` | `InteractionRequest<Notification>` | get |
|
||
|
|
| `ConfirmationRequest` | `InteractionRequest<Confirmation>` | get |
|
||
|
|
| `IsEnabled` | `bool` | get; private set |
|
||
|
|
| `IsBusy` | `bool` | get; set |
|
||
|
|
| `IsDirty` | `bool` | get; private set |
|
||
|
|
| `IsMenuIncluded` | `bool` | get; set |
|
||
|
|
| `IsNavigationIncluded` | `bool` | get; set |
|
||
|
|
| `MenuItemPressed` | `MenuItemPressedDelegate` | get; set |
|
||
|
|
|
||
|
|
### Methods
|
||
|
|
|
||
|
|
```csharp
|
||
|
|
public ContextMenu GetContextMenu()
|
||
|
|
```
|
||
|
|
Returns the cached `ContextMenu`, building it lazily on first access. Thread-safe via lock on `MyLock`.
|
||
|
|
|
||
|
|
```csharp
|
||
|
|
public void SetMenuItems(string[] items)
|
||
|
|
```
|
||
|
|
Replaces the current menu items array and rebuilds the context menu. Empty or whitespace items
|