wenxiangchao
2026-11-02 9d1660270272180cd71147d6ddd53d1382643d2e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using CommunityToolkit.Mvvm.ComponentModel;
using NationalInstruments.TestStand.Interop.API;
 
namespace Plugin.SeqEditor.Entity.EditablePO
{
 
    public class StringValTestEPO : BaseEPO
    {
        public Step Step { get; private set; }
        public PropertyObject PropertyObject { get; private set; }
 
        public StringValTestEPO(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")
            {
                OnPropertyChanged("StringValue");
            }
        }
 
        public string ComparisonType
        {
            get => PropertyObject?.GetValString("Comp", 0);
            set
            {
                if (PropertyObject != null)
                {
                    PropertyObject.SetValString("Comp", 0, value);
                    CustomPropertyChanged(nameof(ComparisonType));
                }
            }
        }
 
        public bool IsReadOnly
        {
            get
            {
                if (PropertyObject == null) return false;
                bool flag = PropertyObject.GetValBoolean("Limits.UseStringExpr", 0);
                return flag == true;
            }
        }
 
        public string StringValue
        {
            get
            {
                if (PropertyObject == null) return null;
                var value = PropertyObject.GetValString("Limits.String", 0);
                if (string.IsNullOrEmpty(value))
                {
                    value = PropertyObject.GetValString("Limits.StringExpr", 0);
                }
                return value;
            }
            set
            {
                if (PropertyObject != null)
                {
                    PropertyObject.SetValString("Limits.String", 0, value);
                    PropertyObject.SetValString("Limits.StringExpr", 0, null);
                    PropertyObject.SetValBoolean("Limits.UseStringExpr", 0, false);
                    CustomPropertyChanged(nameof(StringValue));
                }
            }
        }
    }
}