C# Class Catel.MVVM.ManagedViewModel

Represents a managed view model. A managed view model is watched for property changes. As soon as a change occurs in one of the managed view models, all other interested view models are notified of the changes.
显示文件 Open project: Catel/Catel Class Usage Examples

Public Methods

Method Description
AddInterestedViewModel ( IViewModel viewModel ) : void

Adds a view model to the list of interested view models for this view model type.

AddViewModelInstance ( IViewModel viewModel ) : void

Adds a view model instance to the list of instances.

ManagedViewModel ( Type viewModelType ) : System

Initializes a new instance of the ManagedViewModel class.

RemoveInterestedViewModel ( IViewModel viewModel ) : void

Removes a view model from the list of interested view models for this view model type.

RemoveViewModelInstance ( IViewModel viewModel ) : void

Removes a view model instance from the list of instances.

Private Methods

Method Description
Clear ( ) : void

Clears all the currently registered view models.

This method should only be called during unit testing.

NotifyViewModelsOfEvent ( IViewModel viewModel, ViewModelEvent viewModelEvent, EventArgs e ) : void

Notifies all interested view models of an event that took place.

OnInterestedViewModelClosedAsync ( object sender, EventArgs e ) : Task

Called when the ViewModelBase.Closed event is raised.

OnViewModelCanceledAsync ( object sender, EventArgs e ) : Task

Called when the ViewModelBase.Canceled event is raised.

OnViewModelCancelingAsync ( object sender, EventArgs e ) : Task

Called when the ViewModelBase.Canceling event is raised.

OnViewModelClosedAsync ( object sender, EventArgs e ) : Task

Called when the ViewModelBase.Canceled event is raised.

OnViewModelCommandExecutedAsync ( object sender, Catel.MVVM.CommandExecutedEventArgs e ) : Task

Called when the ViewModelBase.CommandExecuted event is raised.

OnViewModelPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Handles the PropertyChanged event of the ViewModel instances.

OnViewModelSavedAsync ( object sender, EventArgs e ) : Task

Called when the ViewModelBase.Saved event is raised.

OnViewModelSavingAsync ( object sender, EventArgs e ) : Task

Called when the ViewModelBase.Saving event is raised.

Method Details

AddInterestedViewModel() public method

Adds a view model to the list of interested view models for this view model type.
The is null.
public AddInterestedViewModel ( IViewModel viewModel ) : void
viewModel IViewModel The view model instance that is interested in changes.
return void

AddViewModelInstance() public method

Adds a view model instance to the list of instances.
The is null. The is not of the right type.
public AddViewModelInstance ( IViewModel viewModel ) : void
viewModel IViewModel The view model instance to add.
return void

ManagedViewModel() public method

Initializes a new instance of the ManagedViewModel class.
The is null.
public ManagedViewModel ( Type viewModelType ) : System
viewModelType System.Type Type of the view model.
return System

RemoveInterestedViewModel() public method

Removes a view model from the list of interested view models for this view model type.
The is null.
public RemoveInterestedViewModel ( IViewModel viewModel ) : void
viewModel IViewModel The view model instance that is interested in changes.
return void

RemoveViewModelInstance() public method

Removes a view model instance from the list of instances.
The is null.
public RemoveViewModelInstance ( IViewModel viewModel ) : void
viewModel IViewModel The view model instance to remove.
return void