Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common/Interface/DTS.Viewer/ViewerSettings.md
2026-04-17 14:55:32 -04:00

5.0 KiB
Raw Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Interface/DTS.Viewer/ViewerSettings/IViewerSettingsView.cs
Common/DTS.Common/Interface/DTS.Viewer/ViewerSettings/IViewerSettingsViewModel.cs
2026-04-16T03:07:33.846375+00:00 Qwen/Qwen3-Coder-Next-FP8 1 cbdae98784eb0e4b

ViewerSettings

Documentation: Viewer Settings Module

1. Purpose

This module defines the foundational interfaces for the Viewer Settings feature, which manages user-configurable display and calibration behaviors within the DTS Viewer application. It implements the Model-View-ViewModel (MVVM) pattern to decouple UI presentation (IViewerSettingsView) from business logic and state (IViewerSettingsViewModel). The module exists to provide a standardized contract for implementing settings UI and logic related to sensor calibration behavior and overall viewer configuration visibility—enabling consistent behavior across different viewer implementations while maintaining separation of concerns.

2. Public Interface

IViewerSettingsView

  • Namespace: DTS.Common.Interface
  • Inherits: IBaseView
  • Description: A view interface representing the UI layer for viewer settings. It has no additional members beyond those inherited from IBaseView, implying it serves as a marker or placeholder interface—actual UI implementation details are not defined here.

IViewerSettingsViewModel

  • Namespace: DTS.Common.Interface
  • Inherits: IBaseViewModel
  • Members:
    • IViewerSettingsView View { get; set; }
      • Gets or sets the associated view instance (MVVM binding context).
    • IBaseViewModel Parent { get; set; }
      • Gets or sets the parent view model in the hierarchy (e.g., main settings or viewer root).
    • void PublishChanges();
      • Commits or propagates any pending configuration changes (e.g., to sensor calibration settings).
    • Visibility CalibrationBehaviorSettingVisibility { get; set; }
      • Controls the visibility of the calibration behavior setting control in the UI (read/write).
    • Visibility OverallSettingsVisibility { get; }
      • Controls the visibility of the overall settings section (read-only).
    • DisplayedCalibrationBehavior[] AvailableCalibrationBehaviors { get; }
      • Returns the list of supported calibration behavior options (e.g., Auto, Manual, Disabled).
    • DisplayedCalibrationBehavior CalibrationBehaviorSetting { get; set; }
      • Gets or sets the currently selected calibration behavior from AvailableCalibrationBehaviors.

Note

: DisplayedCalibrationBehavior is defined in DTS.Common.Classes.Sensors (imported via using), but its structure is not included in the provided source files.

3. Invariants

  • IViewerSettingsViewModel.View must be assigned to a valid instance implementing IViewerSettingsView before UI interaction occurs (enforced by MVVM binding conventions, though not explicitly validated in the interface).
  • CalibrationBehaviorSetting must be one of the values in AvailableCalibrationBehaviors at all times (assumed invariant; no validation logic is visible in the interface).
  • OverallSettingsVisibility is read-only, implying its value is computed internally (e.g., based on feature flags or runtime conditions) and not externally modifiable.
  • PublishChanges() is expected to be called explicitly to persist changes—no automatic persistence is implied by the interface.

4. Dependencies

  • Depends on:
    • DTS.Common.Base (provides IBaseView, IBaseViewModel).
    • System.Windows (for Visibility type—indicating WPF UI usage).
    • DTS.Common.Classes.Sensors (for DisplayedCalibrationBehavior type).
  • Depended on by:
    • Any concrete implementation of IViewerSettingsView/IViewerSettingsViewModel (e.g., WPF user controls and view models in the viewer project).
    • Likely consumed by higher-level view models (via Parent) or a settings management service (not visible in source).

5. Gotchas

  • Ambiguity in DisplayedCalibrationBehavior: Its definition (e.g., properties like Name, Value, or enum vs. class) is not included here—implementation details are critical for correctly populating AvailableCalibrationBehaviors and interpreting CalibrationBehaviorSetting.
  • No validation in interface: The interface does not enforce that CalibrationBehaviorSetting is in AvailableCalibrationBehaviors; implementations must handle this (e.g., via setter validation or initialization logic).
  • OverallSettingsVisibility is read-only: Developers may mistakenly attempt to set it directly—its value must be managed internally by the view model.
  • PublishChanges() semantics undefined: The interface does not specify whether changes are persisted synchronously, to disk, or to a sensor configuration service—implementation-specific behavior.
  • View property is mutable: While common in MVVM, allowing set on View may introduce risks if reassigned during the view models lifetime (e.g., during UI re-creation).