1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- namespace OINA.Extender.WPF.Testharness
- {
- using System.ComponentModel;
- using OINA.Extender.Data.Ed;
- /// <summary>
- /// Provides an object for WPF to bind to, where the user can enable / disable which detectors are used in a spectrum acquisition
- /// </summary>
- /// <seealso cref="System.ComponentModel.INotifyPropertyChanged" />
- 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;
- }
- }
- /// <summary>
- /// Raises the property changed event.
- /// </summary>
- /// <param name="propertyName">Name of the property.</param>
- private void RaisePropertyChangedEvent(string propertyName)
- {
- this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
|