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