alielie
2025-10-10 15bbd62b0b24b72c717ae91ab45348a2083ad04e
Plugin.SeqEditor/Entity/EditablePO/NumValTestEPO.cs
@@ -1,5 +1,4 @@
using CommunityToolkit.Mvvm.ComponentModel;
using NationalInstruments.TestStand.Interop.API;
using NationalInstruments.TestStand.Interop.API;
namespace Plugin.SeqEditor.Entity.EditablePO
{
@@ -11,8 +10,26 @@
        public NumValTestEPO(StepUI stepUI)
        {
            StepUI = stepUI;
            StepUI.PropertyChanged += StepUI_PropertyChanged;
            Step = stepUI?.step;
            PropertyObject = Step?.AsPropertyObject();
        }
        private void StepUI_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Low" || e.PropertyName == "High")
            {
                OnPropertyChanged(e.PropertyName);
            }
        }
        ~NumValTestEPO()
        {
            if (StepUI != null)
            {
                StepUI.PropertyChanged -= StepUI_PropertyChanged;
            }
        }
        public string ComparisonType
@@ -28,29 +45,23 @@
            }
        }
        public double? Low
        public string Low
        {
            get => PropertyObject?.GetValNumber("Limits.Low", 0);
            get => StepUI?.Low?.ToString();
            set
            {
                if (PropertyObject != null)
                {
                    PropertyObject.SetValNumber("Limits.Low", 0, value ?? 0);
                    CustomPropertyChanged(nameof(Low));
                }
                double.TryParse(value, out var dob);
                StepUI.Low = value;
            }
        }
        public double? High
        public string High
        {
            get => PropertyObject?.GetValNumber("Limits.High", 0);
            get => StepUI?.High?.ToString();
            set
            {
                if (PropertyObject != null)
                {
                    PropertyObject.SetValNumber("Limits.High", 0, value ?? 0);
                    CustomPropertyChanged(nameof(Low));
                }
                double.TryParse(value, out var dob);
                StepUI.High = dob;
            }
        }
    }