--- source_files: - Common/DTS.CommonCore/Interface/DTS.Viewer/Legend/ILegendView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Legend/ILegendViewModel.cs generated_at: "2026-04-16T02:32:30.081859+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "fa541836d2cec79b" --- # Legend ## 1. Purpose This module defines the foundational interfaces for a legend view component within the DTS viewer subsystem. It establishes a contract for separating view and view model concerns for legend UI elements, leveraging the existing `IBaseView` and `IBaseViewModel` base abstractions. The interfaces are minimal and serve as markers or contracts to ensure consistent architectural alignment with the broader DTS framework—likely part of a larger MVVM (Model-View-ViewModel) pattern implementation for visualization components. ## 2. Public Interface - **`ILegendView`** - *Signature*: `public interface ILegendView : IBaseView` - *Behavior*: Represents the view layer for a legend component. As it inherits `IBaseView`, it is expected to conform to the base view contract (e.g., lifecycle, binding context, or UI rendering responsibilities), though the exact details of `IBaseView` are not provided here. This interface itself carries no additional members. - **`ILegendViewModel`** - *Signature*: `public interface ILegendViewModel : IBaseViewModel` - *Behavior*: Represents the view model for a legend component. It exposes a single read-only property `View` of type `ILegendView`, providing access to the associated view instance. As it inherits `IBaseViewModel`, it is expected to support standard view model responsibilities (e.g., data binding, command handling), though specifics depend on `IBaseViewModel`. ## 3. Invariants - `ILegendView` must be implemented by a concrete view class that adheres to the contract of `IBaseView`. - `ILegendViewModel` must be implemented by a concrete view model class that adheres to `IBaseViewModel` and ensures its `View` property returns a non-null instance of a type implementing `ILegendView`. - The `View` property in `ILegendViewModel` is expected to be set once (likely during initialization) and remain stable—though nullability is not explicitly constrained in the interface, its documentation ("Gets the Tab View") implies a required, non-optional association. ## 4. Dependencies - **Depends on**: - `DTS.Common.Base` namespace (specifically `IBaseView` and `IBaseViewModel`, though their definitions are external to this module). - **Depended on by**: - Concrete implementations of `ILegendView` and `ILegendViewModel` (not visible in source). - Likely consumed by higher-level viewer components (e.g., a main view or legend manager) that coordinate legend display—though no direct usage is visible in the provided files. ## 5. Gotchas - **Ambiguity in `IBaseView`/`IBaseViewModel` semantics**: The behavior and contract of the base interfaces (`IBaseView`, `IBaseViewModel`) are not defined here, so assumptions about lifecycle, threading, or binding behavior must be inferred from external context. - **No explicit initialization contract**: The `View` property in `ILegendViewModel` lacks documentation on when it must be set (e.g., constructor, setter-only, or via injection), potentially leading to runtime null reference issues if misused. - **Minimal surface area**: The interfaces are intentionally sparse—this may indicate they are placeholders for future extension or that legend-specific logic resides elsewhere (e.g., in a concrete implementation or a separate service). - **Namespace naming inconsistency**: The namespace `DTS.Common.Interface` (singular "Interface") may be a typo or legacy artifact; the project may also use `DTS.Common.Interfaces` elsewhere.