mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
简单表达式计算就用DataTable自带的好了
This commit is contained in:
@@ -5,7 +5,10 @@ using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using AIStudio.Wpf.DiagramDesigner;
|
||||
using Expression = org.mariuszgromada.math.mxparser.Expression;
|
||||
using Microsoft.CSharp;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Reflection;
|
||||
using System.Data;
|
||||
|
||||
namespace AIStudio.Wpf.Flowchart
|
||||
{
|
||||
@@ -274,17 +277,19 @@ namespace AIStudio.Wpf.Flowchart
|
||||
try
|
||||
{
|
||||
//按条件选择一个分支
|
||||
string express = step.Value.Replace("data.Flag", nextNode.Text);
|
||||
Expression e = new Expression(express);
|
||||
var result = e.calculate();
|
||||
if (result == 1)
|
||||
string expression = step.Value.Replace("data.Flag", nextNode.Text);
|
||||
|
||||
var result = new DataTable().Compute(expression, "");
|
||||
if (result.Equals(true))
|
||||
{
|
||||
SetStatus(nextNode, 100);
|
||||
Next(step.Key, nextNode);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch(Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
//如果表达式错了,就按第一个处理
|
||||
Next(nextNode.SelectNextStep.FirstOrDefault().Key, nextNode);
|
||||
@@ -367,6 +372,6 @@ namespace AIStudio.Wpf.Flowchart
|
||||
public static void DisposeData(IDiagramViewModel viewModel)
|
||||
{
|
||||
FlowNodes.Remove(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user