mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
移除了中断相关的后台代码与UI交互(待重写);重写运行时节点获取参数的方法;重写了节点容器的互动;完善了WebSocket远程交互;完善了项目文件的加载;
This commit is contained in:
@@ -14,14 +14,5 @@ namespace Serein.NodeFlow.Model
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行方法
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public override Task<object> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
return base.ExecutingAsync(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Serein.Library.Api;
|
||||
using Serein.Library;
|
||||
using Serein.Library.Utils;
|
||||
using static Serein.Library.Utils.ChannelFlowInterrupt;
|
||||
|
||||
namespace Serein.NodeFlow.Model
|
||||
{
|
||||
@@ -28,8 +27,8 @@ namespace Serein.NodeFlow.Model
|
||||
if (DebugSetting.IsInterrupt) // 执行触发前
|
||||
{
|
||||
string guid = this.Guid.ToString();
|
||||
var cancelType = await this.DebugSetting.GetInterruptTask();
|
||||
await Console.Out.WriteLineAsync($"[{this.MethodDetails.MethodName}]中断已{cancelType},开始执行后继分支");
|
||||
await this.DebugSetting.GetInterruptTask();
|
||||
await Console.Out.WriteLineAsync($"[{this.MethodDetails.MethodName}]中断已取消,开始执行后继分支");
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -40,7 +39,7 @@ namespace Serein.NodeFlow.Model
|
||||
}
|
||||
object instance = md.ActingInstance;
|
||||
|
||||
var args = await GetParametersAsync(context, this);
|
||||
var args = await GetParametersAsync(context);
|
||||
// 因为这里会返回不确定的泛型 IFlipflopContext<TRsult>
|
||||
// 而我们只需要获取到 State 和 Value(返回的数据)
|
||||
// 所以使用 dynamic 类型接收
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Serein.NodeFlow.Model
|
||||
/// <summary>
|
||||
/// 表达式
|
||||
/// </summary>
|
||||
[PropertyInfo(IsNotification = true, CustomCodeAtStart = "ChangeName(value);")]
|
||||
[PropertyInfo(IsNotification = true, CustomCodeAtStart = "// ChangeName(value);")]
|
||||
private string _keyName;
|
||||
|
||||
}
|
||||
@@ -52,42 +52,51 @@ namespace Serein.NodeFlow.Model
|
||||
private NodeModelBase? DataNode;
|
||||
|
||||
|
||||
public void PlaceNode(NodeModelBase nodeModel)
|
||||
public bool PlaceNode(NodeModelBase nodeModel)
|
||||
{
|
||||
// 全局数据节点只有一个子控件
|
||||
if (DataNode is not null)
|
||||
if(DataNode is null)
|
||||
{
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
await this.Env.RemoveNodeAsync(DataNode?.Guid);
|
||||
DataNode = nodeModel;
|
||||
});
|
||||
// 放置节点
|
||||
nodeModel.ContainerNode = this;
|
||||
ChildrenNode.Add(nodeModel);
|
||||
DataNode = nodeModel;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DataNode = nodeModel;
|
||||
// 全局数据节点只有一个子控件
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void TakeOutAll()
|
||||
|
||||
public bool TakeOutNode(NodeModelBase nodeModel)
|
||||
{
|
||||
if (ChildrenNode.Contains(nodeModel))
|
||||
{
|
||||
ChildrenNode.Remove(nodeModel);
|
||||
nodeModel.ContainerNode = null;
|
||||
DataNode = null;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public async void TakeOutAll()
|
||||
{
|
||||
foreach (var nodeModel in ChildrenNode)
|
||||
{
|
||||
await nodeModel.Env.TakeOutNodeToContainerAsync(nodeModel.Guid);
|
||||
}
|
||||
DataNode = null;
|
||||
}
|
||||
|
||||
public void TakeOutNode(NodeModelBase nodeModel)
|
||||
{
|
||||
DataNode = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置数据节点
|
||||
/// </summary>
|
||||
/// <param name="dataNode"></param>
|
||||
//public void SetDataNode(NodeModelBase dataNode)
|
||||
//{
|
||||
// DataNodeGuid = dataNode.Guid;
|
||||
//}
|
||||
|
||||
private void ChangeName(string newName)
|
||||
{
|
||||
if(SereinEnv.GetFlowGlobalData(_keyName) == null)
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace Serein.NodeFlow.Model
|
||||
/// <returns></returns>
|
||||
public override async Task<object?> ExecutingAsync(IDynamicContext context)
|
||||
{
|
||||
var @params = await NodeModelBase.GetParametersAsync(context, this);
|
||||
var @params = await GetParametersAsync(context);
|
||||
ScriptFlowApi.Context= context;
|
||||
context.AddOrUpdate($"{context.Guid}_{this.Guid}_Params", @params[0]); // 后面再改
|
||||
|
||||
|
||||
Reference in New Issue
Block a user