Files
2026-04-17 14:55:32 -04:00

7.3 KiB
Raw Permalink Blame History

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.Common/Interface/ExportData/MainView/IExportMainViewModel.cs
2026-04-16T03:11:46.526520+00:00 Qwen/Qwen3-Coder-Next-FP8 1 4a813eed49138166

MainView

1. Purpose

IExportMainViewModel serves as the central view model for the main export data view in the DTS (Distributed Temperature Sensing) application. It coordinates UI state, navigation regions (e.g., for left/right panels, graphs, properties), and user interaction logic (e.g., keyboard navigation, zoom, permission-aware settings visibility). It extends IBaseViewModel and ISelectedDataViewModel, integrating core view model functionality with export-specific concerns such as test selection, file context, and calibration behavior settings. This interface defines the contract for the primary view model used during data export workflows, enabling separation of concerns between UI presentation and business logic.


2. Public Interface

  • IBaseView View { get; set; }
    Gets or sets the main view instance associated with this view model (e.g., the corresponding WPF UserControl or window).

  • bool Standalone { get; set; }
    Gets or sets a flag indicating whether the export view is running in standalone mode (i.e., not embedded in a larger application shell).

  • object ContextNavigationRegion { get; set; }
    Gets or sets the region object used for navigation context (e.g., a region manager or container for navigation controls).

  • object ContextGraphRegion { get; set; }
    Gets or sets the region object for a single graph display area.

  • object ContextGraphsRegion { get; set; }
    Gets or sets the region object for multiple graph displays (plural), likely used for comparative or multi-channel views.

  • object ContextPropertyRegion { get; set; }
    Gets or sets the region object for property inspection UI (e.g., a property grid).

  • List<FrameworkElement> GetRegions()
    Returns a list of FrameworkElement instances representing all registered UI regions (navigation, graph, property, etc.), likely used for region binding or layout management.

  • string ConfigPath { get; set; }
    Gets or sets the file path to the configuration file used by this view model.

  • bool DoesUserHaveEditPermission { get; set; }
    Gets or sets whether the current user has permission to modify settings or data in this view.

  • void ZoomReset()
    Resets zoom level(s) in the associated graph(s) to default (e.g., 100% or full-scale view).

  • void LeftKeyPress()
    Informs the view model that the left arrow key was pressed—likely triggers navigation to the previous data point/time step or channel.

  • void RightKeyPress()
    Informs the view model that the right arrow key was pressed—likely triggers navigation to the next data point/time step or channel.

  • Common.Enums.IsoViewMode ChannelCodeViewMode { get; set; }
    Gets or sets the current view mode for channel code display (e.g., numeric, symbolic, or encoded format), from the IsoViewMode enum.

  • Common.Enums.Sensors.CalibrationBehaviors CalibrationBehaviorSetting { get; set; }
    Gets or sets the current calibration behavior setting (e.g., auto, manual, disabled), from the CalibrationBehaviors enum.

  • bool CalibrationBehaviorSettableInViewer { get; set; }
    Gets or sets whether the user can modify the CalibrationBehaviorSetting directly in the viewer UI.

  • Visibility SettingsVisibility { get; }
    Gets the visibility state (Visible, Collapsed, or Hidden) of the settings panel, likely computed based on DoesUserHaveEditPermission and CalibrationBehaviorSettableInViewer.

  • string SelectedTest { get; set; }
    Gets or sets the identifier (e.g., test name or ID) of the currently selected test.

  • string SelectedDTSFile { get; set; }
    Gets or sets the full path or identifier of the currently selected DTS data file.

  • void AddSelectedEvents(string groupName, List<ITestEvent> events)
    Adds a list of test events (ITestEvent) to a named group (e.g., for batch processing or export filtering). groupName likely corresponds to a logical grouping such as "Anomalies" or "UserSelected".

  • List<string> AvailableTestIds { get; set; }
    Gets or sets the list of test identifiers available for selection in the current context.


3. Invariants

  • View must be assigned before the view model is activated or bound to a view; otherwise, region binding may fail.
  • Standalone must be set prior to initialization to ensure correct region and navigation setup.
  • DoesUserHaveEditPermission and CalibrationBehaviorSettableInViewer jointly determine SettingsVisibility: if either is false, settings UI should be hidden (Collapsed or Hidden).
  • SelectedTest and SelectedDTSFile must be non-null/non-empty when data-dependent operations (e.g., AddSelectedEvents) are invoked.
  • GetRegions() must return a list containing at least the four region objects (ContextNavigationRegion, ContextGraphRegion, ContextGraphsRegion, ContextPropertyRegion) in a consistent order (though exact ordering is not specified).
  • ChannelCodeViewMode and CalibrationBehaviorSetting must be valid enum values from their respective types (IsoViewMode, CalibrationBehaviors).

4. Dependencies

  • Implements: IBaseViewModel, ISelectedDataViewModel (from DTS.Common.Base and likely shared interfaces).
  • Uses:
    • System.Collections.Generic.List<T>
    • System.Windows.FrameworkElement, System.Windows.Visibility
    • DTS.Common.Interface namespace (for IBaseView, ITestEvent)
    • DTS.Common.Enums namespace (for IsoViewMode, CalibrationBehaviors)
  • Likely consumed by:
    • A WPF view (e.g., ExportMainView) implementing IBaseView.
    • A region manager or navigation service (e.g., Prism or custom) that consumes GetRegions() and region properties.
    • Export logic modules that rely on SelectedTest, SelectedDTSFile, and AddSelectedEvents.

5. Gotchas

  • Ambiguous region semantics: The distinction between ContextGraphRegion (singular) and ContextGraphsRegion (plural) is not clarified—consumers must infer usage (e.g., one for single-channel, one for multi-channel views).
  • SettingsVisibility is read-only: Its value is computed internally (likely in the implementing class), so external code cannot directly set it—only DoesUserHaveEditPermission and CalibrationBehaviorSettableInViewer influence it.
  • AddSelectedEvents behavior: The groupName parameters allowed values and semantics (e.g., whether it supports overwriting or appending) are not documented.
  • No event notifications: The interface does not expose change notifications (e.g., INotifyPropertyChanged is inherited from IBaseViewModel, but specific property change behavior is not detailed here).
  • No null-safety guarantees: Properties like SelectedTest, SelectedDTSFile, and AvailableTestIds are mutable and may be set to null or empty lists—consumers must validate before use.
  • LeftKeyPress/RightKeyPress semantics: The exact effect (e.g., time-step vs. channel navigation) is implementation-dependent and not specified.

None identified beyond the above.