using Serein.Library.Api;
using Serein.Library.NodeGenerator;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Net.Mime;
using System.Threading;
namespace Serein.Library
{
///
/// 节点基类(数据):条件控件,动作控件,条件区域,动作区域
///
[NodeProperty(ValuePath = NodeValuePath.None)]
public abstract partial class NodeModelBase : IDynamicFlowNode
{
///
/// 节点运行环境
///
[PropertyInfo(IsProtection = true)]
private IFlowEnvironment _env;
///
/// 标识节点对象全局唯一
///
[PropertyInfo(IsProtection = true)]
private string _guid;
///
/// 描述节点对应的控件类型
///
[PropertyInfo(IsProtection = true)]
private NodeControlType _controlType;
///
/// 在画布中的位置
///
[PropertyInfo(IsProtection = true)]
private PositionOfUI _position ;
///
/// 显示名称
///
[PropertyInfo]
private string _displayName;
///
/// 是否为起点控件
///
[PropertyInfo]
private bool _isStart;
///
/// 附加的调试功能
///
[PropertyInfo(IsProtection = true)]
private NodeDebugSetting _debugSetting ;
///
/// 方法描述。不包含Method与委托,需要通过MethodName从环境中获取委托进行调用。
///
[PropertyInfo(IsProtection = true)]
private MethodDetails _methodDetails ;
///
/// 运行时的上一节点
///
//[PropertyInfo]
//private NodeModelBase _previousNode ;
///
/// 当前节点执行完毕后需要执行的下一个分支的类别
///
//[PropertyInfo]
//private ConnectionInvokeType _nextOrientation = ConnectionInvokeType.None;
///
/// 运行时的异常信息(仅在 FlowState 为 Error 时存在对应值)
///
[PropertyInfo]
private Exception _runingException ;
}
public abstract partial class NodeModelBase : IDynamicFlowNode
{
///
/// 实体节点创建完成后调用的方法,调用时间早于 LoadInfo() 方法
///
public abstract void OnCreating();
public NodeModelBase(IFlowEnvironment environment)
{
PreviousNodes = new Dictionary>();
SuccessorNodes = new Dictionary>();
foreach (ConnectionInvokeType ctType in NodeStaticConfig.ConnectionTypes)
{
PreviousNodes[ctType] = new List();
SuccessorNodes[ctType] = new List();
}
DebugSetting = new NodeDebugSetting(this);
this.Env = environment;
}
///
/// 不同分支的父节点
///
public Dictionary> PreviousNodes { get; }
///
/// 不同分支的子节点
///
public Dictionary> SuccessorNodes { get; }
}
}