--- source_files: - Common/DTS.Common/Base/Interface/IBaseClass.cs - Common/DTS.Common/Base/Interface/IViewModel.cs - Common/DTS.Common/Base/Interface/IBaseView.cs - Common/DTS.Common/Base/Interface/IBaseWindow.cs - Common/DTS.Common/Base/Interface/IBaseModel.cs - Common/DTS.Common/Base/Interface/IBasePropertyChanged.cs - Common/DTS.Common/Base/Interface/IHeaderInfoProvider.cs - Common/DTS.Common/Base/Interface/IBaseWindowModel.cs - Common/DTS.Common/Base/Interface/IBaseViewModel.cs generated_at: "2026-04-17T16:04:27.061097+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "9843a728bff22f95" --- # Interface ### Purpose This module defines the fundamental contracts for the MVVM (Model-View-ViewModel) architecture used within the `DTS.CommonCore` library. It establishes the base interfaces for property change notification, data models, views, and view models, ensuring a consistent approach to data binding and lifecycle management across the system. ### Public Interface * **`interface IBasePropertyChanged : INotifyPropertyChanged`** * Extends `INotifyPropertyChanged` to add a manual notification method. * `void OnPropertyChanged(string propertyName)`: Raises the `PropertyChanged` event for the specified property name. * **`interface IBaseClass : IBasePropertyChanged`** * A marker interface for base classes that support property change notification. It defines no additional members. * **`interface IBaseModel : IBasePropertyChanged`** * Represents a data model with a persistent state tracking capability. * `bool IsSaved { get; }`: Gets a value indicating whether the model is saved. * **`interface IViewModel`** * Defines a basic view model wrapper around a model object. * `object Model { get; set; }`: Gets or sets the underlying data model object. * **`interface IBaseView`** * Defines a view element capable of data binding. * `object DataContext { get; set; }`: Gets or sets the data context for the view. * **`interface IBaseWindow`** * Defines a window element capable of data binding. * `object DataContext { get; set; }`: Gets or sets the data context for the window. * **`interface IHeaderInfoProvider`** * Provides a mechanism for classes to expose header information for XAML binding. * `T HeaderInfo { get; }`: Gets the header information. * **`interface IBaseViewModel : IBasePropertyChanged`** * Defines the lifecycle and state properties for a standard view model. * `bool IsMenuIncluded { get; set; }`: Gets or sets whether a menu is included. * `bool IsNavigationIncluded { get; set; }`: Gets or sets whether navigation is included. * `bool IsBusy { get; set; }`: Gets or sets the busy state. * `bool IsDirty { get; }`: Gets whether the view model has unsaved changes. * `void Activated()`: Called when the view model is activated. * `void Cleanup()`: Synchronously cleans up resources. * `Task CleanupAsync()`: Asynchronously cleans up resources. * `void Initialize()`: Initializes the view model. * `void Initialize(object parameter)`: Initializes the view model with a parameter. * `void Initialize(object parameter, object model)`: Initializes the view model with a parameter and a model. * `Task InitializeAsync()`: Asynchronously initializes the view model. * `Task InitializeAsync(object parameter)`: Asynchronously initializes the view model with a parameter. * **`interface IBaseWindowModel : INotifyPropertyChanged`** * Defines the lifecycle and state properties for a window-level model. * `bool IsMenuIncluded { get; set; }` * `bool IsNavigationIncluded { get; set; }` * `bool IsBusy { get; set; }` * `bool IsDirty { get; }` * `void Activated()` * `void Cleanup()` * `Task CleanupAsync()` * `void Initialize()` * `void Initialize(object parameter)` * `Task InitializeAsync()` * `Task InitializeAsync(object parameter)` ### Invariants * `IBaseView.DataContext` and `IBaseWindow.DataContext` must accept an object that is typically an implementation of `IBaseViewModel` or `IBaseWindowModel`. * `IBaseViewModel.Initialize` overloads suggest that initialization logic must handle cases with zero, one, or two parameters. * `IBaseWindowModel` inherits from `INotifyPropertyChanged` directly, whereas `IBaseViewModel` inherits from `IBasePropertyChanged`. ### Dependencies * **Dependencies:** `System.ComponentModel`, `System.Threading.Tasks`. * **Dep