--- source_files: - Common/DTS.CommonCore/Interface/DTS.Viewer/ViewerSettings/IViewerSettingsView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/ViewerSettings/IViewerSettingsViewModel.cs generated_at: "2026-04-16T02:32:41.267985+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "aacb0b18894c95e6" --- # ViewerSettings ## Documentation: Viewer Settings Module Interfaces ### 1. Purpose This module defines the contract interfaces for the viewer settings UI layer, implementing the Model-View-ViewModel (MVVM) pattern. It provides a standardized abstraction between the view (UI) and view model (logic/data) for configuring viewer-specific settings—specifically calibration behavior and visibility of settings sections. The interfaces `IViewerSettingsView` and `IViewerSettingsViewModel` enable decoupled development and testing of the viewer settings UI, ensuring separation of concerns while integrating into the broader `DTS.Common` framework. ### 2. Public Interface #### `IViewerSettingsView` - **Inherits**: `IBaseView` - **Description**: A marker interface representing the view (e.g., a WPF `UserControl`) responsible for rendering viewer settings. It carries no additional members beyond those defined in `IBaseView`, implying it relies on base view conventions (e.g., binding context, lifecycle hooks) defined elsewhere. #### `IViewerSettingsViewModel` - **Inherits**: `IBaseViewModel` - **Properties**: - `IViewerSettingsView View { get; set; }` Gets or sets the associated view instance. Enables two-way binding and view-model-to-view coordination. - `IBaseViewModel Parent { get; set; }` Gets or sets the parent view model, supporting hierarchical view model composition (e.g., for navigation or context propagation). - `Visibility CalibrationBehaviorSettingVisibility { get; set; }` Controls the visibility of the calibration behavior setting UI element (e.g., a dropdown or group box). Read-write, allowing runtime toggling. - `Visibility OverallSettingsVisibility { get; }` Read-only visibility flag for the entire settings section (e.g., to hide/show the whole panel). Likely derived from application state or permissions. - `DisplayedCalibrationBehavior[] AvailableCalibrationBehaviors { get; }` Returns an array of available calibration behavior options, represented as `DisplayedCalibrationBehavior` objects (defined in `DTS.Common.Classes.Sensors`). Used to populate a selection UI. - **Methods**: - `void PublishChanges()` Commits or broadcasts any pending changes made in the settings UI (e.g., to a sensor configuration service or settings store). Behavior is implementation-defined but implies persistence or notification. ### 3. Invariants - `View` must be assigned to an instance implementing `IViewerSettingsView` before the view model is used (enforced by MVVM framework conventions, though not explicitly validated in the interface). - `CalibrationBehaviorSetting` must be one of the values in `AvailableCalibrationBehaviors` at all times; invalid assignments are expected to be rejected by the implementation (not enforced by interface). - `OverallSettingsVisibility` is read-only and must remain consistent with higher-level application state (e.g., user role, active sensor type). - `AvailableCalibrationBehaviors` must be non-null and immutable once set; modifications require reassignment. ### 4. Dependencies - **Depends on**: - `DTS.Common.Base` (provides `IBaseView`, `IBaseViewModel`) - `System.Windows` (for `Visibility` type) - `DTS.Common.Classes.Sensors` (for `DisplayedCalibrationBehavior` type) - **Depended on by**: - Likely consumed by a WPF UI project (via `IViewerSettingsView`) and a core logic/service layer (via `IViewerSettingsViewModel`). - Implementation classes (e.g., `ViewerSettingsViewModel`, `ViewerSettingsView`) would depend on this interface for decoupled instantiation and testing. ### 5. Gotchas - `DisplayedCalibrationBehavior` is referenced but not defined in this source; its structure (e.g., properties like `Name`, `Value`) is unknown here and must be verified in `DTS.Common.Classes.Sensors`. - `PublishChanges()` has no documented error handling or rollback semantics—implementation may throw or silently fail. - `OverallSettingsVisibility` is read-only; callers cannot directly control it, which may limit flexibility if dynamic reconfiguration is needed. - No validation or null-safety guarantees are specified for `View` or `Parent`; implementations must handle null references. - None identified from source alone.