Files
2026-04-17 14:55:32 -04:00

360 lines
13 KiB
Markdown

---
source_files:
- Common/DTS.CommonCore/Interface/ITabView.cs
- Common/DTS.CommonCore/Interface/IMainView.cs
- Common/DTS.CommonCore/Interface/IMenuView.cs
- Common/DTS.CommonCore/Interface/IShellView.cs
- Common/DTS.CommonCore/Interface/INavigationView.cs
- Common/DTS.CommonCore/Interface/IViewerShellView.cs
- Common/DTS.CommonCore/Interface/ITabViewModel.cs
- Common/DTS.CommonCore/Interface/IMenuViewModel.cs
- Common/DTS.CommonCore/Interface/INavigationViewModel.cs
- Common/DTS.CommonCore/Interface/IPluginComponent.cs
- Common/DTS.CommonCore/Interface/IShellViewModel.cs
- Common/DTS.CommonCore/Interface/IViewerShellViewModel.cs
- Common/DTS.CommonCore/Interface/IMainViewModel.cs
- Common/DTS.CommonCore/Interface/IAssemblyInfo.cs
- Common/DTS.CommonCore/Interface/IDataPROPage.cs
generated_at: "2026-04-16T11:57:51.242968+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "c067eaab6be3056e"
---
# Documentation: DTS.Common.Interface Namespace
## 1. Purpose
This module defines the core abstraction layer for the DTS application's WPF-based UI framework, establishing the view and view-model contracts that implement the Model-View-ViewModel (MVVM) pattern. It provides interfaces for shell containers, navigation components, tab views, menu systems, plugin integration, and DataPRO page definitions. These interfaces enable loose coupling between UI components and their consumers, supporting a modular, plugin-friendly architecture.
---
## 2. Public Interface
### View Interfaces
#### `ITabView`
```csharp
public interface ITabView : IBaseView { }
```
Marker interface for tab view components. Inherits from `IBaseView`.
#### `IMainView`
```csharp
public interface IMainView : IBaseView { }
```
Marker interface for main view components. Inherits from `IBaseView`.
#### `IMenuView`
```csharp
public interface IMenuView : IBaseView { }
```
Marker interface for menu view components. Inherits from `IBaseView`.
#### `IShellView`
```csharp
public interface IShellView : IBaseWindow { }
```
Marker interface for shell window views. **Note:** Inherits from `IBaseWindow`, not `IBaseView`.
#### `INavigationView`
```csharp
public interface INavigationView : IBaseView { }
```
Marker interface for navigation view components. Inherits from `IBaseView`.
#### `IViewerShellView`
```csharp
public interface IViewerShellView : IBaseView { }
```
Marker interface for viewer shell view components. Inherits from `IBaseView`.
---
### ViewModel Interfaces
#### `ITabViewModel`
```csharp
public interface ITabViewModel : IBaseViewModel
{
ITabView View { get; }
}
```
Contract for tab view models. Provides access to the associated `ITabView` instance.
#### `IMenuViewModel`
```csharp
public interface IMenuViewModel : IBaseViewModel
{
IMenuView View { get; }
}
```
Contract for menu view models. Provides access to the associated `IMenuView` instance.
#### `INavigationViewModel`
```csharp
public interface INavigationViewModel : IBaseViewModel
{
INavigationView NavigationView { get; }
}
```
Contract for navigation view models. Provides access to the associated `INavigationView` instance via `NavigationView` property.
#### `IShellViewModel`
```csharp
public interface IShellViewModel : IBaseWindowModel
{
IShellView View { get; }
List<FrameworkElement> GetRegions();
object ContextMainRegion { get; set; }
}
```
Contract for shell view models. Inherits from `IBaseWindowModel`. Provides:
- `View`: The associated `IShellView` instance
- `GetRegions()`: Returns a list of `FrameworkElement` regions
- `ContextMainRegion`: Gets/sets the main region context object
#### `IViewerShellViewModel`
```csharp
public interface IViewerShellViewModel : IBaseViewModel
{
IViewerShellView View { get; }
List<FrameworkElement> GetRegions();
Object ContextMainRegion { get; set; }
}
```
Contract for viewer shell view models. Inherits from `IBaseViewModel`. Provides:
- `View`: The associated `IViewerShellView` instance
- `GetRegions()`: Returns a list of `FrameworkElement` regions
- `ContextMainRegion`: Gets/sets the main region context object
#### `IMainViewModel`
```csharp
public interface IMainViewModel : IBaseViewModel
{
IBaseView View { get; }
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; }
List<FrameworkElement> GetRegions();
}
```
Contract for main view models with multiple named regions. Provides context properties for: Navigation, Graph, Tests, Graphs, Legend, Diag, Stats, Cursor, and Property regions.
---
### Plugin Interface
#### `IPluginComponent`
```csharp
public interface IPluginComponent
{
string ProgId { get; }
}
```
Contract for plugin modules. The `ProgId` property provides a program identifier used to instantiate the plugin object.
---
### Assembly Metadata Interfaces and Attributes
#### `IAssemblyImageAttribute`
```csharp
public interface IAssemblyImageAttribute
{
string AssemblyName { get; }
BitmapImage AssemblyImage { get; }
eAssemblyRegion AssemblyRegion { get; }
Type GetType();
BitmapImage GetAssemblyImage();
string GetAssemblyName();
eAssemblyRegion GetAssemblyRegion();
}
```
#### `ImageAttribute` (Abstract)
```csharp
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public abstract class ImageAttribute : Attribute, IAssemblyImageAttribute
{
public abstract string AssemblyName { get; }
public abstract string AssemblyGroup { get; }
public abstract eAssemblyRegion AssemblyRegion { get; }
public abstract BitmapImage AssemblyImage { get; }
public abstract Type GetAttributeType();
public abstract BitmapImage GetAssemblyImage();
public abstract string GetAssemblyName();
public abstract string GetAssemblyGroup();
public abstract eAssemblyRegion GetAssemblyRegion();
}
```
Abstract attribute for assembly-level image metadata. Restricted to single instance per assembly.
#### `IAssemblyNameAttribute`
```csharp
public interface IAssemblyNameAttribute
{
String AssemblyName { get; }
Type GetType();
string GetAssemblyName();
}
```
#### `TextAttribute` (Abstract)
```csharp
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public abstract class TextAttribute : Attribute, IAssemblyNameAttribute
{
public abstract string AssemblyName { get; }
public abstract Type GetAttributeType();
public abstract string GetAssemblyName();
}
```
Abstract attribute for assembly-level name metadata. Restricted to single instance per assembly.
---
### DataPRO Page Interface
#### `IDataPROPage`
```csharp
public interface IDataPROPage : INotifyPropertyChanged
```
Comprehensive interface for DataPRO UI pages. Key members include:
**Properties:**
| Property | Type |
|----------|------|
| `TestSetupChangeButtonVisible` | `Visibility` |
| `AutomaticModeStatusVisible` | `Visibility` |
| `PageName` | `string` |
| `PageImage` | `ImageSource` |
| `IsAdd` | `bool` |
| `UsesModifyEnhancements` | `bool` |
| `EditIDString` | `string` |
| `AddIDString` | `string` |
| `ModifiedObjectName` | `string` |
| `AutomaticProgression` | `bool` |
| `RecoveryDownloadMode` | `bool` |
| `UniqueId` | `string` (read-only) |
| `TileColor` | `Color` (read-only) |
| `CurrentSearchTerm` | `string` |
| `UsesNAVControl` | `bool` |
| `UsesSearchControl` | `bool` |
| `UsesSelectControl` | `bool` |
| `HasBackButton` | `bool` |
| `HasRefreshButton` | `bool` |
| `HasCancelButton` | `bool` |
| `HasSaveButton` | `bool` |
| `HasNextButton` | `bool` |
| `ContentBackgroundColor` | `Color` |
| `MainContent` | `object` |
| `ControlInOnSetActive` | `bool` |
**Methods:**
- `string GetName()`
- `long GetID()`
- `void SetID(long id)`
- `void SetTileColor(Color c)`
- `void SavePage(object obj)`
- `void ClearSearchTerm()`
- `void SetEnabled(bool bEnable)`
- `void VerifyProgress(object o)`
- `void SaveAndExit()`
- `void RefreshButtonPressed()`
- `void SetDoneButtonIsEnabled(bool bEnabled)`
- `void SetBackButtonIsEnabled(bool bEnabled)`
- `void DoneButtonPress()`
- `void SetCancelEnabled(bool bEnabled)`
- `ContentControl GetMainContentControl()`
- `void SetReturning()`
- `bool Validate(ref List<string> errors, ref List<string> warnings, bool displayWindow)`
- `bool OKToProceed()`
- `void FormClosing(Action OnComplete = null)`
- `void OnSetActive()`
- `void UnSet()`
- `void SetCurrentItem(object o)`
- `void SetupPageAvailable()`
#### `DataProPageProperties` (Enum)
```csharp
public enum DataProPageProperties
{
UsesModifyEnhancements,
TestSetupChangeButtonVisible,
AutomaticModeStatusVisible,
PageName,
PageImage,
IsAdd,
EditIDString,
AddIDString,
ModifiedObjectName,
AutomaticProgression,
RecoveryDownloadMode,
UsesNAVControl,
UsesSearchControl,
UsesSelectControl,
HasBackButton,
HasRefreshButton,
HasCancelButton,
HasSaveButton,
HasNextButton,
ContentBackgroundColor,
MainContent,
GenerateReportsVisible
}
```
Enumeration of mutable `IDataPROPage` properties that may require external observation or reaction.
---
## 3. Invariants
- **View Hierarchy**: All view interfaces (`ITabView`, `IMainView`, `IMenuView`, `INavigationView`, `IViewerShellView`) inherit from `IBaseView`, except `IShellView` which inherits from `IBaseWindow`.
- **ViewModel Hierarchy**: All view-model interfaces inherit from `IBaseViewModel`, except `IShellViewModel` which inherits from `IBaseWindowModel`.
- **Attribute Restrictions**: `ImageAttribute` and `TextAttribute` are decorated with `[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]`, meaning they can only be applied to assemblies and only one instance of each is permitted per assembly.
- **Abstract Attributes**: Both `ImageAttribute` and `TextAttribute` are abstract classes; concrete implementations must override all abstract members.
- **IDataPROPage Identity**: `UniqueId` and `TileColor` are read-only properties; values must be set via `SetID(long)` and `SetTileColor(Color)` methods respectively.
- **IDataPROPage Validation**: The `Validate` method accepts errors and warnings by reference, suggesting callers must initialize these lists before invocation.
---
## 4. Dependencies
### External Dependencies (Inferred from imports)
- **`DTS.Common.Base`** - Provides base interfaces: `IBaseView`, `IBaseWindow`, `IBaseViewModel`, `IBaseWindowModel`
- **`System.Windows`** - For `FrameworkElement`, `Visibility`, `ContentControl`, `DependencyObject`, `UIElement`
- **`System.Windows.Media`** - For `ImageSource`, `Color`
- **`System.Windows.Media.Imaging`** - For `BitmapImage`
- **`System.ComponentModel`** - For `INotifyPropertyChanged`
- **`System.Collections.Generic`** - For `List<T>`
- **`System`** - For `Type`, `Object`, `String`, `Action`, `Attribute`
### Consumers
- Unknown from source alone. These interfaces are likely consumed by:
- Concrete view and view-model implementations
- Plugin modules implementing `IPluginComponent`
- Assembly metadata classes deriving from `ImageAttribute` or `TextAttribute`
- Page implementations conforming to `IDataPROPage`
---
## 5. Gotchas
1. **IShellView Base Interface Difference**: `IShellView` inherits from `IBaseWindow` while all other view interfaces inherit from `IBaseView`. This suggests shell views represent top-level windows rather than embedded controls.
2. **INavigationViewModel Property Naming Inconsistency**: `INavigationViewModel` exposes `NavigationView` property, while `ITabViewModel`, `IMenuViewModel`, `IViewerShellViewModel`, and `IShellViewModel` expose `View` property. This naming inconsistency may cause confusion.
3. **IDataPROPage Interface Size**: The `IDataPROPage` interface is exceptionally large (30+ members), violating the Interface Segregation Principle. Implementers must provide all members even if some are unused.
4. **Mixed Property/Method Patterns in IDataPROPage**: Some state is accessed via properties (e.g., `TileColor` is read-only property) while similar state requires methods (e.g., `SetTileColor(Color)`). The `UniqueId` property has no corresponding setter method visible, but `SetID(long)` exists for a numeric ID.
5. **eAssemblyRegion Type Undefined**: The `eAssemblyRegion` enum type is referenced in `IAssemblyImageAttribute` and `ImageAttribute` but is not defined in the provided source files. Its definition must exist elsewhere in `DTS.Common.Base` or another namespace.
6. **IDataPROPage.Validate Ref Parameters**: The `Validate` method uses `ref` parameters for error/warning lists, requiring callers to initialize collections before calling. Failure to do so would result in compiler error or runtime issues.