mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-28 17:31:48 +01:00
32 lines
957 B
C#
32 lines
957 B
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
|
|
namespace DS4WinWPF.DS4Forms.ViewModels.Util
|
|
{
|
|
public abstract class NotifyDataErrorBase : INotifyDataErrorInfo
|
|
{
|
|
protected Dictionary<string, List<string>> errors =
|
|
new Dictionary<string, List<string>>();
|
|
|
|
public bool HasErrors => errors.Count > 0;
|
|
|
|
public event EventHandler<DataErrorsChangedEventArgs> ErrorsChanged;
|
|
|
|
public IEnumerable GetErrors(string propertyName)
|
|
{
|
|
errors.TryGetValue(propertyName, out List<string> errorsForName);
|
|
return errorsForName;
|
|
}
|
|
|
|
public void RaiseErrorsChanged(string propertyName)
|
|
{
|
|
ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(propertyName));
|
|
}
|
|
|
|
public abstract bool IsValid(DS4Windows.SpecialAction action);
|
|
public abstract void ClearOldErrors();
|
|
}
|
|
}
|