mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
GIT练习
This commit is contained in:
72
Library/DynamicFlow/NodeModel/SingleConditionNode.cs
Normal file
72
Library/DynamicFlow/NodeModel/SingleConditionNode.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Serein.DynamicFlow.SerinExpression;
|
||||
using Serein.DynamicFlow.Tool;
|
||||
using System.Diagnostics;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Serein.DynamicFlow.NodeModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 条件节点(用于条件控件)
|
||||
/// </summary>
|
||||
public class SingleConditionNode : NodeBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 是否为自定义参数
|
||||
/// </summary>
|
||||
public bool IsCustomData { get; set; }
|
||||
/// <summary>
|
||||
/// 自定义参数值
|
||||
/// </summary>
|
||||
public object? CustomData { get; set; }
|
||||
/// <summary>
|
||||
/// 条件表达式
|
||||
/// </summary>
|
||||
public string Expression { get; set; }
|
||||
|
||||
public override object? Execute(DynamicContext context)
|
||||
{
|
||||
// 接收上一节点参数or自定义参数内容
|
||||
object? result;
|
||||
if (IsCustomData)
|
||||
{
|
||||
result = CustomData;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = PreviousNode?.FlowData;
|
||||
}
|
||||
FlowState = SerinConditionParser.To(result, Expression);
|
||||
Console.WriteLine($"{result} {Expression} -> " + FlowState);
|
||||
return result;
|
||||
}
|
||||
|
||||
//public override void Execute(DynamicContext context)
|
||||
//{
|
||||
// CurrentState = Judge(context, base.MethodDetails);
|
||||
//}
|
||||
|
||||
//private bool Judge(DynamicContext context, MethodDetails md)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// if (DelegateCache.GlobalDicDelegates.TryGetValue(md.MethodName, out Delegate del))
|
||||
// {
|
||||
// object[] parameters = GetParameters(context, md);
|
||||
// var temp = del.DynamicInvoke(parameters);
|
||||
// //context.GetData(GetDyPreviousKey());
|
||||
// return (bool)temp;
|
||||
// }
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// Debug.Write(ex.Message);
|
||||
// }
|
||||
// return false;
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user