using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; using TeamAAS_VP.Enums; namespace TeamAAS_VP.Models { /// /// 输入参数 /// public class AnalysisParameters : INotifyPropertyChanged { private FocusMethod _focusMethod = FocusMethod.Tenengrad; private AnalysisMode _analysisMode = AnalysisMode.AutoCheckerboard; private int _targetBrightness = 128; private double _sharpnessThreshold = 10; private double _contrastThreshold = 50; private bool _enableRealtimeAnalysis = true; private bool _autoAdjustBrightness = true; public FocusMethod FocusMethod { get => _focusMethod; set => SetField(ref _focusMethod, value); } public AnalysisMode AnalysisMode { get => _analysisMode; set => SetField(ref _analysisMode, value); } public int TargetBrightness { get => _targetBrightness; set => SetField(ref _targetBrightness, value); } public double SharpnessThreshold { get => _sharpnessThreshold; set => SetField(ref _sharpnessThreshold, value); } public double ContrastThreshold { get => _contrastThreshold; set => SetField(ref _contrastThreshold, value); } public bool EnableRealtimeAnalysis { get => _enableRealtimeAnalysis; set => SetField(ref _enableRealtimeAnalysis, value); } public bool AutoAdjustBrightness { get => _autoAdjustBrightness; set => SetField(ref _autoAdjustBrightness, 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; } /// /// 重置为默认值 /// public void ResetToDefaults() { FocusMethod = FocusMethod.Tenengrad; AnalysisMode = AnalysisMode.AutoCheckerboard; TargetBrightness = 128; SharpnessThreshold = 10; ContrastThreshold = 50; EnableRealtimeAnalysis = true; AutoAdjustBrightness = true; } } }