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));
|
}
|
}
|
}
|
}
|
}
|