Catel.Windows.Controls.WarningAndErrorValidator.CheckObjectValidationForFields C# (CSharp) Метод

CheckObjectValidationForFields() приватный статический Метод

Checks the object validation for fields warnings or errors.
private static CheckObjectValidationForFields ( object value, string propertyChanged, ObservableCollection infoList, ValidationType validationType ) : void
value object The value.
propertyChanged string The property changed.
infoList ObservableCollection The info list containing the warning or error info.
validationType ValidationType Type of the validation.
Результат void
        private static void CheckObjectValidationForFields(object value, string propertyChanged, ObservableCollection<FieldWarningOrErrorInfo> infoList,
            ValidationType validationType)
        {
            if (string.IsNullOrEmpty(propertyChanged))
            {
                infoList.Clear();
            }
            else
            {
                for (int i = 0; i < infoList.Count; i++)
                {
                    if (string.Compare(infoList[i].Field, propertyChanged) == 0)
                    {
                        infoList.RemoveAt(i);
                    }
                }
            }

            Dictionary<string, string> fieldWarningsOrErrors = CheckFieldWarningsOrErrors(value, propertyChanged, validationType);
            foreach (var fieldWarningOrError in fieldWarningsOrErrors)
            {
                var fieldWarningOrErrorInfo = new FieldWarningOrErrorInfo(fieldWarningOrError.Key, fieldWarningOrError.Value);
                if (!infoList.Contains(fieldWarningOrErrorInfo))
                {
                    infoList.Add(new FieldWarningOrErrorInfo(fieldWarningOrError.Key, fieldWarningOrError.Value));
                }
            }
        }