namespace OINA.Extender.WPF.Testharness { using System.ComponentModel; using OINA.Extender.Data.Ed; /// /// Provides an object for WPF to bind to, where the user can enable / disable which detectors are used in a spectrum acquisition /// /// public sealed class DetectorEnableModel : INotifyPropertyChanged { private readonly EdHardwareId edHardwareId; private bool isDetectorEnabled; public DetectorEnableModel(EdHardwareId edHardwareId, bool enabled) { this.edHardwareId = edHardwareId; this.isDetectorEnabled = enabled; } public event PropertyChangedEventHandler PropertyChanged; public bool IsDetectorEnabled { get { return this.isDetectorEnabled; } set { if (this.isDetectorEnabled != value) { this.isDetectorEnabled = value; this.RaisePropertyChangedEvent(nameof(this.IsDetectorEnabled)); } } } public string DisplayName { get { return this.edHardwareId.DisplayName; } } public EdHardwareId EdHardwareId { get { return this.edHardwareId; } } /// /// Raises the property changed event. /// /// Name of the property. private void RaisePropertyChangedEvent(string propertyName) { this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } }