mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-04 23:36:35 +08:00
从节点Model解耦出容器接口,重新设计了节点的保存、加载。
This commit is contained in:
33
Workbench/Node/INodeContainerControl.cs
Normal file
33
Workbench/Node/INodeContainerControl.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Serein.Workbench.Node.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Serein.Workbench.Node
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 约束具有容器功能的节点控件应该有什么方法
|
||||
/// </summary>
|
||||
public interface INodeContainerControl
|
||||
{
|
||||
/// <summary>
|
||||
/// 放置一个节点
|
||||
/// </summary>
|
||||
/// <param name="nodeControl"></param>
|
||||
void PlaceNode(NodeControlBase nodeControl);
|
||||
|
||||
/// <summary>
|
||||
/// 取出一个节点
|
||||
/// </summary>
|
||||
/// <param name="nodeControl"></param>
|
||||
void TakeOutNode(NodeControlBase nodeControl);
|
||||
|
||||
/// <summary>
|
||||
/// 取出所有节点(用于删除容器)
|
||||
/// </summary>
|
||||
void TakeOutAll();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,9 @@ using System.Windows;
|
||||
|
||||
namespace Serein.Workbench.Node
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 约束一个节点应该有哪些控制点
|
||||
/// </summary>
|
||||
|
||||
@@ -20,10 +20,8 @@ namespace Serein.Workbench.Node.View
|
||||
/// <summary>
|
||||
/// UserControl1.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class GlobalDataControl : NodeControlBase, INodeJunction
|
||||
public partial class GlobalDataControl : NodeControlBase, INodeJunction, INodeContainerControl
|
||||
{
|
||||
//private new GlobalDataNodeControlViewModel ViewModel => ViewModel;
|
||||
|
||||
public GlobalDataControl() : base()
|
||||
{
|
||||
// 窗体初始化需要
|
||||
@@ -39,19 +37,6 @@ namespace Serein.Workbench.Node.View
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置数据节点
|
||||
/// </summary>
|
||||
/// <param name="nodeControl"></param>
|
||||
public void SetDataNodeControl(NodeControlBase nodeControl)
|
||||
{
|
||||
((GlobalDataNodeControlViewModel)ViewModel).SetDataNode(nodeControl.ViewModel.NodeModel);
|
||||
|
||||
GlobalDataPanel.Children.Clear();
|
||||
GlobalDataPanel.Children.Add(nodeControl);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 入参控制点(可能有,可能没)
|
||||
/// </summary>
|
||||
@@ -73,5 +58,21 @@ namespace Serein.Workbench.Node.View
|
||||
JunctionControlBase[] INodeJunction.ArgDataJunction => throw new NotImplementedException();
|
||||
|
||||
|
||||
public void PlaceNode(NodeControlBase nodeControl)
|
||||
{
|
||||
GlobalDataPanel.Children.Clear();
|
||||
GlobalDataPanel.Children.Add(nodeControl);
|
||||
}
|
||||
|
||||
public void TakeOutNode(NodeControlBase nodeControl)
|
||||
{
|
||||
GlobalDataPanel.Children.Remove(nodeControl);
|
||||
}
|
||||
|
||||
public void TakeOutAll()
|
||||
{
|
||||
GlobalDataPanel.Children.Clear();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Serein.Library;
|
||||
using Serein.NodeFlow.Model;
|
||||
using Serein.Workbench.Node.View;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -44,18 +45,7 @@ namespace Serein.Workbench.Node.ViewModel
|
||||
set { NodeModel.KeyName = value; OnPropertyChanged(); }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设置数据节点
|
||||
/// </summary>
|
||||
/// <param name="dataNode"></param>
|
||||
public void SetDataNode(NodeModelBase dataNode)
|
||||
{
|
||||
NodeModel.SetDataNode(dataNode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user