diff --git a/FlowStartTool/FlowEnv.cs b/FlowStartTool/FlowEnv.cs
index ad624e2..aa68123 100644
--- a/FlowStartTool/FlowEnv.cs
+++ b/FlowStartTool/FlowEnv.cs
@@ -14,7 +14,7 @@ namespace Serein.FlowStartTool
{
public readonly IFlowEnvironment flowEnvironment = new FlowEnvironment();
public bool IsRuning;
- public async Task StartFlow(SereinProjectData flowProjectData, string fileDataPath)
+ public void StartFlow(SereinProjectData flowProjectData, string fileDataPath)
{
IsRuning = true;
SynchronizationContext? uiContext = SynchronizationContext.Current; // 在UI线程上获取UI线程上下文信息
diff --git a/Library/Api/IEnumConvertor.cs b/Library/Api/IEnumConvertor.cs
index d900d9b..4f64e6c 100644
--- a/Library/Api/IEnumConvertor.cs
+++ b/Library/Api/IEnumConvertor.cs
@@ -7,6 +7,11 @@
///
public interface IEnumConvertor
{
+ ///
+ /// 将枚举值转换为指定类型的值
+ ///
+ ///
+ ///
TValue Convertor(TEnum e);
}
diff --git a/Library/Api/IFlowContext.cs b/Library/Api/IFlowContext.cs
index 2645b0a..3f2ffaa 100644
--- a/Library/Api/IFlowContext.cs
+++ b/Library/Api/IFlowContext.cs
@@ -252,11 +252,20 @@ namespace Serein.Library.Api
///
public string Result { get; private set; }
+ ///
+ /// 上传当前节点的执行状态和结果信息。
+ ///
+ ///
public void UploadState(RunState runState)
{
State = runState;
TS = DateTime.Now - StateTime;
}
+
+ ///
+ /// 上传当前节点的执行结果值。
+ ///
+ ///
public void UploadResultValue(object value = null)
{
if(value is null)
@@ -269,6 +278,11 @@ namespace Serein.Library.Api
Result = $"{type.FullName}::{value}";
}
}
+
+ ///
+ /// 上传当前节点的执行参数信息。
+ ///
+ ///
public void UploadParameters(object[] values = null)
{
if (values is null)
@@ -282,6 +296,10 @@ namespace Serein.Library.Api
}
}
+ ///
+ /// 返回当前节点的执行信息字符串,包含状态、耗时和结果。
+ ///
+ ///
public override string ToString()
{
return $"[{State}]{TS.TotalSeconds:0.000}ms : {Result}";
diff --git a/Library/Api/IFlowControl.cs b/Library/Api/IFlowControl.cs
index 3031921..65494fa 100644
--- a/Library/Api/IFlowControl.cs
+++ b/Library/Api/IFlowControl.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
namespace Serein.Library.Api
{
+#nullable enable
///
/// 流程运行接口
///
@@ -24,7 +25,7 @@ namespace Serein.Library.Api
///
///
/// 用于每次启动时,重置IOC后默认注册某些类型
- void UseExternalIOC(ISereinIOC ioc, Action setDefultMemberOnReset = null);
+ void UseExternalIOC(ISereinIOC ioc, Action? setDefultMemberOnReset = null);
///
/// 开始运行流程
diff --git a/Library/Api/IFlowEnvironment.cs b/Library/Api/IFlowEnvironment.cs
index d8eaa04..94e0cbc 100644
--- a/Library/Api/IFlowEnvironment.cs
+++ b/Library/Api/IFlowEnvironment.cs
@@ -153,6 +153,9 @@ namespace Serein.Library.Api
///
public class ProjectLoadedEventArgs : FlowEventArgs
{
+ ///
+ /// 项目加载完成事件参数
+ ///
public ProjectLoadedEventArgs()
{
}
@@ -163,6 +166,10 @@ namespace Serein.Library.Api
///
public class ProjectSavingEventArgs : FlowEventArgs
{
+ ///
+ /// 项目保存事件参数
+ ///
+ ///
public ProjectSavingEventArgs(SereinProjectData projectData)
{
ProjectData = projectData;
@@ -179,6 +186,10 @@ namespace Serein.Library.Api
///
public class LoadDllEventArgs : FlowEventArgs
{
+ ///
+ /// 加载了DLL外部依赖事件参数
+ ///
+ ///
public LoadDllEventArgs(FlowLibraryInfo nodeLibraryInfo)
{
this.NodeLibraryInfo = nodeLibraryInfo;
@@ -194,6 +205,9 @@ namespace Serein.Library.Api
///
public class RemoteDllEventArgs : FlowEventArgs
{
+ ///
+ /// 移除了DLL外部依赖事件参数
+ ///
public RemoteDllEventArgs()
{
}
@@ -270,6 +284,9 @@ namespace Serein.Library.Api
}
+ ///
+ /// 连接关系所在的画布Guid
+ ///
public string CanvasGuid { get; }
///
@@ -309,11 +326,18 @@ namespace Serein.Library.Api
///
public class CanvasCreateEventArgs : FlowEventArgs
{
+ ///
+ /// 画布添加事件参数
+ ///
+ ///
public CanvasCreateEventArgs(FlowCanvasDetails model)
{
Model = model;
}
+ ///
+ /// 画布
+ ///
public FlowCanvasDetails Model { get; }
}
@@ -322,11 +346,18 @@ namespace Serein.Library.Api
///
public class CanvasRemoveEventArgs : FlowEventArgs
{
+ ///
+ /// 画布移除事件参数
+ ///
+ ///
public CanvasRemoveEventArgs(string canvasGuid)
{
CanvasGuid = canvasGuid;
}
+ ///
+ /// 所处画布Guid
+ ///
public string CanvasGuid { get; }
}
@@ -360,10 +391,6 @@ namespace Serein.Library.Api
/// 在UI上的位置
///
public PositionOfUI Position { get; private set; }
- ///
- /// 容器
- ///
- //public string RegeionGuid { get; private set; }
}
///
@@ -371,12 +398,20 @@ namespace Serein.Library.Api
///
public class NodeRemoveEventArgs : FlowEventArgs
{
+ ///
+ /// 被移除节点事件参数
+ ///
+ ///
+ ///
public NodeRemoveEventArgs(string canvasGuid, string nodeGuid)
{
CanvasGuid = canvasGuid;
this.NodeGuid = nodeGuid;
}
+ ///
+ /// 被移除节点所在的画布Guid
+ ///
public string CanvasGuid { get; }
///
@@ -390,6 +425,12 @@ namespace Serein.Library.Api
///
public class NodePlaceEventArgs : FlowEventArgs
{
+ ///
+ /// 节点放置事件参数
+ ///
+ ///
+ ///
+ ///
public NodePlaceEventArgs(string canvasGuid, string nodeGuid, string containerNodeGuid)
{
CanvasGuid = canvasGuid;
@@ -397,6 +438,9 @@ namespace Serein.Library.Api
ContainerNodeGuid = containerNodeGuid;
}
+ ///
+ /// 画布Guid
+ ///
public string CanvasGuid { get; }
///
@@ -414,6 +458,12 @@ namespace Serein.Library.Api
///
public class NodeTakeOutEventArgs : FlowEventArgs
{
+ ///
+ /// 节点取出事件参数
+ ///
+ ///
+ ///
+ ///
public NodeTakeOutEventArgs(string canvasGuid, string containerNodeGuid, string nodeGuid)
{
CanvasGuid = canvasGuid;
@@ -421,6 +471,9 @@ namespace Serein.Library.Api
ContainerNodeGuid = containerNodeGuid;
}
+ ///
+ /// 所在画布Guid
+ ///
public string CanvasGuid { get; }
///
@@ -438,9 +491,17 @@ namespace Serein.Library.Api
-
+ ///
+ /// 起始节点发生了变化
+ ///
public class StartNodeChangeEventArgs : FlowEventArgs
{
+ ///
+ /// 起始节点发生了变化事件参数
+ ///
+ ///
+ ///
+ ///
public StartNodeChangeEventArgs(string canvasGuid, string oldNodeGuid, string newNodeGuid)
{
CanvasGuid = canvasGuid;
@@ -448,6 +509,9 @@ namespace Serein.Library.Api
this.NewNodeGuid = newNodeGuid; ;
}
+ ///
+ /// 所在画布Guid
+ ///
public string CanvasGuid { get; }
///
@@ -515,6 +579,11 @@ namespace Serein.Library.Api
///
public class NodeInterruptStateChangeEventArgs : FlowEventArgs
{
+ ///
+ /// 节点中断状态改变事件参数
+ ///
+ ///
+ ///
public NodeInterruptStateChangeEventArgs(string nodeGuid,bool isInterrupt)
{
NodeGuid = nodeGuid;
@@ -526,14 +595,19 @@ namespace Serein.Library.Api
/// 中断的节点Guid
///
public string NodeGuid { get;}
+ ///
+ /// 是否中断
+ ///
public bool IsInterrupt { get;}
- // public InterruptClass Class { get;}
}
///
/// 节点触发了中断事件参数
///
public class InterruptTriggerEventArgs : FlowEventArgs
{
+ ///
+ /// 中断触发类型
+ ///
public enum InterruptTriggerType
{
///
@@ -550,6 +624,12 @@ namespace Serein.Library.Api
Obj,
}
+ ///
+ /// 中断触发事件参数
+ ///
+ ///
+ ///
+ ///
public InterruptTriggerEventArgs(string nodeGuid, string expression, InterruptTriggerType type)
{
this.NodeGuid = nodeGuid;
@@ -561,7 +641,13 @@ namespace Serein.Library.Api
/// 中断的节点Guid
///
public string NodeGuid { get;}
+ ///
+ /// 被触发的表达式
+ ///
public string Expression { get;}
+ ///
+ /// 中断触发类型
+ ///
public InterruptTriggerType Type { get;}
}
@@ -572,6 +658,9 @@ namespace Serein.Library.Api
///
public class IOCMembersChangedEventArgs : FlowEventArgs
{
+ ///
+ /// IOC成员发生改变的事件类型
+ ///
public enum EventType
{
///
@@ -583,12 +672,23 @@ namespace Serein.Library.Api
///
Completeuild,
}
+ ///
+ /// IOC成员发生改变事件参数
+ ///
+ ///
+ ///
public IOCMembersChangedEventArgs(string key, object instance)
{
this.Key = key;
this.Instance = instance;
}
+ ///
+ /// IOC成员发生改变事件参数
+ ///
public string Key { get; private set; }
+ ///
+ /// IOC成员发生改变事件参数
+ ///
public object Instance { get; private set; }
}
@@ -597,38 +697,20 @@ namespace Serein.Library.Api
///
public class NodeLocatedEventArgs : FlowEventArgs
{
+ ///
+ /// 节点需要定位事件参数
+ ///
+ ///
public NodeLocatedEventArgs(string nodeGuid)
{
NodeGuid = nodeGuid;
}
+ ///
+ /// 节点需要定位事件参数
+ ///
public string NodeGuid { get; private set; }
}
-/* ///
- /// 节点移动了
- ///
- public class NodeMovedEventArgs : FlowEventArgs
- {
- public NodeMovedEventArgs(string nodeGuid, double x, double y)
- {
- this.NodeGuid = nodeGuid;
- this.X = x;
- this.Y = y;
- }
- ///
- /// 节点唯一标识
- ///
- public string NodeGuid { get; private set; }
- ///
- /// 画布上的x坐标
- ///
- public double X { get; private set; }
- ///
- /// 画布上的y坐标
- ///
- public double Y { get; private set; }
- }*/
-
#endregion
@@ -729,23 +811,113 @@ namespace Serein.Library.Api
///
event EnvOutHandler EnvOutput;
+ ///
+ /// 加载了DLL外部依赖事件
+ ///
+ ///
public void OnDllLoad(LoadDllEventArgs eventArgs);
+
+ ///
+ /// 项目加载完成事件
+ ///
+ ///
public void OnProjectLoaded(ProjectLoadedEventArgs eventArgs);
+
+ ///
+ /// 项目准备保存事件
+ ///
+ ///
public void OnProjectSaving(ProjectSavingEventArgs eventArgs);
+
+ ///
+ /// 节点连接关系发生改变事件
+ ///
+ ///
public void OnNodeConnectChanged(NodeConnectChangeEventArgs eventArgs);
+
+ ///
+ /// 画布创建事件
+ ///
+ ///
public void OnCanvasCreated(CanvasCreateEventArgs eventArgs);
+
+ ///
+ /// 画布移除事件
+ ///
+ ///
public void OnCanvasRemoved(CanvasRemoveEventArgs eventArgs);
+
+ ///
+ /// 节点创建事件
+ ///
+ ///
public void OnNodeCreated(NodeCreateEventArgs eventArgs);
+
+ ///
+ /// 节点移除事件
+ ///
+ ///
public void OnNodeRemoved(NodeRemoveEventArgs eventArgs);
+
+ ///
+ /// 节点放置事件
+ ///
+ ///
public void OnNodePlace(NodePlaceEventArgs eventArgs);
+
+ ///
+ /// 节点取出事件
+ ///
+ ///
public void OnNodeTakeOut(NodeTakeOutEventArgs eventArgs);
+
+ ///
+ /// 起始节点发生了变化事件
+ ///
+ ///
public void OnStartNodeChanged(StartNodeChangeEventArgs eventArgs);
+
+ ///
+ /// 流程运行完成事件
+ ///
+ ///
public void OnFlowRunComplete(FlowEventArgs eventArgs);
+
+ ///
+ /// 被监视的对象发生了改变事件
+ ///
+ ///
public void OnMonitorObjectChanged(MonitorObjectEventArgs eventArgs);
+
+ ///
+ /// 节点中断状态发生了改变事件(开启了中断/取消了中断)
+ ///
+ ///
public void OnNodeInterruptStateChanged(NodeInterruptStateChangeEventArgs eventArgs);
+
+ ///
+ /// 触发了中断事件
+ ///
+ ///
public void OnInterruptTriggered(InterruptTriggerEventArgs eventArgs);
+
+ ///
+ /// IOC容器成员发生了改变事件
+ ///
+ ///
public void OnIOCMembersChanged(IOCMembersChangedEventArgs eventArgs);
+
+ ///
+ /// 节点需要定位事件
+ ///
+ ///
public void OnNodeLocated(NodeLocatedEventArgs eventArgs);
+
+ ///
+ /// 环境输出信息事件
+ ///
+ ///
+ ///
public void OnEnvOutput(InfoType type, string value);
}
@@ -864,7 +1036,7 @@ namespace Serein.Library.Api
/// 获取当前项目信息
///
///
- Task GetProjectInfoAsync();
+ SereinProjectData GetProjectInfoAsync();
#endregion
diff --git a/Library/Api/IFlowNode.cs b/Library/Api/IFlowNode.cs
index 9987c12..7e3530b 100644
--- a/Library/Api/IFlowNode.cs
+++ b/Library/Api/IFlowNode.cs
@@ -1,12 +1,7 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.ComponentModel;
-using System.Linq;
-using System.Text;
using System.Threading;
using System.Threading.Tasks;
-using System.Threading.Tasks;
-using Serein.Library;
namespace Serein.Library.Api
{
@@ -72,11 +67,11 @@ namespace Serein.Library.Api
MethodDetails MethodDetails { get; set; }
///
- /// 父节点集合
+ /// 前继节点集合
///
Dictionary> PreviousNodes { get;}
///
- /// 子节点集合
+ /// 后继节点集合
///
Dictionary> SuccessorNodes { get; set; }
diff --git a/Library/Api/IJsonProvider.cs b/Library/Api/IJsonProvider.cs
index 421d413..203455e 100644
--- a/Library/Api/IJsonProvider.cs
+++ b/Library/Api/IJsonProvider.cs
@@ -118,14 +118,14 @@ namespace Serein.Library.Api
///
///
///
- IJsonToken CreateObject(IDictionary values = null);
+ IJsonToken CreateObject(IDictionary? values = null);
///
/// 创建数组
///
///
///
- IJsonToken CreateArray(IEnumerable