--- source_files: - Common/DTS.CommonCore/Interface/DTS.Viewer/ViewerSettings/IViewerSettingsView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/ViewerSettings/IViewerSettingsViewModel.cs generated_at: "2026-04-16T12:22:53.517734+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "aacb0b18894c95e6" --- # Documentation: IViewerSettingsView & IViewerSettingsViewModel ## 1. Purpose This module defines the contract for a Viewer Settings UI component following the MVVM (Model-View-ViewModel) pattern. `IViewerSettingsView` represents the view abstraction, while `IViewerSettingsViewModel` defines the presentation logic and state for configuring viewer-related settings, specifically calibration behavior options. These interfaces enable decoupled communication between the UI layer and business logic, allowing for testability and separation of concerns within the DTS viewer settings subsystem. --- ## 2. Public Interface ### IViewerSettingsView **Namespace:** `DTS.Common.Interface` ```csharp public interface IViewerSettingsView : IBaseView { } ``` A marker interface extending `IBaseView` with no additional members. Serves as a type contract for viewer settings views. --- ### IViewerSettingsViewModel **Namespace:** `DTS.Common.Interface` ```csharp public interface IViewerSettingsViewModel : IBaseViewModel ``` | Member | Type | Access | Description | |--------|------|--------|-------------| | `View` | `IViewerSettingsView` | get/set | Reference to the associated view instance. | | `Parent` | `IBaseViewModel` | get/set | Reference to the parent view model in the hierarchy. | | `PublishChanges()` | `void` | method | Publishes/commits current settings changes. Implementation behavior not specified in source. | | `CalibrationBehaviorSettingVisibility` | `Visibility` | get/set | Controls visibility of the calibration behavior setting UI element. | | `OverallSettingsVisibility` | `Visibility` | get | Read-only visibility state for overall settings panel. | | `AvailableCalibrationBehaviors` | `DisplayedCalibrationBehavior[]` | get | Array of available calibration behavior options for selection. | | `CalibrationBehaviorSetting` | `DisplayedCalibrationBehavior` | get/set | Currently selected calibration behavior setting. | --- ## 3. Invariants - `IViewerSettingsView` must always be assignable to `IBaseView` (inheritance constraint). - `IViewerSettingsViewModel` must always be assignable to `IBaseViewModel` (inheritance constraint). - `AvailableCalibrationBehaviors` is read-only; consumers cannot replace the array reference, though the source does not specify whether the array contents are mutable. - `OverallSettingsVisibility` is read-only; its value is determined internally by the implementing class. **Unclear from source:** - Whether `View` and `Parent` must be non-null at any point in the lifecycle. - Whether `PublishChanges()` validates state before publishing or throws on invalid state. - The relationship between `CalibrationBehaviorSettingVisibility` and `OverallSettingsVisibility`. --- ## 4. Dependencies ### This module depends on: - `DTS.Common.Base` — for `IBaseView` and `IBaseViewModel` base interfaces - `DTS.Common.Classes.Sensors` — for `DisplayedCalibrationBehavior` type - `System.Windows` — for `Visibility` enumeration (WPF-specific) ### What depends on this module: **Cannot be determined from source alone.** No consumers are shown in the provided files. --- ## 5. Gotchas - **WPF Coupling:** The use of `System.Windows.Visibility` ties this interface to WPF. Porting to other UI frameworks would require abstraction changes. - **Mutable Array Exposure:** `AvailableCalibrationBehaviors` returns an array (`DisplayedCalibrationBehavior[]`), not an immutable collection. If the implementing class does not defensively copy, callers could potentially modify array contents. - **Setter on View Property:** The `View` property has a public setter, which may indicate the view can be swapped at runtime. Thread-safety implications are unclear from source. - **PublishChanges Semantics:** The method name suggests a publish/subscribe or event-sourcing pattern, but the actual behavior (synchronous vs. asynchronous, error handling, side effects) is not specified in the interface.