//Implementation IDataErrorInfo methods for validation public virtual string this[string columnName] { get { string error = String.Empty; if (columnName == "id" || columnName == validationName) { if (!ValidationRules.IsName(id)) { error = "Input ID should contain only letters, numbers and _"; AppLogger.Add("ERROR! " + error); } } if (columnName == "address" || columnName == validationName) { if (!ValidationRules.IsAddressPort(address)) { error = "Input Address must be in format [email protected] or [email protected]:1234"; AppLogger.Add("ERROR! " + error); } } MainWindow.ConfigModifyIndicator(); return(error); } }
public override bool Validate() { bool isValid = ValidationRules.IsName(id) && ValidationRules.IsAddressPort(address); if (!isValid) { AppLogger.Add("ERROR! Errors in Input [" + id + "]"); string a = this[validationName]; } return(isValid); }