using System.ComponentModel; using System.Runtime.CompilerServices; namespace Sinvo.EplanHpD.Plugin.WPFUI.Models { public class CheckedModel : INotifyPropertyChanged { private bool isChecked = false; private bool isError = false; private int errorCount = 0; private string checkedMsg; private bool isIgnore = false; /// /// 是否已检查 /// public bool IsChecked { get => isChecked; set => SetProperty(ref isChecked, value); } /// /// 是否存在异常 /// public bool IsError { get => isError; set => SetProperty(ref isError, value); } /// /// 异常数 /// public int ErrorCount { get => errorCount; set => SetProperty(ref errorCount, value); } /// /// 检查信息 /// public string CheckedMsg { get => checkedMsg; set => SetProperty(ref checkedMsg, value); } /// /// 是否忽略 /// public bool IsIgnore { get => isIgnore; set => SetProperty(ref isIgnore, value); } public event PropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } protected bool SetProperty(ref T field, T value, [CallerMemberName] string propertyName = null) { //if (Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; } } }