移除了中断相关的后台代码与UI交互(待重写);重写运行时节点获取参数的方法;重写了节点容器的互动;完善了WebSocket远程交互;完善了项目文件的加载;

This commit is contained in:
fengjiayi
2024-12-26 16:42:05 +08:00
parent 56b22be8c0
commit 7a6f8c407b
37 changed files with 880 additions and 1127 deletions

View File

@@ -17,13 +17,13 @@ namespace Serein.Workbench.Node
/// 放置一个节点
/// </summary>
/// <param name="nodeControl"></param>
void PlaceNode(NodeControlBase nodeControl);
bool PlaceNode(NodeControlBase nodeControl);
/// <summary>
/// 取出一个节点
/// </summary>
/// <param name="nodeControl"></param>
void TakeOutNode(NodeControlBase nodeControl);
bool TakeOutNode(NodeControlBase nodeControl);
/// <summary>
/// 取出所有节点(用于删除容器)

View File

@@ -53,8 +53,13 @@ namespace Serein.Workbench.Node.View
public void PlaceToContainer(INodeContainerControl nodeContainerControl)
{
this.nodeContainerControl = nodeContainerControl;
NodeCanvas.Children.Remove(this); // 从画布上移除
nodeContainerControl.PlaceNode(this);
NodeCanvas.Children.Remove(this); // 临时从画布上移除
var result = nodeContainerControl.PlaceNode(this);
if (!result) // 检查是否放置成功,如果不成功,需要重新添加回来
{
NodeCanvas.Children.Add(this); // 从画布上移除
}
}
/// <summary>
@@ -62,8 +67,17 @@ namespace Serein.Workbench.Node.View
/// </summary>
public void TakeOutContainer()
{
nodeContainerControl.TakeOutNode(this);
NodeCanvas.Children.Add(this); // 重新添加到画布上
var result = nodeContainerControl.TakeOutNode(this); // 从控件取出
if (result) // 移除成功时才添加到画布上
{
NodeCanvas.Children.Add(this); // 重新添加到画布上
if (nodeContainerControl is NodeControlBase containerControl)
{
this.ViewModel.NodeModel.Position.X = containerControl.ViewModel.NodeModel.Position.X + containerControl.Width + 10;
this.ViewModel.NodeModel.Position.Y = containerControl.ViewModel.NodeModel.Position.Y;
}
}
}
/// <summary>

View File

@@ -58,15 +58,24 @@ namespace Serein.Workbench.Node.View
JunctionControlBase[] INodeJunction.ArgDataJunction => throw new NotImplementedException();
public void PlaceNode(NodeControlBase nodeControl)
public bool PlaceNode(NodeControlBase nodeControl)
{
//GlobalDataPanel.Children.Clear();
if (GlobalDataPanel.Children.Contains(nodeControl))
{
return false;
}
GlobalDataPanel.Children.Add(nodeControl);
return true;
}
public void TakeOutNode(NodeControlBase nodeControl)
public bool TakeOutNode(NodeControlBase nodeControl)
{
if (!GlobalDataPanel.Children.Contains(nodeControl))
{
return false;
}
GlobalDataPanel.Children.Remove(nodeControl);
return true;
}
public void TakeOutAll()