111 lines
8.4 KiB
Markdown
111 lines
8.4 KiB
Markdown
---
|
||
source_files:
|
||
- Common/DTS.Common/Interface/Viewer/IMainView.cs
|
||
- Common/DTS.Common/Interface/Viewer/IMenuView.cs
|
||
- Common/DTS.Common/Interface/Viewer/IFilterView.cs
|
||
- Common/DTS.Common/Interface/Viewer/INavigationView.cs
|
||
- Common/DTS.Common/Interface/Viewer/ITestDefinitionListView.cs
|
||
- Common/DTS.Common/Interface/Viewer/IMenuViewModel.cs
|
||
- Common/DTS.Common/Interface/Viewer/INavigationViewModel.cs
|
||
- Common/DTS.Common/Interface/Viewer/IFilterViewModel.cs
|
||
- Common/DTS.Common/Interface/Viewer/ITestDefinitionListViewModel.cs
|
||
- Common/DTS.Common/Interface/Viewer/IMainViewModel.cs
|
||
generated_at: "2026-04-16T03:02:01.201668+00:00"
|
||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||
schema_version: 1
|
||
sha256: "a20032db9e159be1"
|
||
---
|
||
|
||
# Viewer
|
||
|
||
## Documentation: Viewer Interface Module (`DTS.Common.Interface`)
|
||
|
||
---
|
||
|
||
### 1. **Purpose**
|
||
|
||
This module defines a set of interfaces that establish the contract for the *view* and *view model* layers in a modular UI architecture, specifically for a test definition and analysis application. It enforces a consistent separation of concerns between UI presentation (views) and presentation logic (view models), with each view model exposing its corresponding view and, where applicable, additional context or data regions used for composition (e.g., region navigation or data binding). These interfaces collectively support a region-based UI composition pattern (likely using Prism or similar), enabling dynamic assembly of views into predefined regions of a shell window.
|
||
|
||
---
|
||
|
||
### 2. **Public Interface**
|
||
|
||
#### Interfaces (Views)
|
||
|
||
| Interface | Inherits | Description |
|
||
|-----------|----------|-------------|
|
||
| `IMainView` | `IBaseView` | Represents the main application window or top-level view. |
|
||
| `IMenuView` | `IBaseView` | Represents the menu bar or navigation menu UI component. |
|
||
| `IFilterView` | `IBaseView` | Represents the filter/search UI component (e.g., search box, filter controls). |
|
||
| `INavigationView` | `IBaseView` | Represents the navigation pane or region (e.g., tree view, list of test suites). |
|
||
| `ITestSummaryListView` | `IBaseView` | Represents the list view displaying test summary items. *(Note: Interface name is `ITestSummaryListView`, but file is named `ITestDefinitionListView.cs`.)* |
|
||
|
||
#### Interfaces (View Models)
|
||
|
||
| Interface | Inherits | Key Members | Description |
|
||
|-----------|----------|-------------|-------------|
|
||
| `IMenuViewModel` | `IBaseViewModel` | `IMenuView View { get; }` | Provides access to the `IMenuView`. |
|
||
| `INavigationViewModel` | `IBaseViewModel` | `INavigationView NavigationView { get; }` | Provides access to the `INavigationView`. *(Note: XML doc says "Shell View", but property is `NavigationView`.)* |
|
||
| `IFilterViewModel` | `IBaseViewModel` | `IBaseView View { get; }`<br>`IBaseViewModel Parent { get; }`<br>`object ContextSearchRegion { get; set; }` | Provides access to the filter/search view, its parent view model, and a region object used for search-related context (e.g., region name or container). |
|
||
| `ITestSummaryListViewModel` | `IBaseViewModel` | `ITestSummaryListView TestSummaryListView { get; }`<br>`ObservableCollection<ITestSummary> TestSummaryList { get; set; }`<br>`List<ITestSummary> SelectedTestSummaryList { get; set; }`<br>`void PublishSelectedTestSummaryList()` | Manages the list of test summaries, selected items, and exposes a method to publish the selected list (likely for event publication or binding). *(Note: Interface name is `ITestSummaryListViewModel`, but file is named `ITestDefinitionListViewModel.cs`.)* |
|
||
| `IMainViewModel` | `IBaseViewModel` | `IBaseView View { get; }`<br>`object ContextNavigationRegion { get; set; }`<br>`object ContextGraphRegion { get; set; }`<br>`object ContextTestsRegion { get; set; }`<br>`object ContextGraphsRegion { get; set; }`<br>`object ContextLegendRegion { get; set; }`<br>`object ContextDiagRegion { get; set; }`<br>`object ContextStatsRegion { get; set; }`<br>`object ContextCursorRegion { get; set; }`<br>`object ContextPropertyRegion { get; set; }`<br>`List<FrameworkElement> GetRegions()` | Core view model for the main window. Exposes multiple region context objects (likely used for region registration/naming in a region manager) and a method to retrieve the actual `FrameworkElement` instances corresponding to those regions. |
|
||
|
||
> **Note on naming inconsistencies**: Several interface names differ from their corresponding file names (e.g., `ITestSummaryListView` in `ITestDefinitionListView.cs`). This is preserved as-is per the source.
|
||
|
||
---
|
||
|
||
### 3. **Invariants**
|
||
|
||
- All view interfaces (`IMainView`, `IMenuView`, etc.) inherit from `IBaseView`, implying a common base contract for all views (e.g., `IView` marker or base interface).
|
||
- All view model interfaces inherit from `IBaseViewModel`, implying a common base contract for all view models.
|
||
- Every view model interface exposes a `View`-typed property (either `View`, `NavigationView`, `TestSummaryListView`, etc.) that returns the *concrete* view instance it is bound to.
|
||
- `IFilterViewModel` and `IMainViewModel` expose `object`-typed properties for region contexts (e.g., `ContextSearchRegion`, `ContextNavigationRegion`, etc.). These are likely used to store region names, region manager references, or region containers — but the actual type is not constrained by the interface.
|
||
- `IMainViewModel.GetRegions()` returns a `List<FrameworkElement>`, presumably the *actual UI elements* corresponding to the named regions (e.g., for programmatic manipulation or region registration).
|
||
- `ITestSummaryListViewModel` manages two collections: `TestSummaryList` (observable, for binding) and `SelectedTestSummaryList` (plain list, likely for bulk operations or publishing). The `PublishSelectedTestSummaryList()` method likely triggers an event or message.
|
||
|
||
---
|
||
|
||
### 4. **Dependencies**
|
||
|
||
#### Dependencies *of* this module:
|
||
- `DTS.Common.Base` — All interfaces depend on `IBaseView` and `IBaseViewModel` from this namespace.
|
||
- `System.Collections.Generic`, `System.Collections.ObjectModel` — Used in `ITestSummaryListViewModel`.
|
||
- `System.Windows` — Used in `IMainViewModel` for `FrameworkElement`.
|
||
|
||
#### Dependencies *on* this module:
|
||
- Any module implementing or consuming views/view models (e.g., UI shell, region controllers, test definition logic).
|
||
- Likely consumed by:
|
||
- A Prism-based shell application (for region management).
|
||
- View model factories or dependency injection containers.
|
||
- Test definition or analysis modules (e.g., via `ITestSummary` references).
|
||
|
||
#### Notable:
|
||
- `ITestSummaryListViewModel` references `ITestSummary` (from `DTS.Common.Interface.TestDefinition`), indicating a dependency on the `TestDefinition` sub-namespace.
|
||
|
||
---
|
||
|
||
### 5. **Gotchas**
|
||
|
||
- **Naming mismatch between files and interfaces**:
|
||
- `ITestDefinitionListView.cs` defines `ITestSummaryListView`.
|
||
- `ITestDefinitionListViewModel.cs` defines `ITestSummaryListViewModel`.
|
||
This may cause confusion during code navigation or refactoring.
|
||
|
||
- **Ambiguous region context types**:
|
||
Region context properties (e.g., `ContextNavigationRegion`, `ContextSearchRegion`) are typed as `object`. Their *intended* runtime type (e.g., `string`, `RegionManager`, `FrameworkElement`, or custom region metadata) is not specified in this module. Consumers must infer or document externally.
|
||
|
||
- **Inconsistent XML documentation**:
|
||
- `INavigationViewModel.NavigationView` is documented as "Gets the Shell View", but the property is named `NavigationView`.
|
||
- `IFilterViewModel.View` is documented as "Gets the Search View", but the property is named `View` (generic).
|
||
This may mislead developers during debugging or onboarding.
|
||
|
||
- **No explicit contract for region registration**:
|
||
While `IMainViewModel.GetRegions()` returns `FrameworkElement`s, there is no indication of *how* these are registered with a region manager (e.g., Prism’s `RegionManager.SetRegionName()`). This logic is likely implemented elsewhere.
|
||
|
||
- **Missing `using` for `System.Collections.Generic` in some files**:
|
||
`INavigationView.cs` and `IFilterView.cs` do not explicitly import `System.Collections.Generic`, but this is likely handled by `IBaseView` or global usings — not a functional issue, but worth noting for maintainability.
|
||
|
||
- **No methods defined on view interfaces**:
|
||
All view interfaces are empty markers (aside from inheritance), implying view logic is entirely in view models — consistent with MVVM, but may require external documentation for view-specific behaviors (e.g., event handlers, attached behaviors).
|
||
|
||
None identified beyond the above. |