添加逻辑节点支持字符串值

This commit is contained in:
艾竹
2023-04-19 22:26:04 +08:00
parent 451df2d5de
commit f8340b5885
10 changed files with 1141 additions and 51 deletions

View File

@@ -14,27 +14,32 @@ namespace AIStudio.Wpf.DiagramDesigner
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (values == null || values.Length < 1)
if (values == null || values.Length < 2)
{
throw new NotImplementedException();
}
if (values[0] is double && values[1] is ValueTypePoint)
if (values[0] is double && values[2] is ValueType)
{
double connectorValue = (double)values[0];
ValueTypePoint valueTypePoint = (ValueTypePoint)values[1];
string connectorString = values[1] as string;
ValueType valueTypePoint = (ValueType)values[2];
if (valueTypePoint == ValueTypePoint.Bool)
if (valueTypePoint == ValueType.Bool)
{
return (connectorValue == 0) ? "F" : "T";
}
else if (valueTypePoint == ValueTypePoint.Int)
else if (valueTypePoint == ValueType.Int)
{
return connectorValue.ToString("0");
}
else
else if (valueTypePoint == ValueType.Real)
{
return connectorValue.ToString("f3");
}
else
{
return connectorString;
}
}
return null;
}