Files
DP44/docs/ai/Common/DTS.CommonCore/Base/ViewModel.md
2026-04-17 14:55:32 -04:00

2.0 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
Common/DTS.CommonCore/Base/ViewModel/ViewModelBase.cs
Common/DTS.CommonCore/Base/ViewModel/BaseViewModel.cs
2026-04-17T15:40:45.497045+00:00 zai-org/GLM-5-FP8 1 72dbfa917d46895e

Documentation: DTS.Common.Base ViewModel Classes

1. Purpose

This module provides two abstract base classes for the Model-View-ViewModel (MVVM) pattern within the DTS application framework. ViewModelBase<T> offers a foundational implementation for ViewModels that need property change notification, error handling, and asynchronous model initialization while inheriting from WPF's DependencyObject. BaseViewModel<TModel> provides a more feature-rich base class with Prism framework integration, including command management, region navigation, event aggregation, and dependency injection support. Both classes establish a consistent contract for ViewModel lifecycle management across the codebase.


2. Public Interface

ViewModelBase<T>

Type: abstract class
Inheritance: DependencyObject, INotifyPropertyChanged, IViewModel

Properties

Name Type Access Description
Model object get/set The Model object instance. Note: typed as object despite generic parameter T.
IsBusy bool get/protected set Indicates whether an asynchronous process is currently executing.
IsDirty bool get/protected set Indicates whether the Model has been changed. Virtual.

Events

Name Type Description
ErrorOccurred EventHandler<ErrorEventArgs> Raised when an error occurs during processing. Virtual.
PropertyChanged PropertyChangedEventHandler Raised when a property value changes. Virtual.

Abstract Methods (must be implemented by derived classes)

Signature Description
protected abstract Task<T> InitializeAsync() Async initialization that returns the model object. Result is intended to set