Catel.Data.ModelBase.SetDirtyAndAutomaticallyValidate C# (CSharp) Method

SetDirtyAndAutomaticallyValidate() protected method

Sets the IsDirty property and automatically validate if required.
protected SetDirtyAndAutomaticallyValidate ( string propertyName, bool setDirtyAndAllowAutomaticValidation ) : void
propertyName string Name of the property.
setDirtyAndAllowAutomaticValidation bool If set to true, the property is set and automatic validation is allowed.
return void
        protected virtual void SetDirtyAndAutomaticallyValidate(string propertyName, bool setDirtyAndAllowAutomaticValidation)
        {
            // Are we not validating or is this a warning or error message?
            if (setDirtyAndAllowAutomaticValidation && !IsValidating &&
                (string.CompareOrdinal(propertyName, WarningMessageProperty) != 0) &&
                (string.CompareOrdinal(propertyName, HasWarningsMessageProperty) != 0) &&
                (string.CompareOrdinal(propertyName, ErrorMessageProperty) != 0) &&
                (string.CompareOrdinal(propertyName, HasErrorsMessageProperty) != 0))
            {
                if (ShouldPropertyChangeUpdateIsDirty(propertyName))
                {
                    IsDirty = true;
                }

                IsValidated = false;
            }

            if (AutomaticallyValidateOnPropertyChanged && setDirtyAndAllowAutomaticValidation)
            {
                Validate();
            }
        }
        #endregion