Class RecipientViewModelBase
- Namespace
- Blazing.Mvvm.ComponentModel
- Assembly
- Blazing.Mvvm.Base.dll
Provides a base class for ViewModels that implement CommunityToolkit.Mvvm.ComponentModel.ObservableRecipient, supporting message reception and access to CommunityToolkit.Mvvm.Messaging.IMessenger. Implements IViewModelBase for Blazor MVVM lifecycle integration and IDisposable for resource cleanup.
public abstract class RecipientViewModelBase : ObservableRecipient, INotifyPropertyChanging, IViewModelBase, INotifyPropertyChanged, IDisposableInheritance
Derived
Implements
Inherited Members
Constructors
RecipientViewModelBase()
Initializes a new instance of the RecipientViewModelBase class and subscribes to command property changes.
protected RecipientViewModelBase()RecipientViewModelBase(IMessenger)
Initializes a new instance of the RecipientViewModelBase class with the specified CommunityToolkit.Mvvm.Messaging.IMessenger and subscribes to command property changes.
protected RecipientViewModelBase(IMessenger messenger)Parameters
messengerIMessenger-
The messenger instance for message delivery.
Methods
CommandPropertyChanged(object?, PropertyChangedEventArgs)
Handles property changes for subscribed CommunityToolkit.Mvvm.Input.IAsyncRelayCommand instances.
protected virtual void CommandPropertyChanged(object? sender, PropertyChangedEventArgs e)Parameters
senderobject?-
The command that raised the event.
ePropertyChangedEventArgs-
The event data.
Dispose(bool)
Releases the unmanaged resources used by the RecipientViewModelBase and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
True to release both managed and unmanaged resources; false to release only unmanaged resources.
Dispose()
Disposes the ViewModel and releases resources.
public void Dispose()NotifyStateChanged()
Notifies the View that its state has changed and a UI update may be required.
public virtual void NotifyStateChanged()OnAfterRender(bool)
Invoked when the View has been rendered.
public virtual void OnAfterRender(bool firstRender)Parameters
OnAfterRenderAsync(bool)
Asynchronously invoked when the View has been rendered.
public virtual Task OnAfterRenderAsync(bool firstRender)Parameters
Returns
OnInitialized()
Invoked when the View is initialized and has received its initial parameters.
public virtual void OnInitialized()OnInitializedAsync()
Asynchronously invoked when the View is initialized and has received its initial parameters.
public virtual Task OnInitializedAsync()Returns
OnParametersSet()
Invoked when the View has received parameters from its parent and parameter values have been set.
public virtual void OnParametersSet()OnParametersSetAsync()
Asynchronously invoked when the View has received parameters from its parent and parameter values have been set.
public virtual Task OnParametersSetAsync()Returns
ShouldRender()
Determines whether the View should render.
public virtual bool ShouldRender()Returns
- bool
-
trueif theViewshould render; otherwise,false.