mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-05 15:56:33 +08:00
添加画布信息视图
This commit is contained in:
@@ -65,16 +65,6 @@ namespace Serein.Library
|
||||
}
|
||||
|
||||
|
||||
|
||||
class UserInfo
|
||||
{
|
||||
public string Name;
|
||||
public int Id;
|
||||
public string[] PhoneNums;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 生成的节点控件
|
||||
@@ -109,11 +99,7 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
[Description("base")]
|
||||
ExpCondition,
|
||||
/// <summary>
|
||||
/// 条件节点区域
|
||||
/// </summary>
|
||||
[Description("base")]
|
||||
ConditionRegion,
|
||||
|
||||
/// <summary>
|
||||
/// 全局数据
|
||||
/// </summary>
|
||||
@@ -129,6 +115,15 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
[Description("base")]
|
||||
NetScript,
|
||||
|
||||
/// <summary>
|
||||
/// 流程调用节点(流程图公开的节点)
|
||||
/// </summary>
|
||||
[Description("base")]
|
||||
FlowCall,
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -93,7 +93,6 @@ namespace Serein.Library
|
||||
public static NodeInfo ToInfo(this NodeModelBase nodeModel)
|
||||
{
|
||||
// if (MethodDetails == null) return null;
|
||||
|
||||
var trueNodes = nodeModel.SuccessorNodes[ConnectionInvokeType.IsSucceed].Select(item => item.Guid); // 真分支
|
||||
var falseNodes = nodeModel.SuccessorNodes[ConnectionInvokeType.IsFail].Select(item => item.Guid);// 假分支
|
||||
var errorNodes = nodeModel.SuccessorNodes[ConnectionInvokeType.IsError].Select(item => item.Guid);// 异常分支
|
||||
@@ -103,8 +102,9 @@ namespace Serein.Library
|
||||
|
||||
var nodeInfo = new NodeInfo
|
||||
{
|
||||
CanvasGuid = nodeModel.CanvasGuid,
|
||||
CanvasGuid = nodeModel.CanvasDetails.Guid,
|
||||
Guid = nodeModel.Guid,
|
||||
IsPublic = nodeModel.IsPublic,
|
||||
AssemblyName = nodeModel.MethodDetails.AssemblyName,
|
||||
MethodName = nodeModel.MethodDetails?.MethodName,
|
||||
Label = nodeModel.MethodDetails?.MethodAnotherName,
|
||||
@@ -131,18 +131,18 @@ namespace Serein.Library
|
||||
/// 从节点信息加载节点
|
||||
/// </summary>
|
||||
/// <param name="nodeModel"></param>
|
||||
/// <param name="canvas"></param>
|
||||
/// <param name="nodeInfo"></param>
|
||||
/// <returns></returns>
|
||||
public static void LoadInfo(this NodeModelBase nodeModel, NodeInfo nodeInfo)
|
||||
{
|
||||
nodeModel.CanvasGuid = nodeInfo.CanvasGuid;
|
||||
nodeModel.Guid = nodeInfo.Guid;
|
||||
nodeModel.Position = nodeInfo.Position ?? new PositionOfUI(0, 0);// 加载位置信息
|
||||
var md = nodeModel.MethodDetails; // 当前节点的方法说明
|
||||
nodeModel.MethodDetails.IsProtectionParameter = nodeInfo.IsProtectionParameter; // 保护参数
|
||||
nodeModel.DebugSetting.IsInterrupt = nodeInfo.IsInterrupt; // 是否中断
|
||||
nodeModel.DebugSetting.IsEnable = nodeInfo.IsEnable; // 是否使能
|
||||
|
||||
nodeModel.IsPublic = nodeInfo.IsPublic; // 是否全局公开
|
||||
if (md != null)
|
||||
{
|
||||
if (md.ParameterDetailss == null)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Serein.Library.FlowNode;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -27,9 +28,21 @@ namespace Serein.Library
|
||||
public IFlowEnvironment Env { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 标识画布ID
|
||||
/// 画布拥有的节点
|
||||
/// </summary>
|
||||
[PropertyInfo(IsProtection = true)]
|
||||
private System.Collections.ObjectModel.ObservableCollection<NodeModelBase> _nodes = [];
|
||||
|
||||
/// <summary>
|
||||
/// 画布公开的节点
|
||||
/// </summary>
|
||||
[PropertyInfo(IsProtection = true)]
|
||||
private System.Collections.ObjectModel.ObservableCollection<NodeModelBase> _publicNodes = [];
|
||||
|
||||
/// <summary>
|
||||
/// 标识画布ID
|
||||
/// </summary>
|
||||
[PropertyInfo(IsProtection = false)]
|
||||
private string _guid;
|
||||
|
||||
/// <summary>
|
||||
@@ -54,19 +67,19 @@ namespace Serein.Library
|
||||
/// 预览位置X
|
||||
/// </summary>
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private double _viewX ;
|
||||
private double _viewX;
|
||||
|
||||
/// <summary>
|
||||
/// 预览位置Y
|
||||
/// </summary>
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private double _viewY ;
|
||||
private double _viewY;
|
||||
|
||||
/// <summary>
|
||||
/// 缩放比例X
|
||||
/// </summary>
|
||||
[PropertyInfo(IsNotification = true)]
|
||||
private double _scaleX = 1;
|
||||
private double _scaleX = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 缩放比例Y
|
||||
@@ -85,7 +98,7 @@ namespace Serein.Library
|
||||
|
||||
public partial class FlowCanvasDetails
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Serein.Library
|
||||
/// <summary>
|
||||
/// 节点基类(数据)
|
||||
/// </summary>
|
||||
[NodeProperty(ValuePath = NodeValuePath.None)]
|
||||
[NodeProperty(ValuePath = NodeValuePath.Node)]
|
||||
public abstract partial class NodeModelBase : IDynamicFlowNode
|
||||
{
|
||||
/// <summary>
|
||||
@@ -35,13 +35,11 @@ namespace Serein.Library
|
||||
[PropertyInfo(IsProtection = true)]
|
||||
private NodeControlType _controlType;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 所属画布
|
||||
/// </summary>
|
||||
[PropertyInfo(IsProtection = true)]
|
||||
private string _canvasGuid ;
|
||||
|
||||
[PropertyInfo(IsProtection = true)]
|
||||
private FlowCanvasDetails _canvasDetails ;
|
||||
|
||||
/// <summary>
|
||||
/// 在画布中的位置
|
||||
@@ -56,10 +54,10 @@ namespace Serein.Library
|
||||
private string _displayName;
|
||||
|
||||
/// <summary>
|
||||
/// 是否为起点控件
|
||||
/// 是否公开
|
||||
/// </summary>
|
||||
[PropertyInfo]
|
||||
private bool _isStart;
|
||||
[PropertyInfo(IsNotification = true, CustomCodeAtEnd = "NodePublicStateChanged();")]
|
||||
private bool _isPublic;
|
||||
|
||||
/// <summary>
|
||||
/// 附加的调试功能
|
||||
@@ -68,7 +66,7 @@ namespace Serein.Library
|
||||
private NodeDebugSetting _debugSetting ;
|
||||
|
||||
/// <summary>
|
||||
/// 方法描述。不包含Method与委托,需要通过MethodName从环境中获取委托进行调用。
|
||||
/// 方法描述。包含参数信息。不包含Method与委托,如若需要调用对应的方法,需要通过MethodName从环境中获取委托进行调用。
|
||||
/// </summary>
|
||||
[PropertyInfo(IsProtection = true)]
|
||||
private MethodDetails _methodDetails ;
|
||||
@@ -122,7 +120,29 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
public List<NodeModelBase> ChildrenNode { get; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 节点公开状态发生改变
|
||||
/// </summary>
|
||||
private void NodePublicStateChanged()
|
||||
{
|
||||
|
||||
if (IsPublic)
|
||||
{
|
||||
// 公开节点
|
||||
if (!CanvasDetails.PublicNodes.Contains(this))
|
||||
{
|
||||
CanvasDetails.PublicNodes.Add(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 取消公开
|
||||
if (CanvasDetails.PublicNodes.Contains(this))
|
||||
{
|
||||
CanvasDetails.PublicNodes.Remove(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Serein.Library
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 节点基类(数据):条件控件,动作控件,条件区域,动作区域
|
||||
/// 节点基类
|
||||
/// </summary>
|
||||
public abstract partial class NodeModelBase : IDynamicFlowNode
|
||||
{
|
||||
|
||||
@@ -197,6 +197,11 @@ namespace Serein.Library
|
||||
/// </summary>
|
||||
public string Guid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否全局公开
|
||||
/// </summary>
|
||||
public bool IsPublic { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 节点方法所属的程序集名称
|
||||
/// </summary>
|
||||
|
||||
@@ -24,12 +24,15 @@
|
||||
<ItemGroup>
|
||||
<Compile Remove="Entity\Base\**" />
|
||||
<Compile Remove="Http\**" />
|
||||
<Compile Remove="Network\Socket\**" />
|
||||
<Compile Remove="Utils\SerinExpression\**" />
|
||||
<EmbeddedResource Remove="Entity\Base\**" />
|
||||
<EmbeddedResource Remove="Http\**" />
|
||||
<EmbeddedResource Remove="Network\Socket\**" />
|
||||
<EmbeddedResource Remove="Utils\SerinExpression\**" />
|
||||
<None Remove="Entity\Base\**" />
|
||||
<None Remove="Http\**" />
|
||||
<None Remove="Network\Socket\**" />
|
||||
<None Remove="Utils\SerinExpression\**" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -51,10 +54,6 @@
|
||||
<PackageReference Include="System.ValueTuple" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Network\Socket\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\LICENSE">
|
||||
<Pack>True</Pack>
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace Serein.Library.Utils
|
||||
public string Name { get; set; }
|
||||
public Type Type { get; set; }
|
||||
}
|
||||
private const string FlowBaseClassName = "<>$FlowBaseClass!@#";
|
||||
private const string FlowBaseClassName = "@FlowBaseClass";
|
||||
|
||||
|
||||
public Dictionary<string, List<string>> BuildDependencyTree()
|
||||
|
||||
@@ -54,10 +54,11 @@ namespace Serein.Library.Utils
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 同步方式进行调用方法
|
||||
/// 同步方式在UI线程上进行调用方法
|
||||
/// </summary>
|
||||
/// <param name="uiAction">要执行的UI操作</param>
|
||||
public void Invoke(Action uiAction)
|
||||
/// <param name="onException">异常发生时的回调</param>
|
||||
public void Invoke(Action uiAction, Action<Exception> onException = null)
|
||||
{
|
||||
if(context is null && getUiContext != null)
|
||||
{
|
||||
@@ -65,7 +66,15 @@ namespace Serein.Library.Utils
|
||||
}
|
||||
context?.Post(state =>
|
||||
{
|
||||
uiAction?.Invoke();
|
||||
try
|
||||
{
|
||||
uiAction?.Invoke();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if(onException != null) onException(ex);
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
}, null);
|
||||
}
|
||||
|
||||
@@ -73,8 +82,9 @@ namespace Serein.Library.Utils
|
||||
/// 异步方式进行调用
|
||||
/// </summary>
|
||||
/// <param name="uiAction">要执行的UI操作</param>
|
||||
/// <param name="onException">异常发生时的回调</param>
|
||||
/// <returns></returns>
|
||||
public Task InvokeAsync(Action uiAction)
|
||||
public Task InvokeAsync(Action uiAction, Action<Exception> onException = null)
|
||||
{
|
||||
if (context is null && getUiContext != null)
|
||||
{
|
||||
@@ -92,6 +102,7 @@ namespace Serein.Library.Utils
|
||||
catch (Exception ex)
|
||||
{
|
||||
tcs.SetException(ex);
|
||||
if (onException != null) onException(ex);
|
||||
Debug.WriteLine(ex);
|
||||
}
|
||||
}, null);
|
||||
|
||||
Reference in New Issue
Block a user