2025-03-20 22:54:10 +08:00
|
|
|
|
using Microsoft.Extensions.ObjectPool;
|
|
|
|
|
|
using Serein.Library;
|
|
|
|
|
|
using Serein.Library.Api;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.NodeFlow
|
|
|
|
|
|
{
|
2025-05-26 23:55:23 +08:00
|
|
|
|
|
|
|
|
|
|
public class FlowTask
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否异步启动流程
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsTaskAsync { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程起始节点
|
|
|
|
|
|
/// </summary>
|
2025-05-31 12:15:01 +08:00
|
|
|
|
public Func<IFlowNode> GetStartNode { get; set; }
|
2025-05-26 23:55:23 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取当前画布流程的所有节点
|
|
|
|
|
|
/// </summary>
|
2025-05-31 12:15:01 +08:00
|
|
|
|
public Func<List<IFlowNode>> GetNodes { get; set; }
|
2025-05-26 23:55:23 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-03-21 18:26:01 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点任务执行依赖
|
|
|
|
|
|
/// </summary>
|
2025-05-26 23:55:23 +08:00
|
|
|
|
public class FlowWorkOptions()
|
2025-03-20 22:54:10 +08:00
|
|
|
|
{
|
2025-07-18 22:45:06 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程IOC容器
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ISereinIOC FlowIOC { get; set; }
|
2025-03-20 22:54:10 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程运行环境
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public IFlowEnvironment Environment { get; set; }// = environment;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表示运行环境状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public CancellationTokenSource CancellationTokenSource { get; } = new CancellationTokenSource();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 上下文线程池
|
|
|
|
|
|
/// </summary>
|
2025-07-23 16:20:41 +08:00
|
|
|
|
public Serein.Library.Utils.ObjectPool<IFlowContext> FlowContextPool { get; set; }
|
2025-03-20 22:54:10 +08:00
|
|
|
|
|
2025-05-26 23:55:23 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 每个画布需要启用的节点
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Dictionary<string, FlowTask> Flows { get; set; }
|
|
|
|
|
|
|
2025-03-20 22:54:10 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 当前任务加载的所有节点
|
|
|
|
|
|
/// </summary>
|
2025-05-26 23:55:23 +08:00
|
|
|
|
//public List<NodeModelBase> Nodes { get; set; }// = nodes;
|
|
|
|
|
|
|
2025-03-20 22:54:10 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 需要注册的类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Dictionary<RegisterSequence, List<Type>> AutoRegisterTypes { get; set; } //= autoRegisterTypes;
|
2025-05-26 23:55:23 +08:00
|
|
|
|
|
2025-03-20 22:54:10 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 初始化时需要的方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public List<MethodDetails> InitMds { get; set; }// = initMds;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载时需要的方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public List<MethodDetails> LoadMds { get; set; }// = loadMds;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 退出时需要调用的方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public List<MethodDetails> ExitMds { get; set; } //= exitMds;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|