2025-05-28 23:19:00 +08:00
|
|
|
|
using Serein.Library.Api;
|
|
|
|
|
|
using Serein.NodeFlow.Model;
|
2025-07-29 14:25:31 +08:00
|
|
|
|
using Serein.NodeFlow.Model.Nodes;
|
2025-05-26 23:55:23 +08:00
|
|
|
|
using Serein.Workbench.Api;
|
2025-01-05 08:52:37 +08:00
|
|
|
|
using Serein.Workbench.Node.ViewModel;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Serein.Workbench.Node.View
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// UserControl1.xaml 的交互逻辑
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class GlobalDataControl : NodeControlBase, INodeJunction, INodeContainerControl
|
|
|
|
|
|
{
|
2025-07-28 17:38:51 +08:00
|
|
|
|
private readonly GlobalDataNodeControlViewModel viewModel;
|
|
|
|
|
|
|
2025-07-30 21:15:07 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 全局数据控件构造函数,使用默认的全局数据节点模型
|
|
|
|
|
|
/// </summary>
|
2025-01-05 08:52:37 +08:00
|
|
|
|
public GlobalDataControl() : base()
|
|
|
|
|
|
{
|
|
|
|
|
|
// 窗体初始化需要
|
2025-05-28 23:19:00 +08:00
|
|
|
|
var env = App.GetService<IFlowEnvironment>();
|
2025-07-30 21:15:07 +08:00
|
|
|
|
viewModel = new GlobalDataNodeControlViewModel(new SingleGlobalDataNode(env));
|
2025-05-28 23:19:00 +08:00
|
|
|
|
base.ViewModel = new GlobalDataNodeControlViewModel(new SingleGlobalDataNode(env));
|
2025-03-17 10:14:18 +08:00
|
|
|
|
base.ViewModel.IsEnabledOnView = false;
|
2025-05-30 23:31:31 +08:00
|
|
|
|
base.ViewModel.NodeModel.DisplayName = "[全局数据]";
|
2025-01-05 08:52:37 +08:00
|
|
|
|
DataContext = ViewModel;
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-30 21:15:07 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 全局数据控件构造函数,使用指定的全局数据节点模型
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="viewModel"></param>
|
2025-01-05 08:52:37 +08:00
|
|
|
|
public GlobalDataControl(GlobalDataNodeControlViewModel viewModel) : base(viewModel)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataContext = viewModel;
|
2025-05-30 23:31:31 +08:00
|
|
|
|
viewModel.NodeModel.DisplayName = "[全局数据]";
|
2025-01-05 08:52:37 +08:00
|
|
|
|
InitializeComponent();
|
2025-07-28 17:38:51 +08:00
|
|
|
|
this.viewModel = viewModel;
|
2025-01-05 08:52:37 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 入参控制点(可能有,可能没)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
JunctionControlBase INodeJunction.ExecuteJunction => this.ExecuteJunctionControl;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 下一个调用方法控制点(可能有,可能没)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
JunctionControlBase INodeJunction.NextStepJunction => this.NextStepJunctionControl;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 返回值控制点(可能有,可能没)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
JunctionControlBase INodeJunction.ReturnDataJunction => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 方法入参控制点(可能有,可能没)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
JunctionControlBase[] INodeJunction.ArgDataJunction => throw new NotImplementedException();
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-30 21:15:07 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 放置节点控件到全局数据面板中
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeControl"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2025-01-05 08:52:37 +08:00
|
|
|
|
public bool PlaceNode(NodeControlBase nodeControl)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GlobalDataPanel.Children.Contains(nodeControl))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2025-07-28 17:38:51 +08:00
|
|
|
|
//viewModel.NodeModel is SingleGlobalDataNode
|
2025-01-05 08:52:37 +08:00
|
|
|
|
GlobalDataPanel.Children.Add(nodeControl);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-30 21:15:07 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 从全局数据面板中取出节点控件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="nodeControl"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2025-01-05 08:52:37 +08:00
|
|
|
|
public bool TakeOutNode(NodeControlBase nodeControl)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!GlobalDataPanel.Children.Contains(nodeControl))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
GlobalDataPanel.Children.Remove(nodeControl);
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-30 21:15:07 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 取出所有节点控件(用于删除容器)
|
|
|
|
|
|
/// </summary>
|
2025-01-05 08:52:37 +08:00
|
|
|
|
public void TakeOutAll()
|
|
|
|
|
|
{
|
|
|
|
|
|
GlobalDataPanel.Children.Clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|