Mercurial > silverbladetech
changeset 55:f45b8551e79e
Final upload
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Thu, 19 Apr 2012 13:50:53 +0100 |
parents | cd9faa9f024b |
children | cb646712bc97 |
files | SilverlightValidation/SilverlightValidation/UserViewModel.cs SilverlightValidation/SilverlightValidation/ViewModelBase.cs |
diffstat | 2 files changed, 7 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/SilverlightValidation/SilverlightValidation/UserViewModel.cs Thu Apr 19 13:39:22 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation/UserViewModel.cs Thu Apr 19 13:50:53 2012 +0100 @@ -45,7 +45,7 @@ #endregion - #region Property + #region Properties private const string UsernameProperty = "Username"; public string Username
--- a/SilverlightValidation/SilverlightValidation/ViewModelBase.cs Thu Apr 19 13:39:22 2012 +0100 +++ b/SilverlightValidation/SilverlightValidation/ViewModelBase.cs Thu Apr 19 13:50:53 2012 +0100 @@ -26,7 +26,7 @@ public void SetError(string propertyName, string errorMessage) { if (!_errors.ContainsKey(propertyName)) - _errors.Add(propertyName, new List<string> {errorMessage}); + _errors.Add(propertyName, new List<string> { errorMessage }); RaiseErrorsChanged(propertyName); } @@ -44,13 +44,8 @@ var errors = _errors.Select(error => error.Key).ToList(); foreach (var propertyName in errors) - { - _errors.Remove(propertyName); - RaiseErrorsChanged(propertyName); - } + ClearError(propertyName); } - - #endregion public void RaiseErrorsChanged(string propertyName) { @@ -62,13 +57,15 @@ public IEnumerable GetErrors(string propertyName) { return _errors.ContainsKey(propertyName) - ? _errors[propertyName] - : null; + ? _errors[propertyName] + : null; } public bool HasErrors { get { return _errors.Count > 0; } } + + #endregion } }