C# Класс Catel.MVVM.ModelErrorInfo

Class containing all the errors and warnings retrieved via INotifyDataErrorInfo and INotifyDataWarningInfo.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

CleanUp() публичный Метод

Cleans up the information by unsubscribing from all events.
public CleanUp ( ) : void
Результат void

ClearDefaultErrors() публичный Метод

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.
Результат void

GetErrors() публичный Метод

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.
Результат IEnumerable

GetWarnings() публичный Метод

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.
Результат IEnumerable

InitializeDefaultErrors() публичный Метод

Initializes the default errors.
public InitializeDefaultErrors ( IEnumerable validationResults ) : void
validationResults IEnumerable The validation results.
Результат void

ModelErrorInfo() публичный Метод

Initializes a new instance of the ModelErrorInfo class.
The is null.
public ModelErrorInfo ( object model ) : System
model object The model.
Результат System