Files
DP44/enriched-partialglm/Common/DTS.CommonCore/Interface/DTS.Viewer/Menu.md

81 lines
3.5 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/DTS.Viewer/Menu/IMenuView.cs
- Common/DTS.CommonCore/Interface/DTS.Viewer/Menu/IMenuViewModel.cs
generated_at: "2026-04-16T12:23:31.714436+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "f8804451d31ebe71"
---
# Documentation: DTS.Common.Interface Menu Module
## 1. Purpose
This module defines the core interfaces for the Menu component within the DTS Viewer application, following the MVVM (Model-View-ViewModel) architectural pattern. It establishes the contract between a menu view and its corresponding view model, enabling loose coupling and testability. The module serves as an abstraction layer that allows concrete implementations of menu UI components to vary independently from their presentation logic.
---
## 2. Public Interface
### `IMenuView`
**Namespace:** `DTS.Common.Interface`
**Inheritance:** `IBaseView`
An empty marker interface that defines the view contract for menu components. It inherits from `IBaseView` (defined in `DTS.Common.Base`), presumably providing common view-related functionality.
```csharp
public interface IMenuView : IBaseView { }
```
---
### `IMenuViewModel`
**Namespace:** `DTS.Common.Interface`
**Inheritance:** `IBaseViewModel`
Defines the contract for a menu view model, providing access to its associated view.
```csharp
public interface IMenuViewModel : IBaseViewModel
{
/// <summary>
/// Gets the Shell View.
/// </summary>
IMenuView View { get; }
}
```
| Member | Type | Accessor | Description |
|--------|------|----------|-------------|
| `View` | `IMenuView` | get-only | Returns the associated menu view instance |
---
## 3. Invariants
1. **Type Compatibility**: `IMenuView` instances must be assignable to `IBaseView`. `IMenuViewModel` instances must be assignable to `IBaseViewModel`.
2. **Non-null View**: The `View` property on any `IMenuViewModel` implementation should reasonably be expected to return a non-null `IMenuView` instance after initialization (inferred from typical MVVM patterns, though not explicitly enforced by the interface).
3. **Read-only View Reference**: The `View` property is get-only; implementations must not expose a public setter through this interface.
---
## 4. Dependencies
### This module depends on:
- **`DTS.Common.Base`** — Provides `IBaseView` and `IBaseViewModel` base interfaces that `IMenuView` and `IMenuViewModel` extend respectively.
### What depends on this module:
- **Unknown from source alone.** Concrete implementations of `IMenuView` and `IMenuViewModel` would exist elsewhere in the codebase, likely in presentation/UI layers.
---
## 5. Gotchas
1. **Misleading XML Documentation**: The XML comment on `IMenuViewModel.View` states "Gets the Shell View," but the return type is `IMenuView`, not a shell view interface. This appears to be a copy-paste error from another component (possibly a shell-related view model). The actual behavior returns a Menu View, not a Shell View.
2. **Marker Interface**: `IMenuView` is an empty interface with no members beyond what it inherits. Its purpose appears to be purely for type identification/categorization within the view hierarchy. The actual view behavior must come from `IBaseView`, whose members are not visible in the provided source.
3. **Tight Coupling via Property**: The `IMenuViewModel` interface exposes `IMenuView` directly as a property rather than through a more abstract mechanism. This creates a compile-time dependency on the view type, which is somewhat atypical for MVVM patterns where view models often avoid direct references to view abstractions.