新增了UI节点

This commit is contained in:
fengjiayi
2025-03-14 16:04:06 +08:00
parent 8f8644f595
commit ef11edf7f1
45 changed files with 1032 additions and 41 deletions

View File

@@ -43,6 +43,8 @@ namespace Serein.NodeFlow.Env
this.FlowLibraryManagement = new FlowLibraryManagement(this); // 实例化类库管理
#region
NodeMVVMManagement.RegisterModel(NodeControlType.UI, typeof(SingleUINode)); // 动作节点
NodeMVVMManagement.RegisterModel(NodeControlType.Action, typeof(SingleActionNode)); // 动作节点
NodeMVVMManagement.RegisterModel(NodeControlType.Flipflop, typeof(SingleFlipflopNode)); // 触发器节点
NodeMVVMManagement.RegisterModel(NodeControlType.ExpOp, typeof(SingleExpOpNode)); // 表达式节点

View File

@@ -39,8 +39,6 @@ namespace Serein.NodeFlow.Env
await SendCommandFunc.Invoke(msgId, theme, data);
}
/// <summary>
/// 发送请求
/// </summary>

View File

@@ -33,7 +33,6 @@ namespace Serein.NodeFlow.Env
});
}
//private readonly Func<string, object?, Task> SendCommandAsync;
private readonly RemoteMsgUtil RemoteMsgUtil;
private readonly MsgControllerOfClient msgClient;
private readonly ConcurrentDictionary<string, MethodDetails> MethodDetailss = [];
@@ -46,9 +45,6 @@ namespace Serein.NodeFlow.Env
public event LoadDllHandler OnDllLoad;
public event ProjectLoadedHandler OnProjectLoaded;
/// <summary>
/// 项目准备保存
/// </summary>
public event ProjectSavingHandler? OnProjectSaving;
public event NodeConnectChangeHandler OnNodeConnectChange;
public event NodeCreateHandler OnNodeCreate;
@@ -93,14 +89,7 @@ namespace Serein.NodeFlow.Env
/// </summary>
private bool IsLoadingNode = false;
//public void SetConsoleOut()
//{
// var logTextWriter = new LogTextWriter(msg =>
// {
// OnEnvOut?.Invoke(msg);
// });
// Console.SetOut(logTextWriter);
//}
/// <summary>
/// 输出信息
@@ -454,6 +443,7 @@ namespace Serein.NodeFlow.Env
/// <returns>被设置为起始节点的Guid</returns>
public async Task<string> SetStartNodeAsync(string nodeGuid)
{
var newNodeGuid = await msgClient.SendAndWaitDataAsync<string>(EnvMsgTheme.SetStartNode, new
{
nodeGuid

View File

@@ -0,0 +1,44 @@
using Serein.Library;
using Serein.Library.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Serein.NodeFlow.Model
{
public class SingleUINode : NodeModelBase
{
public IEmbeddedContent Adapter { get; private set; }
public SingleUINode(IFlowEnvironment environment) : base(environment)
{
}
public override async Task<object> ExecutingAsync(IDynamicContext context)
{
if(Adapter is null)
{
var result = await base.ExecutingAsync(context);
if (result is IEmbeddedContent adapter)
{
this.Adapter = adapter;
context.NextOrientation = ConnectionInvokeType.IsSucceed;
}
else
{
context.NextOrientation = ConnectionInvokeType.IsError;
}
}
else
{
var p = context.GetPreviousNode(this);
var data = context.GetFlowData(p.Guid);
Adapter.GetFlowControl().OnExecuting(data);
}
return Task.FromResult<object?>(null);
}
}
}

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Version>1.1.0</Version>
<Version>1.1.1</Version>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>