mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-20 00:06:45 +08:00
优化了中断功能,增加了节点变量的查看。
This commit is contained in:
@@ -22,12 +22,11 @@ namespace Serein.NodeFlow.Model
|
||||
public override async Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
#region 执行前中断
|
||||
if (DebugSetting.IsInterrupt && TryCreateInterruptTask(context, this, out Task<CancelType>? task)) // 执行触发前
|
||||
if (DebugSetting.InterruptClass != InterruptClass.None && TryCreateInterruptTask(context, this, out Task<CancelType>? task)) // 执行触发前
|
||||
{
|
||||
string guid = this.Guid.ToString();
|
||||
this.CancelInterruptCallback ??= () => context.FlowEnvironment.ChannelFlowInterrupt.TriggerSignal(guid);
|
||||
var cancelType = await task!;
|
||||
task?.ToString();
|
||||
await Console.Out.WriteLineAsync($"[{this.MethodDetails.MethodName}]中断已{(cancelType == CancelType.Manual ? "手动取消" : "自动取消")},开始执行后继分支");
|
||||
}
|
||||
#endregion
|
||||
@@ -42,24 +41,9 @@ namespace Serein.NodeFlow.Model
|
||||
Task<IFlipflopContext> flipflopTask = md.ExplicitDatas.Length switch
|
||||
{
|
||||
0 => ((Func<object, Task<IFlipflopContext>>)del).Invoke(md.ActingInstance),
|
||||
_ => ((Func<object, object?[]?, Task<IFlipflopContext>>)del).Invoke(md.ActingInstance, GetParameters(context, md)), // 执行流程中的触发器方法时获取入参参数
|
||||
_ => ((Func<object, object?[]?, Task<IFlipflopContext>>)del).Invoke(md.ActingInstance, GetParameters(context, this, md)), // 执行流程中的触发器方法时获取入参参数
|
||||
};
|
||||
//object?[]? parameters;
|
||||
//object? result = null;
|
||||
//if (haveParameter)
|
||||
//{
|
||||
// var data = GetParameters(context, md);
|
||||
// parameters = [instance, data];
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// parameters = [instance];
|
||||
//}
|
||||
//flipflopTask = del.DynamicInvoke(parameters) as Task<IFlipflopContext>;
|
||||
//if (flipflopTask == null)
|
||||
//{
|
||||
// throw new FlipflopException(base.MethodDetails.MethodName + "触发器返回值非 Task<IFlipflopContext> 类型");
|
||||
//}
|
||||
|
||||
IFlipflopContext flipflopContext = (await flipflopTask) ?? throw new FlipflopException("没有返回上下文");
|
||||
NextOrientation = flipflopContext.State.ToContentType();
|
||||
if(flipflopContext.TriggerData is null || flipflopContext.TriggerData.Type == Library.NodeFlow.Tool.TriggerType.Overtime)
|
||||
@@ -72,7 +56,7 @@ namespace Serein.NodeFlow.Model
|
||||
{
|
||||
NextOrientation = ConnectionType.None;
|
||||
RuningException = ex;
|
||||
throw;
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user