using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; namespace TeamAAS_VP.Models { /// /// 棋盘格分析结果 /// public class CheckerboardResult : INotifyPropertyChanged { private bool _detected; private double _blackMean; private double _whiteMean; private double _contrast; private int _optimalBrightness; public bool Detected { get => _detected; set => SetField(ref _detected, value); } public double BlackMean { get => _blackMean; set => SetField(ref _blackMean, value); } public double WhiteMean { get => _whiteMean; set => SetField(ref _whiteMean, value); } public double Contrast { get => _contrast; set => SetField(ref _contrast, value); } public int OptimalBrightness { get => _optimalBrightness; set => SetField(ref _optimalBrightness, value); } public event PropertyChangedEventHandler PropertyChanged; protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } protected bool SetField(ref T field, T value, [CallerMemberName] string propertyName = null) { if (EqualityComparer.Default.Equals(field, value)) return false; field = value; OnPropertyChanged(propertyName); return true; } } }