流程上下文添加了调用信息记录

This commit is contained in:
fengjiayi
2025-07-28 17:38:51 +08:00
parent ccb8e49abc
commit 74961fa2c4
22 changed files with 480 additions and 144 deletions

View File

@@ -40,7 +40,6 @@ namespace Serein.NodeFlow.Model
return;
}
/// <summary>
/// 执行节点对应的方法
/// </summary>
@@ -50,7 +49,6 @@ namespace Serein.NodeFlow.Model
/// <returns>节点传回数据对象</returns>
public virtual async Task<FlowResult> ExecutingAsync(IFlowContext context, CancellationToken token)
{
// 执行触发检查是否需要中断
if (DebugSetting.IsInterrupt)
{

View File

@@ -25,6 +25,8 @@ namespace Serein.NodeFlow.Model
/// </summary>
public partial class SingleGlobalDataNode : NodeModelBase, INodeContainer
{
string INodeContainer.Guid => this.Guid;
/// <summary>
/// 全局数据节点是基础节点
/// </summary>
@@ -58,12 +60,13 @@ namespace Serein.NodeFlow.Model
DataNode = nodeModel;
return true;
}
else
else if (DataNode.Guid != nodeModel.Guid)
{
// 全局数据节点只有一个子控件
Env.FlowEdit.TakeOutNodeToContainer(DataNode.CanvasDetails.Guid, DataNode.Guid);
Env.FlowEdit.PlaceNodeToContainer(this.CanvasDetails.Guid, nodeModel.Guid, this.Guid);
return false;
}
return false;
}

View File

@@ -78,21 +78,29 @@ namespace Serein.NodeFlow.Model.Operation
public override async Task<bool> ExecuteAsync()
{
if (!ValidationParameter()) return false;
ContainerNode.PlaceNode(Node);
await TriggerEvent(() =>
var isSuccess = ContainerNode.PlaceNode(Node);
if(isSuccess is true)
{
flowEnvironmentEvent.OnNodePlace(new NodePlaceEventArgs(CanvasGuid, NodeGuid, ContainerNodeGuid)); // 通知UI更改节点放置位置
});
return true;
await TriggerEvent(() =>
{
flowEnvironmentEvent.OnNodePlace(new NodePlaceEventArgs(CanvasGuid, NodeGuid, ContainerNodeGuid)); // 通知UI更改节点放置位置
});
}
return isSuccess;
}
public override bool Undo()
{
ContainerNode.TakeOutNode(Node);
flowEnvironmentEvent.OnNodeTakeOut(new NodeTakeOutEventArgs(CanvasGuid, NodeGuid)); // 重新放置在画布上
return true;
var isSuccess = ContainerNode.TakeOutNode(Node);
if (isSuccess is true)
{
_ = TriggerEvent(() =>
{
// 取出节点,重新放置在画布上
flowEnvironmentEvent.OnNodeTakeOut(new NodeTakeOutEventArgs(CanvasGuid, ContainerNode.Guid, NodeGuid));
});
}
return isSuccess;
}

View File

@@ -65,23 +65,29 @@ namespace Serein.NodeFlow.Model.Operation
{
if (!ValidationParameter()) return false;
ContainerNode.TakeOutNode(Node);
await TriggerEvent(() =>
var isSuccess = ContainerNode.TakeOutNode(Node);
if (isSuccess is true)
{
flowEnvironmentEvent.OnNodeTakeOut(new NodeTakeOutEventArgs(CanvasGuid, NodeGuid)); // 重新放置在画布上
});
return true;
await TriggerEvent(() =>
{
// 取出节点,重新放置在画布上
flowEnvironmentEvent.OnNodeTakeOut(new NodeTakeOutEventArgs(CanvasGuid, ContainerNode.Guid, NodeGuid));
});
}
return isSuccess;
}
public override bool Undo()
{
ContainerNode.PlaceNode(Node);
if (ContainerNode is IFlowNode containerFlowNode)
var isSuccess = ContainerNode.PlaceNode(Node);
if (isSuccess is true)
{
flowEnvironmentEvent.OnNodePlace(new NodePlaceEventArgs(CanvasGuid, NodeGuid, containerFlowNode.Guid)); // 通知UI更改节点放置位置
if (ContainerNode is IFlowNode containerFlowNode)
{
flowEnvironmentEvent.OnNodePlace(new NodePlaceEventArgs(CanvasGuid, NodeGuid, containerFlowNode.Guid)); // 通知UI更改节点放置位置
}
}
return true;
return isSuccess;
}