尝试将节点流导出为c#代码文件

This commit is contained in:
fengjiayi
2025-07-06 14:34:49 +08:00
parent 162dc7bcf8
commit b25fd9c83c
45 changed files with 1625 additions and 361 deletions

View File

@@ -1,5 +1,6 @@
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using Serein.NodeFlow.Services;
using Serein.NodeFlow.Tool;
using System;
@@ -25,7 +26,7 @@ namespace Serein.NodeFlow.Model.Operation
/// <summary>
/// 执行操作
/// </summary>
bool Execute();
Task<bool> ExecuteAsync();
/// <summary>
/// 撤销操作
/// </summary>
@@ -46,6 +47,12 @@ namespace Serein.NodeFlow.Model.Operation
[AutoInjection]
protected FlowModelService flowModelService;
/// <summary>
/// 节点管理服务
/// </summary>
[AutoInjection]
protected UIContextOperation uiContextOperation;
/// <summary>
/// 流程依赖服务
/// </summary>
@@ -75,7 +82,7 @@ namespace Serein.NodeFlow.Model.Operation
/// <summary>
/// 执行
/// </summary>
public abstract bool Execute();
public abstract Task<bool> ExecuteAsync();
/// <summary>
/// 撤销
@@ -96,6 +103,23 @@ namespace Serein.NodeFlow.Model.Operation
public abstract void ToInfo();
protected async Task TriggerEvent(Action action)
{
/* if (OperatingSystem.IsWindows())
{
}*/
if (uiContextOperation is null)
{
action?.Invoke();
}
else
{
await uiContextOperation.InvokeAsync(() =>
{
action?.Invoke();
});
}
}
}