using Newtonsoft.Json.Linq;
using Serein.Library;
using Serein.Library.Api;
using Serein.Library.Utils;
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Serein.NodeFlow.Model
{
///
/// Expression Operation - 表达式操作
///
[NodeProperty(ValuePath = NodeValuePath.Node)]
public partial class SingleGlobalDataNode : NodeModelBase
{
///
/// 表达式
///
[PropertyInfo(IsNotification = true, CustomCodeAtStart = "ChangeName(value);")]
private string _keyName;
}
///
/// 全局数据节点
///
public partial class SingleGlobalDataNode : NodeModelBase, INodeContainer
{
///
/// 全局数据节点是基础节点
///
public override bool IsBase => true;
///
/// 数据源只允许放置1个节点。
///
public override int MaxChildrenCount => 1;
public SingleGlobalDataNode(IFlowEnvironment environment) : base(environment)
{
}
///
/// 数据来源的节点
///
private NodeModelBase? DataNode;
public void PlaceNode(NodeModelBase nodeModel)
{
_ = this.Env.RemoveNodeAsync(DataNode?.Guid);
DataNode = nodeModel;
}
public void TakeOutAll()
{
DataNode = null;
}
public void TakeOutNode(NodeModelBase nodeModel)
{
DataNode = null;
}
///
/// 设置数据节点
///
///
//public void SetDataNode(NodeModelBase dataNode)
//{
// DataNodeGuid = dataNode.Guid;
//}
private void ChangeName(string newName)
{
if(SereinEnv.GetFlowGlobalData(_keyName) == null)
{
return;
}
SereinEnv.ChangeNameFlowGlobalData(_keyName, newName);
}
///
/// 设置全局数据
///
///
///
public override async Task