init
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common/Interface/TestSetups/Imports/TTS/EditFile/IEditFileView.cs
|
||||
- Common/DTS.Common/Interface/TestSetups/Imports/TTS/EditFile/IEditFileViewModel.cs
|
||||
generated_at: "2026-04-16T03:12:49.984508+00:00"
|
||||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1175b1a21ab11730"
|
||||
---
|
||||
|
||||
# EditFile
|
||||
|
||||
## Documentation: `IEditFileView` and `IEditFileViewModel` Interfaces
|
||||
|
||||
---
|
||||
|
||||
### 1. **Purpose**
|
||||
|
||||
This module defines the view and view model interfaces for the *Edit File* screen within the TTS (likely *Test Time Setup*) import workflow. It supports editing of TTS channel records, including validation of user input and filtering of available sensors. The interfaces follow the MVVM (Model-View-ViewModel) pattern, with `IEditFileView` representing the UI layer contract and `IEditFileViewModel` encapsulating the presentation logic and state. The module exists to decouple UI implementation from business logic, enabling testability and maintainability of the file-editing functionality.
|
||||
|
||||
---
|
||||
|
||||
### 2. **Public Interface**
|
||||
|
||||
#### `IEditFileView`
|
||||
- **Inherits**: `IBaseView`
|
||||
- **Description**: A marker interface representing the view layer for the Edit File screen. It carries no additional members beyond its base contract.
|
||||
|
||||
#### `IEditFileViewModel`
|
||||
- **Inherits**: `IBaseViewModel`
|
||||
- **Properties**:
|
||||
- `IEditFileView View { get; set; }`
|
||||
Gets or sets the associated view instance. Enables two-way binding or manual view coordination.
|
||||
- `bool ChangeValidationIsNeeded { get; set; }`
|
||||
A flag indicating whether change validation is required (e.g., on user input). Likely used to gate expensive or conditional validation logic.
|
||||
|
||||
- **Methods**:
|
||||
- `bool Validate()`
|
||||
Performs full validation of the current state (e.g., all fields on the page). Returns `true` if valid, `false` otherwise.
|
||||
- `bool ValidateChange(ITTSChannelRecord record = null)`
|
||||
Validates *changes* made on the page. If a non-null `record` is provided, ensures no `RequiredChannels` have duplicate channel codes. Designed to be called incrementally (e.g., during editing), not necessarily for full-page validation.
|
||||
- `void InitializeView()`
|
||||
Initializes UI components in the associated `View`. Typically called after view binding or construction.
|
||||
- `void Search(string text)`
|
||||
Filters the list of available sensors based on the provided `text`. Behavior implies a search/filter UI (e.g., autocomplete or list filtering).
|
||||
|
||||
---
|
||||
|
||||
### 3. **Invariants**
|
||||
|
||||
- `IEditFileViewModel` must maintain a valid reference to an `IEditFileView` instance via the `View` property when `InitializeView()` or `Search()` are invoked (though null-safety is not specified).
|
||||
- `ValidateChange` must respect the semantics described in its XML summary:
|
||||
- When `record` is `null`, validation applies only to the *current page changes*.
|
||||
- When `record` is non-null, it must additionally check for duplicate `RequiredChannels` by channel code.
|
||||
- `ChangeValidationIsNeeded` is a mutable flag; its value is expected to be set by external logic (e.g., UI event handlers) to control when validation should run.
|
||||
- `InitializeView()` is expected to be called *before* any other methods that interact with the `View` (e.g., `Search`, `Validate`)—though not strictly enforced by the interface.
|
||||
|
||||
---
|
||||
|
||||
### 4. **Dependencies**
|
||||
|
||||
- **Internal Dependencies**:
|
||||
- `DTS.Common.Base` namespace (provides `IBaseView`, `IBaseViewModel`).
|
||||
- `DTS.Common.Interface.TestSetups.Imports.TTS.ReadFile` namespace (provides `ITTSChannelRecord`, used in `ValidateChange`).
|
||||
- **External Dependencies**:
|
||||
- `ITTSChannelRecord` (from `ReadFile`) is assumed to define `RequiredChannels` and channel code properties—though its structure is not included here.
|
||||
- **Consumers**:
|
||||
- Likely consumed by concrete implementations of `IEditFileView` (e.g., a WPF or WinForms view class) and `IEditFileViewModel` (e.g., a view model class in the TTS import module).
|
||||
- May be used by dependency injection containers or MVVM frameworks to wire up view/view model pairs.
|
||||
|
||||
---
|
||||
|
||||
### 5. **Gotchas**
|
||||
|
||||
- **Ambiguity in `Validate()` vs `ValidateChange()`**: The distinction between `Validate()` (full-page validation) and `ValidateChange()` (incremental change validation) is *documented in comments* but not enforced by the interface. Implementers must ensure correct usage to avoid inconsistent validation behavior.
|
||||
- **`ITTSChannelRecord` contract is external**: The interface relies on `ITTSChannelRecord` (from `ReadFile`) and its `RequiredChannels` property. Without that type’s definition, the exact validation logic (e.g., how duplicates are detected) cannot be fully inferred.
|
||||
- **`ChangeValidationIsNeeded` semantics are unspecified**: The interface does not define *when* this flag should be `true` or how it affects validation. Its behavior is implementation-dependent.
|
||||
- **No error reporting mechanism**: Neither interface exposes error messages or validation result details (e.g., `IErrorProvider` or `ValidationResult`). Error handling is likely handled via side effects (e.g., UI binding errors) or external mechanisms.
|
||||
- **`Search` behavior is underspecified**: The interface does not define how filtering is applied (e.g., substring match, case sensitivity, or whether it updates the view directly). Implementation details may vary.
|
||||
|
||||
None identified beyond the above ambiguities.
|
||||
Reference in New Issue
Block a user