--- source_files: - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateListView.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateExportView.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateImportView.cs - Common/DTS.CommonCore/Interface/GroupTemplate/ITemplateChannelListView.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateInfoControlView.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateViewModel.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateInfoControlViewModel.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplate.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateListViewModel.cs - Common/DTS.CommonCore/Interface/GroupTemplate/ITemplateChannelListViewModel.cs - Common/DTS.CommonCore/Interface/GroupTemplate/IGroupTemplateChannel.cs - Common/DTS.CommonCore/Interface/GroupTemplate/ITestObjectTemplate.cs generated_at: "2026-04-16T02:22:23.083455+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "7ad50e5b491c81bf" --- # GroupTemplate ## Documentation: Group Template Interface Module ### 1. Purpose This module defines the core interfaces for the *Group Template* subsystem, which manages reusable template definitions for grouping test channels and associated metadata in the DTS (Device Test System) platform. It provides a layered architecture separating *data models* (`IGroupTemplate`, `ITestObjectTemplate`, `IGroupTemplateChannel`), *view models* (`IGroupTemplateViewModel`, `IGroupTemplateListViewModel`, `ITemplateChannelListViewModel`, `IGroupTemplateInfoControlViewModel`), and *view contracts* (`IGroupTemplateListView`, `IGroupTemplateExportView`, `IGroupTemplateImportView`, `ITemplateChannelListView`, `IGroupTemplateInfoControlView`). These interfaces enable separation of concerns for UI presentation, data binding, and business logic related to template creation, listing, import/export, and channel configuration. --- ### 2. Public Interface #### Data Model Interfaces - **`IGroupTemplate`** Represents a group template with basic properties: `Disabled`, `Name`, `Description`, `Channels`, `AssociatedGroups`, `LastModifiedBy`, `LastModified`, `SerialNumber`. Includes `Filter(string term)` for client-side filtering. - **`IGroupTemplateChannel`** Represents a channel within a group template. Properties: `Custom` (read-only), `DisplayOrder`, `NameOfTheChannel`, `Name` (read-only), `Required`, `ISOCode`. Includes `Filter(string term)`. - **`GroupTemplateChannelComparer`** Implements `IComparer` for sorting. Uses `SortField` (of type `GroupTemplateChannelFields`) and `Ascending` flag. Supports sorting by `Required`, `Name`, `ISOCode`, `Custom`, and `DisplayOrder`. Throws `ArgumentOutOfRangeException` for unsupported sort fields. - **`ITestObjectTemplate`** Represents a test object template (possibly embedded). Properties include `TemplateName`, `TemplateNameOrOriginalTemplateName`, `Icon`, `Description`, `LocalOnly`, `Version`, `LastModifiedBy`, `LastModified`, `CRC32`, `TestObject`, `TestObjectType`, `TemplateParent`, `SysBuilt`, `OriginalTemplateName`, `Embedded`. Includes `IsISOMode()` method. #### View Model Interfaces - **`IGroupTemplateViewModel`** Main view model for group template operations. Properties: `ImportView` (`IGroupTemplateImportView`), `ExportView` (`IGroupTemplateExportView`). Includes `Unset()` method (likely for cleanup/disposal). - **`IGroupTemplateListViewModel`** Manages the list view of group templates. Properties: `View` (`IGroupTemplateListView`), `Templates` (array of `IGroupTemplate`). Methods: `GetAllTemplates(bool bIncludeEmbedded, bool bISOMode)`, `Unset()`, `Sort(object o, bool columnClick)`, `Filter(string term)`, `MouseDoubleClick(int index)`. Implements `IFilterableListView` (inherited from `IBaseViewModel` + `IFilterableListView`). - **`ITemplateChannelListViewModel`** Manages the channel list for a group template. Properties: `View` (`ITemplateChannelListView`). Methods: `Unset()`, `Sort(object o, bool columnClick)`, `Filter(string term)`, `SetAllChannels(IGroupTemplateChannel[] channels)`, `GetAllChannels()`, `MoveDown(IGroupTemplateChannel channel)`, `MoveUp(IGroupTemplateChannel channel)`, `SetParent(object o)`. - **`IGroupTemplateInfoControlViewModel`** Manages the info/control view for a selected group template. Properties: `View` (`IGroupTemplateInfoView`), `SelectedGroupTemplate` (`IGroupTemplate`). *Note: `IGroupTemplateInfoView` is referenced but not defined in this module; its definition is assumed to be in the `DataPro.Common.Interface` namespace.* #### View Interface Contracts - **`IGroupTemplateListView`** Marker interface for the group template list view (extends `IBaseView`). - **`IGroupTemplateExportView`** Marker interface for the group template export view (extends `IBaseView`). - **`IGroupTemplateImportView`** Marker interface for the group template import view (extends `IBaseView`). - **`ITemplateChannelListView`** Marker interface for the template channel list view (extends `IBaseView`). - **`IGroupTemplateInfoControlView`** Marker interface for the group template info/control view (extends `IBaseView`). *Note: This interface is defined in the `DataPro.Common.Interface` namespace, not `DTS.Common.Interface.GroupTemplate`.* --- ### 3. Invariants - All view interfaces (`IGroupTemplateListView`, `IGroupTemplateExportView`, etc.) are *marker interfaces* extending `IBaseView`; they convey no additional contract beyond type identity. - View models (`IGroupTemplateViewModel`, `IGroupTemplateListViewModel`, etc.) must maintain a valid reference to their corresponding view (via the `View` property) during active use. - `IGroupTemplateListViewModel.Templates` is expected to be an array of `IGroupTemplate` instances populated by `GetAllTemplates(...)`. - `ITemplateChannelListViewModel` expects `SetAllChannels(...)` to be called before `GetAllChannels()`, `MoveUp/Down`, or `Sort` operations to ensure channel data is initialized. - `IGroupTemplateChannel.Name` is read-only and likely derived from `NameOfTheChannel` or other internal state. - `ITestObjectTemplate.Embedded` and `ITestObjectTemplate.TemplateName` are related: embedded templates use a GUID as `TemplateName`, while `OriginalTemplateName` stores the human-readable name. - `IGroupTemplate.Filter(string term)` and `IGroupTemplateChannel.Filter(string term)` must implement case-insensitive or substring matching (exact behavior not specified in source). - `IGroupTemplateInfoControlViewModel` requires `IGroupTemplateInfoView` to be defined elsewhere (in `DataPro.Common.Interface`). --- ### 4. Dependencies - **Internal Dependencies** - All interfaces depend on `DTS.Common.Base.IBaseView` and `DTS.Common.Base.IBaseViewModel`. - `IGroupTemplateListViewModel` depends on `DTS.Common.Interface.Pagination.IFilterableListView`. - `IGroupTemplateChannel` depends on `DTS.Common.Enums.GroupTemplates.GroupTemplateChannelFields` (enum for sort fields). - `IGroupTemplateInfoControlViewModel` depends on `DataPro.Common.Interface.IGroupTemplateInfoView` (not provided in this module). - **External Dependencies** - `DataPro.Common.Base` namespace (used in `IGroupTemplateInfoControlView` and `IGroupTemplateInfoControlViewModel`). - `System`, `System.Collections.Generic`, `System.Linq` (implied via `IComparer`, `String.Compare`, etc.). - **Dependents** - UI layers (e.g., WPF/WinForms views) likely implement the view interfaces. - View model implementations (e.g., `GroupTemplateListViewModelImpl`) depend on these interfaces for DI and testability. - Import/export logic likely consumes `IGroupTemplateImportView`/`IGroupTemplateExportView`. - Channel ordering UI likely consumes `ITemplateChannelListViewModel`. --- ### 5. Gotchas - **Namespace Inconsistency**: `IGroupTemplateInfoControlView` and `IGroupTemplateInfoControlViewModel` reside in `DataPro.Common.Interface`, not `DTS.Common.Interface.GroupTemplate`, despite being grouped here. This may cause confusion during navigation or refactoring. - **Missing `IGroupTemplateInfoView`**: Referenced in `IGroupTemplateInfoControlViewModel`, but not defined in this module. Its contract is unknown. - **`IGroupTemplateChannel.Name` vs `NameOfTheChannel`**: `Name` is read-only, while `NameOfTheChannel` is read-write. The relationship between them is not documented (e.g., is `Name` a normalized version?). - **`CRC32` and `Version` fields**: Comments indicate these are *“not currently used”* or *“unsure if this is still used”*, suggesting potential dead code or legacy artifacts. - **`TemplateParent` and `SysBuilt`**: Comments indicate uncertainty about usage; behavior may be undefined or deprecated. - **`IFilterableListView`**: Inherited by `IGroupTemplateListViewModel`, but its contract (e.g., `FilterTerm` property, `OnFilterChanged` event) is not visible here. - **`Unset()` method**: Used across multiple view models; likely for cleanup, but semantics (e.g., nulling `View`, releasing resources) are not specified. - **`MouseDoubleClick(int index)`**: Signature implies index-based selection, but no context (e.g., which item, event args) is provided—potential source of off-by-one or stale-index bugs. - **No generic constraints**: View models accept `object` for `Sort(object o, bool columnClick)` and `SetParent(object o)`, risking runtime type errors if callers pass unexpected types.