2024-09-15 12:15:32 +08:00
|
|
|
|
using Serein.Library.Entity;
|
|
|
|
|
|
using Serein.Library.Enums;
|
2024-09-20 10:50:32 +08:00
|
|
|
|
using Serein.Library.Utils;
|
2024-09-15 12:15:32 +08:00
|
|
|
|
using System;
|
2024-10-15 10:55:41 +08:00
|
|
|
|
using System.Collections.Concurrent;
|
2024-09-15 12:15:32 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2024-09-22 17:37:32 +08:00
|
|
|
|
using static Serein.Library.Utils.ChannelFlowInterrupt;
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
|
|
|
|
|
namespace Serein.Library.Api
|
|
|
|
|
|
{
|
2024-09-16 21:38:34 +08:00
|
|
|
|
#region 环境委托
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程运行完成
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
|
|
|
|
|
public delegate void FlowRunCompleteHandler(FlowEventArgs eventArgs);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
2024-09-17 14:20:27 +08:00
|
|
|
|
/// 项目加载完成
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// </summary>
|
2024-09-17 14:20:27 +08:00
|
|
|
|
public delegate void ProjectLoadedHandler(ProjectLoadedEventArgs eventArgs);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载项目文件时成功加载了DLL文件
|
|
|
|
|
|
/// </summary>
|
2024-09-30 02:45:49 +08:00
|
|
|
|
public delegate void LoadDllHandler(LoadDllEventArgs eventArgs);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 移除了加载的dll
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
|
|
|
|
|
public delegate void RemoteDllHandler(RemoteDllEventArgs eventArgs);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 运行环境节点连接发生了改变
|
|
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="eventArgs"></param>
|
2024-09-16 21:38:34 +08:00
|
|
|
|
public delegate void NodeConnectChangeHandler(NodeConnectChangeEventArgs eventArgs);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 环境中加载了一个节点
|
|
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="eventArgs"></param>
|
2024-09-16 21:38:34 +08:00
|
|
|
|
public delegate void NodeCreateHandler(NodeCreateEventArgs eventArgs);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 环境中流程起始节点发生了改变
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
2024-09-22 14:10:13 +08:00
|
|
|
|
public delegate void StartNodeChangeHandler(StartNodeChangeEventArgs eventArgs);
|
2024-09-24 22:39:43 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 被监视的对象改变事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
|
|
|
|
|
public delegate void MonitorObjectChangeHandler(MonitorObjectEventArgs eventArgs);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点中断状态改变事件(开启了中断/取消了中断)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
|
|
|
|
|
public delegate void NodeInterruptStateChangeHandler(NodeInterruptStateChangeEventArgs eventArgs);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点触发中断事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
|
|
|
|
|
public delegate void ExpInterruptTriggerHandler(InterruptTriggerEventArgs eventArgs);
|
|
|
|
|
|
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// IOC容器发生变化
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public delegate void IOCMembersChangedHandler(IOCMembersChangedEventArgs eventArgs);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点需要定位
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
|
|
|
|
|
public delegate void NodeLocatedHandler(NodeLocatedEventArgs eventArgs);
|
2024-09-24 22:39:43 +08:00
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 环境事件签名
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// 流程事件签名基类
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// </summary>
|
2024-09-16 21:38:34 +08:00
|
|
|
|
public class FlowEventArgs : EventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 是否完成
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public bool IsSucceed { get; protected set; } = true;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 错误提示
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string ErrorTips { get; protected set; } = string.Empty;
|
|
|
|
|
|
}
|
2024-09-17 14:20:27 +08:00
|
|
|
|
|
|
|
|
|
|
//public class LoadNodeEventArgs : FlowEventArgs
|
|
|
|
|
|
//{
|
|
|
|
|
|
// public LoadNodeEventArgs(NodeInfo NodeInfo, MethodDetails MethodDetailss)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// this.NodeInfo = NodeInfo;
|
|
|
|
|
|
// this.MethodDetailss = MethodDetailss;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 项目文件节点信息参数
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// public NodeInfo NodeInfo { get; protected set; }
|
|
|
|
|
|
// /// <summary>
|
|
|
|
|
|
// /// 已加载在环境中的方法描述
|
|
|
|
|
|
// /// </summary>
|
|
|
|
|
|
// public MethodDetails MethodDetailss { get; protected set; }
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
public class ProjectLoadedEventArgs : FlowEventArgs
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
2024-09-17 14:20:27 +08:00
|
|
|
|
public ProjectLoadedEventArgs()
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-30 02:45:49 +08:00
|
|
|
|
public class LoadDllEventArgs : FlowEventArgs
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
2024-10-15 10:55:41 +08:00
|
|
|
|
public LoadDllEventArgs(NodeLibrary nodeLibrary, List<MethodDetailsInfo> MethodDetailss)
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
2024-09-30 02:45:49 +08:00
|
|
|
|
this.NodeLibrary = nodeLibrary;
|
2024-09-15 12:15:32 +08:00
|
|
|
|
this.MethodDetailss = MethodDetailss;
|
|
|
|
|
|
}
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 已加载了的程序集
|
|
|
|
|
|
/// </summary>
|
2024-09-30 02:45:49 +08:00
|
|
|
|
public NodeLibrary NodeLibrary { get; protected set; }
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// dll文件中有效的流程方法描述
|
|
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
public List<MethodDetailsInfo> MethodDetailss { get; protected set; }
|
2024-09-15 12:15:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-30 02:45:49 +08:00
|
|
|
|
public class RemoteDllEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public RemoteDllEventArgs()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public class NodeConnectChangeEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 连接关系改变类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public enum ConnectChangeType
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
Create,
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 移除
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
Remote,
|
|
|
|
|
|
}
|
2024-09-16 21:38:34 +08:00
|
|
|
|
public NodeConnectChangeEventArgs(string fromNodeGuid, string toNodeGuid, ConnectionType connectionType, ConnectChangeType changeType)
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.FromNodeGuid = fromNodeGuid;
|
|
|
|
|
|
this.ToNodeGuid = toNodeGuid;
|
|
|
|
|
|
this.ConnectionType = connectionType;
|
|
|
|
|
|
this.ChangeType = changeType;
|
|
|
|
|
|
}
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 连接关系中始节点的Guid
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public string FromNodeGuid { get; protected set; }
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 连接关系中目标节点的Guid
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public string ToNodeGuid { get; protected set; }
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 连接类型
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public ConnectionType ConnectionType { get; protected set; }
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表示此次需要在两个节点之间创建连接关系,或是移除连接关系
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public ConnectChangeType ChangeType { get; protected set; }
|
2024-09-15 12:15:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public class NodeCreateEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
2024-09-17 14:20:27 +08:00
|
|
|
|
public NodeCreateEventArgs(object nodeModel, Position position)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.NodeModel = nodeModel;
|
|
|
|
|
|
this.Position = position;
|
|
|
|
|
|
}
|
|
|
|
|
|
public NodeCreateEventArgs(object nodeModel, bool isAddInRegion, string regeionGuid)
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
this.NodeModel = nodeModel;
|
2024-09-17 14:20:27 +08:00
|
|
|
|
this.RegeionGuid = regeionGuid;
|
|
|
|
|
|
this.IsAddInRegion = isAddInRegion;
|
2024-09-15 12:15:32 +08:00
|
|
|
|
}
|
2024-09-17 14:20:27 +08:00
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点Model对象,目前需要手动转换对应的类型
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public object NodeModel { get; private set; }
|
2024-09-17 14:20:27 +08:00
|
|
|
|
public Position Position { get; private set; }
|
|
|
|
|
|
public bool IsAddInRegion { get; private set; }
|
|
|
|
|
|
public string RegeionGuid { get; private set; }
|
2024-09-15 12:15:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 环境中移除了一个节点
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="eventArgs"></param>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
|
|
|
|
|
public delegate void NodeRemoteHandler(NodeRemoteEventArgs eventArgs);
|
|
|
|
|
|
public class NodeRemoteEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public NodeRemoteEventArgs(string nodeGuid)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.NodeGuid = nodeGuid;
|
|
|
|
|
|
}
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 被移除节点的Guid
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public string NodeGuid { get; private set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-16 21:38:34 +08:00
|
|
|
|
public class StartNodeChangeEventArgs : FlowEventArgs
|
2024-09-15 12:15:32 +08:00
|
|
|
|
{
|
|
|
|
|
|
public StartNodeChangeEventArgs(string oldNodeGuid, string newNodeGuid)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.OldNodeGuid = oldNodeGuid;
|
|
|
|
|
|
this.NewNodeGuid = newNodeGuid; ;
|
|
|
|
|
|
}
|
2024-09-16 21:38:34 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 原来的起始节点Guid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string OldNodeGuid { get; private set; }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 新的起始节点Guid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string NewNodeGuid { get; private set; }
|
2024-09-17 14:20:27 +08:00
|
|
|
|
}
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 监视的节点数据发生变化
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class MonitorObjectEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 变化的数据类别
|
|
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
public enum ObjSourceType
|
|
|
|
|
|
{
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程节点的数据
|
|
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
NodeFlowData,
|
2024-10-15 10:55:41 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// IOC容器对象
|
|
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
IOCObj,
|
|
|
|
|
|
}
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 在某个节点运行时,监听的数据发生了改变
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid"></param>
|
|
|
|
|
|
/// <param name="monitorData"></param>
|
|
|
|
|
|
/// <param name="objSourceType"></param>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
public MonitorObjectEventArgs(string nodeGuid, object monitorData, ObjSourceType objSourceType)
|
2024-09-22 14:10:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
NodeGuid = nodeGuid;
|
2024-09-24 22:39:43 +08:00
|
|
|
|
NewData = monitorData;
|
|
|
|
|
|
ObjSource = objSourceType;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 中断的节点Guid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string NodeGuid { get; protected set; }
|
2024-10-15 10:55:41 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 监听对象类别
|
|
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
public ObjSourceType ObjSource { get; protected set; }
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 新的数据
|
|
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
public object NewData { get; protected set; }
|
2024-09-22 14:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点中断状态改变事件参数
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class NodeInterruptStateChangeEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
2024-09-24 22:39:43 +08:00
|
|
|
|
public NodeInterruptStateChangeEventArgs(string nodeGuid, InterruptClass @class)
|
2024-09-22 14:10:13 +08:00
|
|
|
|
{
|
|
|
|
|
|
NodeGuid = nodeGuid;
|
|
|
|
|
|
Class = @class;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 中断的节点Guid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string NodeGuid { get; protected set; }
|
|
|
|
|
|
public InterruptClass Class { get; protected set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点触发了中断事件参数
|
|
|
|
|
|
/// </summary>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
public class InterruptTriggerEventArgs : FlowEventArgs
|
2024-09-22 14:10:13 +08:00
|
|
|
|
{
|
2024-09-22 17:37:32 +08:00
|
|
|
|
public enum InterruptTriggerType
|
2024-09-22 14:10:13 +08:00
|
|
|
|
{
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 主动监视中断
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Monitor,
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 表达式中断
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Exp,
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 对象监视中断
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Obj,
|
2024-09-22 17:37:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InterruptTriggerEventArgs(string nodeGuid, string expression, InterruptTriggerType type)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.NodeGuid = nodeGuid;
|
|
|
|
|
|
this.Expression = expression;
|
|
|
|
|
|
this.Type = type;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 中断的节点Guid
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public string NodeGuid { get; protected set; }
|
2024-09-22 17:37:32 +08:00
|
|
|
|
public string Expression { get; protected set; }
|
|
|
|
|
|
public InterruptTriggerType Type { get; protected set; }
|
2024-09-22 14:10:13 +08:00
|
|
|
|
}
|
2024-09-24 22:39:43 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程事件签名基类
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class IOCMembersChangedEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public enum EventType
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 登记了类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Registered,
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 构建了类型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Completeuild,
|
|
|
|
|
|
}
|
2024-09-26 21:00:17 +08:00
|
|
|
|
public IOCMembersChangedEventArgs(string key, object instance)
|
2024-09-24 22:39:43 +08:00
|
|
|
|
{
|
2024-09-26 21:00:17 +08:00
|
|
|
|
this.Key = key;
|
|
|
|
|
|
this.Instance = instance;
|
2024-09-24 22:39:43 +08:00
|
|
|
|
}
|
2024-09-26 21:00:17 +08:00
|
|
|
|
public string Key { get; private set; }
|
|
|
|
|
|
public object Instance { get; private set; }
|
2024-09-27 23:47:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
|
2024-09-27 23:47:25 +08:00
|
|
|
|
public class NodeLocatedEventArgs : FlowEventArgs
|
|
|
|
|
|
{
|
|
|
|
|
|
public NodeLocatedEventArgs(string nodeGuid)
|
|
|
|
|
|
{
|
|
|
|
|
|
NodeGuid = nodeGuid;
|
|
|
|
|
|
}
|
|
|
|
|
|
public string NodeGuid { get; private set; }
|
2024-09-24 22:39:43 +08:00
|
|
|
|
}
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-10-15 10:55:41 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 运行环境
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
public interface IFlowEnvironment
|
|
|
|
|
|
{
|
2024-09-24 22:39:43 +08:00
|
|
|
|
#region 属性
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <summary>
|
2024-10-14 17:29:28 +08:00
|
|
|
|
/// <para>单例模式IOC容器,内部维护了一个实例字典,默认使用类型的FullName作为Key,如果以“接口-实现类”的方式注册,那么将使用接口类型的FullName作为Key。</para>
|
|
|
|
|
|
/// <para>当某个类型注册绑定成功后,将不会因为其它地方尝试注册相同类型的行为导致类型被重新创建。</para>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
ISereinIOC IOC { get; }
|
|
|
|
|
|
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// 环境名称
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// </summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
string EnvName { get; }
|
2024-10-14 17:29:28 +08:00
|
|
|
|
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// 是否全局中断
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// </summary>
|
2024-10-13 19:36:45 +08:00
|
|
|
|
bool IsGlobalInterrupt { get; }
|
|
|
|
|
|
|
2024-10-14 17:29:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// DLL中NodeAction特性的方法描述的所有原始副本
|
|
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
// ConcurrentDictionary<string, MethodDetails> MethodDetailss { get; }
|
2024-10-14 17:29:28 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程运行状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
RunState FlowState { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 全局触发器运行状态
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
RunState FlipFlopState { get; set; }
|
2024-10-13 19:36:45 +08:00
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
#endregion
|
2024-09-20 10:50:32 +08:00
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
#region 事件
|
2024-09-17 14:20:27 +08:00
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载Dll
|
|
|
|
|
|
/// </summary>
|
2024-09-30 02:45:49 +08:00
|
|
|
|
event LoadDllHandler OnDllLoad;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 项目加载完成
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event ProjectLoadedHandler OnProjectLoaded;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点连接属性改变事件
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
event NodeConnectChangeHandler OnNodeConnectChange;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点创建事件
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
event NodeCreateHandler OnNodeCreate;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 移除节点事件
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
event NodeRemoteHandler OnNodeRemote;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 起始节点变化事件
|
|
|
|
|
|
/// </summary>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
event StartNodeChangeHandler OnStartNodeChange;
|
|
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程运行完成事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event FlowRunCompleteHandler OnFlowRunComplete;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 被监视的对象改变事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event MonitorObjectChangeHandler OnMonitorObjectChange;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点中断状态变化事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event NodeInterruptStateChangeHandler OnNodeInterruptStateChange;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// 触发中断
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// </summary>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
event ExpInterruptTriggerHandler OnInterruptTrigger;
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-09-26 21:00:17 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// IOC容器发生改变
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event IOCMembersChangedHandler OnIOCMembersChanged;
|
|
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-09-27 23:47:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点需要定位
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
event NodeLocatedHandler OnNodeLocate;
|
|
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-09-26 21:00:17 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// 获取方法描述信息
|
2024-09-26 21:00:17 +08:00
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="methodName">方法描述</param>
|
|
|
|
|
|
/// <param name="mdInfo">方法信息</param>
|
2024-09-26 21:00:17 +08:00
|
|
|
|
/// <returns></returns>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
bool TryGetMethodDetailsInfo(string methodName, out MethodDetailsInfo mdInfo);
|
2024-09-26 21:00:17 +08:00
|
|
|
|
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取指定方法的Emit委托
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="methodName"></param>
|
|
|
|
|
|
/// <param name="del"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-10-10 10:45:53 +08:00
|
|
|
|
bool TryGetDelegateDetails(string methodName, out DelegateDetails del);
|
2024-09-30 02:45:49 +08:00
|
|
|
|
|
2024-09-26 21:00:17 +08:00
|
|
|
|
//bool TryGetNodeData(string methodName, out NodeData node);
|
|
|
|
|
|
|
2024-09-27 23:47:25 +08:00
|
|
|
|
#region 环境基础接口
|
2024-09-24 22:39:43 +08:00
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 保存当前项目
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
SereinProjectData GetProjectInfo();
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载项目文件
|
|
|
|
|
|
/// </summary>
|
2024-09-17 15:58:37 +08:00
|
|
|
|
/// <param name="projectFile"></param>
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <param name="filePath"></param>
|
2024-09-17 15:58:37 +08:00
|
|
|
|
void LoadProject(SereinProjectData projectFile, string filePath);
|
2024-10-15 10:55:41 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 加载远程项目
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="addres">远程项目地址</param>
|
|
|
|
|
|
/// <param name="port">远程项目端口</param>
|
|
|
|
|
|
/// <param name="token">密码</param>
|
|
|
|
|
|
void LoadRemoteProject(string addres,int port, string token);
|
|
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从文件中加载Dll
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="dllPath"></param>
|
|
|
|
|
|
void LoadDll(string dllPath);
|
2024-09-30 02:45:49 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 移除DLL
|
|
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="assemblyFullName">程序集的名称</param>
|
2024-09-30 02:45:49 +08:00
|
|
|
|
bool RemoteDll(string assemblyFullName);
|
|
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 清理加载的DLL(待更改)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
void ClearAll();
|
2024-10-10 16:49:37 +08:00
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 开始运行
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
Task StartAsync();
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从选定的节点开始运行
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="startNodeGuid"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
Task StartFlowInSelectNodeAsync(string startNodeGuid);
|
|
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 结束运行
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
void Exit();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置流程起点节点
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid"></param>
|
|
|
|
|
|
void SetStartNode(string nodeGuid);
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 在两个节点之间创建连接关系
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="fromNodeGuid">起始节点Guid</param>
|
|
|
|
|
|
/// <param name="toNodeGuid">目标节点Guid</param>
|
|
|
|
|
|
/// <param name="connectionType">连接类型</param>
|
|
|
|
|
|
void ConnectNode(string fromNodeGuid, string toNodeGuid, ConnectionType connectionType);
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 创建节点/区域/基础控件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeBase">节点/区域/基础控件</param>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="position">节点在画布上的位置(</param>
|
|
|
|
|
|
/// <param name="methodDetailsInfo">节点绑定的方法说明(</param>
|
|
|
|
|
|
void CreateNode(NodeControlType nodeBase, Position position, MethodDetailsInfo methodDetailsInfo = null);
|
|
|
|
|
|
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 移除两个节点之间的连接关系
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="fromNodeGuid">起始节点</param>
|
|
|
|
|
|
/// <param name="toNodeGuid">目标节点</param>
|
|
|
|
|
|
/// <param name="connectionType">连接类型</param>
|
2024-10-14 17:29:28 +08:00
|
|
|
|
void RemoveConnect(string fromNodeGuid, string toNodeGuid, ConnectionType connectionType);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 移除节点/区域/基础控件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid">待移除的节点Guid</param>
|
2024-10-14 17:29:28 +08:00
|
|
|
|
void RemoveNode(string nodeGuid);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-10-14 17:29:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 激活未启动的全局触发器
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid"></param>
|
2024-10-10 16:49:37 +08:00
|
|
|
|
void ActivateFlipflopNode(string nodeGuid);
|
2024-10-14 17:29:28 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 终结一个全局触发器,在它触发后将不会再次监听消息(表现为已经启动的触发器至少会再次处理一次消息,后面版本再修正这个非预期行为)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid"></param>
|
2024-10-10 16:49:37 +08:00
|
|
|
|
void TerminateFlipflopNode(string nodeGuid);
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置节点中断级别
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid">被中断的节点Guid</param>
|
|
|
|
|
|
/// <param name="interruptClass">新的中断级别</param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
bool SetNodeInterrupt(string nodeGuid, InterruptClass interruptClass);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// 添加作用于某个对象的中断表达式
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="key"></param>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <param name="expression"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-09-26 21:00:17 +08:00
|
|
|
|
bool AddInterruptExpression(string key, string expression);
|
2024-10-15 10:55:41 +08:00
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// <summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// 监视指定对象
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// </summary>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="key">需要监视的对象</param>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// <param name="isMonitor">是否启用监视</param>
|
2024-09-26 21:00:17 +08:00
|
|
|
|
void SetMonitorObjState(string key,bool isMonitor);
|
2024-09-15 12:15:32 +08:00
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 检查一个对象是否处于监听状态,如果是,则传出与该对象相关的表达式(用于中断),如果不是,则返回false。
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="obj">判断的对象</param>
|
|
|
|
|
|
/// <param name="exps">表达式</param>
|
|
|
|
|
|
/// <returns></returns>
|
2024-09-26 21:00:17 +08:00
|
|
|
|
bool CheckObjMonitorState(string key, out List<string> exps);
|
2024-09-22 17:37:32 +08:00
|
|
|
|
|
|
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 全局中断
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="signal"></param>
|
|
|
|
|
|
/// <param name="interruptClass"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
Task<CancelType> GetOrCreateGlobalInterruptAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-10-15 10:55:41 +08:00
|
|
|
|
#region 远程相关
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// (适用于远程连接后获取环境的运行状态)获取当前环境的信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
object GetEnvInfo();
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
#endregion
|
2024-09-22 17:37:32 +08:00
|
|
|
|
|
2024-09-27 23:47:25 +08:00
|
|
|
|
#region 启动器调用
|
2024-09-22 17:37:32 +08:00
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// <summary>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
/// 流程启动器调用,监视数据更新通知
|
2024-09-22 14:10:13 +08:00
|
|
|
|
/// </summary>
|
2024-09-22 17:37:32 +08:00
|
|
|
|
/// <param name="nodeGuid">更新了数据的节点Guid</param>
|
2024-10-15 10:55:41 +08:00
|
|
|
|
/// <param name="monitorData">更新的数据</param>
|
|
|
|
|
|
/// <param name="sourceType">更新的数据</param>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
void MonitorObjectNotification(string nodeGuid, object monitorData, MonitorObjectEventArgs.ObjSourceType sourceType);
|
2024-09-22 17:37:32 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 流程启动器调用,节点触发了中断
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid">被中断的节点Guid</param>
|
|
|
|
|
|
/// <param name="expression">被触发的表达式</param>
|
|
|
|
|
|
/// <param name="type">中断类型。0主动监视,1表达式</param>
|
2024-09-24 22:39:43 +08:00
|
|
|
|
void TriggerInterrupt(string nodeGuid, string expression, InterruptTriggerEventArgs.InterruptTriggerType type);
|
2024-09-22 17:37:32 +08:00
|
|
|
|
|
2024-09-22 14:10:13 +08:00
|
|
|
|
|
2024-09-27 23:47:25 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region UI视觉
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 节点定位
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeGuid"></param>
|
|
|
|
|
|
void NodeLocated(string nodeGuid);
|
|
|
|
|
|
|
2024-09-24 22:39:43 +08:00
|
|
|
|
#endregion
|
2024-09-22 14:10:13 +08:00
|
|
|
|
}
|
2024-09-15 12:15:32 +08:00
|
|
|
|
}
|