Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Interface/DTS.Viewer/MainView.md
2026-04-17 14:55:32 -04:00

118 lines
7.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
source_files:
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IMainView.cs
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IViewerMainView.cs
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IExportMainView.cs
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IExportMainViewGrid.cs
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IViewerMainViewGrid.cs
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IMainViewModel.cs
- Common/DTS.Common/Interface/DTS.Viewer/MainView/IViewerMainViewModel.cs
generated_at: "2026-04-16T03:08:34.664134+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "652bfa5baf405103"
---
# MainView
## Documentation: Main View Interfaces Module
---
### **1. Purpose**
This module defines a set of interfaces that establish the contract for the main view and view model layers in the DTS Viewer application, specifically supporting distinct UI modes: general *Main*, *Viewer*, and *Export* contexts, each with optional grid-specific variants. These interfaces enforce a consistent separation of concerns between UI presentation (views) and business logic (view models), leveraging the `IBaseView` and `IBaseViewModel` base contracts. The module enables modular UI composition—particularly for regions like navigation, graphs, diagnostics, and statistics—while supporting viewer-specific functionality such as keyboard navigation, zoom control, and configuration-dependent permissions.
---
### **2. Public Interface**
All interfaces reside in the `DTS.Common.Interface` namespace and inherit from `IBaseView` or `IBaseViewModel`.
#### **View Interfaces**
- **`IMainView`**
Marker interface for the primary main view. Inherits `IBaseView`. No additional members.
- **`IViewerMainView`**
Marker interface for the viewer-specific main view. Inherits `IBaseView`. No additional members.
- **`IExportMainView`**
Marker interface for the export-specific main view. Inherits `IBaseView`. No additional members.
- **`IExportMainViewGrid`**
Marker interface for the export-specific grid view. Inherits `IBaseView`. No additional members.
- **`IViewerMainViewGrid`**
Marker interface for the viewer-specific grid view. Inherits `IBaseView`. No additional members.
#### **ViewModel Interfaces**
- **`IMainViewModel`**
Base view model for the general main view.
- `IBaseView View { get; }` — Gets the associated main view.
- `object ContextNavigationRegion { get; set; }`
- `object ContextGraphRegion { get; set; }`
- `object ContextTestsRegion { get; set; }`
- `object ContextGraphsRegion { get; set; }`
- `object ContextLegendRegion { get; set; }`
- `object ContextDiagRegion { get; set; }`
- `object ContextStatsRegion { get; set; }`
- `object ContextCursorRegion { get; set; }`
- `object ContextPropertyRegion { get; set; }`
— All represent region containers (e.g., for MVVM region injection or binding).
- `List<FrameworkElement> GetRegions();` — Returns a list of all region UI elements.
- **`IViewerMainViewModel`**
View model for the viewer-specific main view. Extends `IMainViewModel` via `IBaseViewModel` and `ISelectedDataViewModel`.
- `IBaseView View { get; set; }` — Gets or sets the associated viewer main view.
- All `Context*Region` properties from `IMainViewModel`.
- `List<FrameworkElement> GetRegions();` — Same semantics as above.
- `string ConfigPath { get; set; }` — Path to the viewer configuration file.
- `bool DoesUserHaveEditPermission { get; set; }` — Indicates whether the current user has edit permissions.
- `void ZoomReset();` — Resets zoom level to default.
- `void LeftKeyPress();` — Handles left arrow key press (e.g., step backward in time/data).
- `void RightKeyPress();` — Handles right arrow key press (e.g., step forward in time/data).
- `Common.Enums.IsoViewMode ChannelCodeViewMode { get; set; }` — Controls how channel codes are displayed (e.g., ISO view mode).
- `Common.Enums.Sensors.CalibrationBehaviors CalibrationBehaviorSetting { get; set; }` — Sets calibration behavior (e.g., auto, manual, off).
- `bool CalibrationBehaviorSettableInViewer { get; set; }` — Indicates if calibration behavior can be changed in the viewer UI.
- `Visibility SettingsVisibility { get; }` — Controls visibility of settings UI (read-only).
---
### **3. Invariants**
- All view interfaces (`IMainView`, `IViewerMainView`, etc.) are *marker interfaces*—they carry no behavioral contract beyond type identity and inheritance from `IBaseView`.
- All view model interfaces inherit from `IBaseViewModel`, implying they must implement at least the base view model contract (e.g., `IBaseViewModel` likely includes `IBaseView View { get; }` or similar).
- The `IMainViewModel` interface enforces that all region properties (`Context*Region`) must be settable and gettable, and `GetRegions()` must return a non-null list of `FrameworkElement`s.
- In `IViewerMainViewModel`, the `View` property is *read-write* (unlike `IMainViewModel` where it is read-only), allowing dynamic view assignment or swapping.
- `IViewerMainViewModel` extends `ISelectedDataViewModel`, implying it must also satisfy that interfaces contract (e.g., handling selected data state), though its members are not shown here.
- Region properties (`Context*Region`) are typed as `object`, indicating they are likely injected at runtime (e.g., via Prism regions or custom region managers), but their exact contract is not defined in this module.
---
### **4. Dependencies**
#### **Dependencies *of* this module:**
- `DTS.Common.Base` — Provides `IBaseView` and `IBaseViewModel`, and likely `ISelectedDataViewModel`.
- `System.Collections.Generic` — For `List<T>`.
- `System.Windows` — For `FrameworkElement` and `Visibility`.
#### **Dependencies *on* this module:**
- Any module implementing or consuming main views/view models (e.g., UI shell modules, region controllers, or viewer/export modules) will depend on these interfaces.
- Likely used by modules implementing:
- View composition (e.g., Prism-based region navigation).
- Viewer-specific logic (e.g., time-series playback, zoom, keyboard handling).
- Export workflows (e.g., grid export, report generation).
- `ISelectedDataViewModel` (from `DTS.Common.Base`) is required for `IViewerMainViewModel`, so any consumer must also reference that base module.
---
### **5. Gotchas**
- **Ambiguous region semantics**: All `Context*Region` properties are typed as `object`. Their expected runtime type (e.g., `RegionManager`, `FrameworkElement`, or custom container) is not documented here—implementation details are required to avoid misuse.
- **Redundant view interfaces**: The presence of `IMainView`, `IViewerMainView`, `IExportMainView`, and their grid variants suggests a design where UI behavior is differentiated *only by type*, not by shared interface members. This may indicate over-fragmentation or lack of behavioral differentiation in the interface layer.
- **Missing documentation for inherited interfaces**: `ISelectedDataViewModel` (implemented by `IViewerMainViewModel`) is referenced but not defined in this module—its contract is unknown.
- **`GetRegions()` behavior**: The method returns `List<FrameworkElement>`, but it is unclear whether this list is mutable, cached, or dynamically computed. Implementation may vary.
- **`SettingsVisibility` is read-only**: Its value is computed (likely based on permissions or config), but no setter or documentation is provided—consumers cannot programmatically toggle settings visibility.
- **No versioning or deprecation markers**: Interfaces like `IExportMainViewGrid` suggest a grid-specific export view, but no guidance is given on whether this is deprecated or superseded by other patterns.
None identified beyond the above.