From f2a831eb785ca81a069406f7df0f3890ac2be90a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Fri, 26 Apr 2013 23:44:07 +0400 Subject: redo old commit --- Juick/ViewModels/Validation/DataViewModelBase.cs | 44 ------------------------ 1 file changed, 44 deletions(-) delete mode 100644 Juick/ViewModels/Validation/DataViewModelBase.cs (limited to 'Juick/ViewModels/Validation') diff --git a/Juick/ViewModels/Validation/DataViewModelBase.cs b/Juick/ViewModels/Validation/DataViewModelBase.cs deleted file mode 100644 index dcbf34b..0000000 --- a/Juick/ViewModels/Validation/DataViewModelBase.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; - -namespace Juick.ViewModels.Validation -{ - public class DataViewModelBase : ViewModelBase, IDataErrorInfo - { - - private readonly Dictionary> _errors = - new Dictionary>(); - - // Adds the specified error to the errors collection if it is not already - // present, inserting it in the first position if isWarning is false. - public void AddError(string propertyName, string error, bool isWarning) - { - if (!_errors.ContainsKey(propertyName)) - _errors[propertyName] = new List(); - - if (_errors[propertyName].Contains(error)) return; - if (isWarning) _errors[propertyName].Add(error); - else _errors[propertyName].Insert(0, error); - } - - // Removes the specified error from the errors collection if it is present. - public void RemoveError(string propertyName, string error) - { - if (!_errors.ContainsKey(propertyName) || !_errors[propertyName].Contains(error)) return; - _errors[propertyName].Remove(error); - if (_errors[propertyName].Count == 0) _errors.Remove(propertyName); - } - - public string Error { get { throw new NotImplementedException(); } } - - public string this[string columnName] - { - get - { - return (!_errors.ContainsKey(columnName) ? null : - String.Join(Environment.NewLine, _errors[columnName])); - } - } - } -} -- cgit v1.2.3