Files

109 lines
8.4 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/Components/IAssemblyView.cs
- Common/DTS.CommonCore/Interface/Components/IAssemblyListView.cs
- Common/DTS.CommonCore/Interface/Components/ITileView.cs
- Common/DTS.CommonCore/Interface/Components/IGroupView.cs
- Common/DTS.CommonCore/Interface/Components/ITileListView.cs
- Common/DTS.CommonCore/Interface/Components/IGroupListView.cs
- Common/DTS.CommonCore/Interface/Components/IAssemblyViewModel.cs
- Common/DTS.CommonCore/Interface/Components/IAssemblyListViewModel.cs
- Common/DTS.CommonCore/Interface/Components/ITileViewModel.cs
- Common/DTS.CommonCore/Interface/Components/IGroupViewModel.cs
- Common/DTS.CommonCore/Interface/Components/ITileListViewModel.cs
- Common/DTS.CommonCore/Interface/Components/IGroupListViewModel.cs
generated_at: "2026-04-16T02:22:29.046640+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "9dfaf004748c958d"
---
# Documentation: View and ViewModel Interfaces for Assembly/Tile/Group Hierarchies
---
## 1. Purpose
This module defines a set of interfaces that establish a consistent MVVM (Model-View-ViewModel) pattern for hierarchical UI components representing assemblies, tiles, and groups. It provides abstract contracts for *view* interfaces (`I*View`) and *view model* interfaces (`I*ViewModel`) across two distinct namespace hierarchies (`DTS.Common.Interface` and `DataPro.Common.Interface`), likely supporting different UI frameworks or product lines. The interfaces enable decoupling of UI rendering logic (views) from data presentation logic (view models), with view models exposing strongly-typed references to their associated views and managing collections of child items (e.g., `AssemblyList`, `GroupList`). The structure supports nested groupings—e.g., a list of groups, each group containing assemblies or tiles.
---
## 2. Public Interface
### View Interfaces (All inherit `IBaseView`)
| Interface | Namespace | Description |
|---------|-----------|-------------|
| `IAssemblyView` | `DTS.Common.Interface` | Marker interface for views displaying a single assembly. |
| `IAssemblyListView` | `DTS.Common.Interface` | Marker interface for views displaying a list of assembly groups. |
| `ITileView` | `DataPro.Common.Interface` | Marker interface for views displaying a single tile. |
| `IGroupView` | `DataPro.Common.Interface` | Marker interface for views displaying a single group. |
| `ITileListView` | `DataPro.Common.Interface` | Marker interface for views displaying a list of tile groups. |
| `IGroupListView` | `DataPro.Common.Interface` | Marker interface for views displaying a list of groups. |
> **Note**: All view interfaces are *empty* (no members beyond inheritance). They serve as type-safe markers to associate view models with concrete view implementations.
### ViewModel Interfaces (All inherit `IBaseViewModel`)
| Interface | Namespace | Key Members | Description |
|---------|-----------|-------------|-------------|
| `IAssemblyViewModel` | `DTS.Common.Interface` | `IAssemblyView View { get; set; }`<br>`string GroupName { get; set; }`<br>`List<AssemblyNameImage> AssemblyList { get; set; }` | Represents a single assembly groups data and behavior. Contains a list of `AssemblyNameImage` items. |
| `IAssemblyListViewModel` | `DTS.Common.Interface` | `IMainViewModel Parent { get; set; }`<br>`IAssemblyListView View { get; set; }`<br>`List<IAssemblyView> GroupList { get; set; }` | Represents a list of assembly groups. Holds references to child `IAssemblyView`s (not view models). |
| `ITileViewModel` | `DataPro.Common.Interface` | `ITileView View { get; set; }`<br>`string GroupName { get; set; }`<br>`List<AssemblyNameImage> AssemblyList { get; set; }` | Represents a single tile groups data. Structurally identical to `IAssemblyViewModel`. |
| `IGroupViewModel` | `DataPro.Common.Interface` | `IGroupView View { get; set; }`<br>`string GroupName { get; set; }`<br>`List<AssemblyNameImage> AssemblyList { get; set; }` | Represents a single groups data. Structurally identical to `IAssemblyViewModel`. |
| `ITileListViewModel` | `DataPro.Common.Interface` | `IMainViewModel Parent { get; set; }`<br>`ITileListView View { get; set; }`<br>`List<ITileView> GroupList { get; set; }` | Represents a list of tile groups. Holds references to child `ITileView`s. |
| `IGroupListViewModel` | `DataPro.Common.Interface` | `IMainViewModel Parent { get; set; }`<br>`IGroupListView View { get; set; }`<br>`List<IGroupView> GroupList { get; set; }` | Represents a list of groups. Holds references to child `IGroupView`s. |
> **Note**:
> - `AssemblyNameImage` is used in multiple view models but is not defined in this source set; its definition must be found elsewhere.
> - `IMainViewModel` is referenced as a parent but not defined here.
> - `List<T>` is used for collections (not `ObservableCollection<T>`), despite `System.Collections.ObjectModel` being imported in some files.
---
## 3. Invariants
- **View-ViewModel Pairing**: Each `I*ViewModel` interface declares a `View` property typed to its corresponding `I*View` interface (e.g., `IAssemblyViewModel``IAssemblyView`). This implies a strict 1:1 pairing between view and view model.
- **Hierarchical Consistency**:
- `IAssemblyListViewModel.GroupList` holds `IAssemblyView` instances (not `IAssemblyViewModel`), suggesting the list is view-centric.
- Conversely, `IAssemblyViewModel.AssemblyList` holds `AssemblyNameImage` objects, indicating data content.
- The same pattern holds for `Tile` and `Group` variants.
- **Namespace Separation**: Two disjoint sets of interfaces exist:
- `DTS.*` namespace for *Assembly*-centric components.
- `DataPro.*` namespace for *Tile/Group*-centric components.
This suggests parallel UI architectures for different subsystems or product lines.
- **No Validation Rules**: No explicit validation or constraint logic is present in the interfaces themselves.
---
## 4. Dependencies
### Internal Dependencies (from imports)
- `DTS.Common.Base` → Defines `IBaseView` and `IBaseViewModel` (not included here).
- `DataPro.Common.Base` → Defines `IBaseView` and `IBaseViewModel` (not included here).
- `System.Collections.Generic`, `System.Collections.ObjectModel`, `System.Reflection` → Standard .NET collections and reflection APIs.
### External Dependencies (inferred)
- **Consumers**: Any UI layer (e.g., WPF, WinForms, or custom framework) implementing MVVM must implement these interfaces to bind views and view models.
- **Dependents**: Concrete implementations of these interfaces (e.g., `AssemblyViewModel : IAssemblyViewModel`) will depend on:
- `AssemblyNameImage` type (for `AssemblyList`)
- `IMainViewModel` (for `Parent` reference)
- Concrete view classes implementing `I*View` interfaces.
---
## 5. Gotchas
- **Namespace Splitting**: The duplication of nearly identical interfaces across `DTS.Common.Interface` and `DataPro.Common.Interface` (e.g., `IAssemblyViewModel` vs. `ITileViewModel`) suggests legacy or parallel development paths. Developers must ensure correct namespace usage to avoid type conflicts or accidental mixing of subsystems.
- **View vs. ViewModel Collections**:
- `IAssemblyListViewModel.GroupList` stores `IAssemblyView` (not `IAssemblyViewModel`).
- This implies the *view layer* is responsible for managing child view instances, which is unconventional in MVVM (typically, view models manage child view models). This may indicate a design where views are composed manually or via a custom framework.
- **Missing Collection Type Consistency**:
- `ITileViewModel` and `IGroupViewModel` import `System.Collections.ObjectModel` but use `List<T>` for `AssemblyList`. If observable notifications are needed, `ObservableCollection<T>` would be expected—this mismatch may cause issues if data binding relies on change notifications.
- **No Method Signatures**: All interfaces are property-only. Behavior (e.g., initialization, command binding) must be defined in base interfaces (`IBaseViewModel`, `IBaseView`) or concrete implementations.
- **Ambiguous `GroupName` Semantics**: The `GroupName` property appears in `IAssemblyViewModel`, `ITileViewModel`, and `IGroupViewModel`, but its meaning is unclear:
- Is it the *name of the group containing the assemblies/tiles*?
- Or the *name of the assembly/tile itself*?
Context from `AssemblyList` suggests the former, but this is not explicit.
> **None identified from source alone** for other areas (e.g., thread safety, lifecycle, nullability), as these are not specified in the interfaces.