C# Class Catel.MVVM.ModelErrorInfo

Class containing all the errors and warnings retrieved via INotifyDataErrorInfo and INotifyDataWarningInfo.
Mostra file Open project: Catel/Catel Class Usage Examples

Public Methods

Method Description
CleanUp ( ) : void

Cleans up the information by unsubscribing from all events.

ClearDefaultErrors ( string propertyName ) : void

Updates the default errors. This method is required when errors are initialize via InitializeDefaultErrors. This method checks whether default errors were added for a specific property (or at entity level if propertyName is string.Empty or null). Reason for this is that if the error is known on forehand, the entity implementation will not raise the INotifyDataErrorInfo.ErrorsChanged event. If the default errors are cleared, the validation via INotifyDataErrorInfo.ErrorsChanged will take over from this point.

GetErrors ( string propertyName ) : IEnumerable

Gets the errors for the specificied propertyName. If the propertyName is null or string.Empty, entity level errors will be returned.

GetWarnings ( string propertyName ) : IEnumerable

Gets the warnings for the specificied propertyName. If the propertyName is null or string.Empty, entity level warnings will be returned.

InitializeDefaultErrors ( IEnumerable validationResults ) : void

Initializes the default errors.

ModelErrorInfo ( object model ) : System

Initializes a new instance of the ModelErrorInfo class.

Private Methods

Method Description
GetValidationString ( object obj ) : string

Gets the validation string from the object. This method supports the following types: * string * ValidationResult

HandleBusinessRuleErrors ( IEnumerable errors ) : void

Handles the business rule errors.

HandleBusinessRuleWarnings ( IEnumerable warnings ) : void

Handles the business rule warnings.

HandleFieldErrors ( string propertyName, IEnumerable errors ) : void

Handles the field errors.

HandleFieldWarnings ( string propertyName, IEnumerable warnings ) : void

Handles the field warnings.

OnModelErrorsChanged ( object sender, System.ComponentModel.DataErrorsChangedEventArgs e ) : void

Called when the errors on the model have changed.

OnModelPropertyChanged ( object sender, PropertyChangedEventArgs e ) : void

Called when a property on the model has changed.

OnModelWarningsChanged ( object sender, System.ComponentModel.DataErrorsChangedEventArgs e ) : void

Called when the warnings on the model have changed.

Method Details

CleanUp() public method

Cleans up the information by unsubscribing from all events.
public CleanUp ( ) : void
return void

ClearDefaultErrors() public method

Updates the default errors. This method is required when errors are initialize via InitializeDefaultErrors. This method checks whether default errors were added for a specific property (or at entity level if propertyName is string.Empty or null). Reason for this is that if the error is known on forehand, the entity implementation will not raise the INotifyDataErrorInfo.ErrorsChanged event. If the default errors are cleared, the validation via INotifyDataErrorInfo.ErrorsChanged will take over from this point.
public ClearDefaultErrors ( string propertyName ) : void
propertyName string Name of the property.
return void

GetErrors() public method

Gets the errors for the specificied propertyName. If the propertyName is null or string.Empty, entity level errors will be returned.
public GetErrors ( string propertyName ) : IEnumerable
propertyName string Name of the property.
return IEnumerable

GetWarnings() public method

Gets the warnings for the specificied propertyName. If the propertyName is null or string.Empty, entity level warnings will be returned.
public GetWarnings ( string propertyName ) : IEnumerable
propertyName string Name of the property.
return IEnumerable

InitializeDefaultErrors() public method

Initializes the default errors.
public InitializeDefaultErrors ( IEnumerable validationResults ) : void
validationResults IEnumerable The validation results.
return void

ModelErrorInfo() public method

Initializes a new instance of the ModelErrorInfo class.
The is null.
public ModelErrorInfo ( object model ) : System
model object The model.
return System