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

2.8 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Base/View/BaseWindow.cs
Common/DTS.CommonCore/Base/View/BaseView.cs
2026-04-17T16:07:35.691560+00:00 zai-org/GLM-5-FP8 1 552d84b401685097

View

Purpose

This module provides base classes for WPF view components within the DTS framework. It establishes a consistent pattern for views to expose dirty-state tracking and header information by delegating to their DataContext ViewModels. Both BaseWindow and BaseView serve as abstracted base types that bridge the gap between standard WPF controls (Window, UserControl) and the application's ViewModel contracts (IBaseWindowModel, IBaseViewModel, IHeaderInfoProvider<string>).

Public Interface

BaseWindow : Window, IBaseWindow

  • bool IsDirty { get; } — Returns true if the DataContext implements IBaseWindowModel and its IsDirty property is true. Returns false if DataContext is null or does not implement the interface.
  • string HeaderInfo { get; } — Returns the HeaderInfo from DataContext if it implements IHeaderInfoProvider<string>. Returns string.Empty if DataContext is null or does not implement the interface.

BaseView : UserControl, IBaseView

  • bool IsDirty { get; } — Returns true if the DataContext implements IBaseViewModel and its IsDirty property is true. Returns false if DataContext is null or does not implement the interface.
  • string HeaderInfo { get; } — Returns the HeaderInfo from DataContext if it implements IHeaderInfoProvider<string>. Returns string.Empty if DataContext is null or does not implement the interface.

Invariants

  • IsDirty will never throw; it safely returns false when DataContext is null or incompatible.
  • HeaderInfo will never throw; it safely returns string.Empty when DataContext is null or incompatible.
  • Both properties are read-only getters with no setters.

Dependencies

Depends on:

  • System.Windows (Window class)
  • System.Windows.Controls (UserControl class)
  • IBaseWindow, IBaseWindowModel, IBaseViewModel, IHeaderInfoProvider<string> (interfaces not shown in source; assumed defined elsewhere in DTS.CommonCore or related assemblies)

Depended on by:

  • Unclear from source alone; likely all Window and UserControl derivatives in the DTS application.

Gotchas

  • Interface mismatch between BaseWindow and BaseView: BaseWindow.IsDirty checks for IBaseWindowModel, while BaseView.IsDirty checks for IBaseViewModel. These are different interfaces. A ViewModel intended for use with both must implement both interfaces, or dirty state will report incorrectly in one context.
  • The namespace is declared as DTS.Common.Base but the file path suggests DTS.CommonCore. This may indicate a historical namespace rename or intentional divergence.