mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
准备区分节点、参数、返回值的连接,做个备份
This commit is contained in:
69
Workbench/Node/Junction/JunctionData.cs
Normal file
69
Workbench/Node/Junction/JunctionData.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Serein.Workbench.Node.View
|
||||
{
|
||||
|
||||
#region Model,不科学的全局变量
|
||||
public class MyLine
|
||||
{
|
||||
public MyLine(Canvas canvas, Line line)
|
||||
{
|
||||
Canvas = canvas;
|
||||
VirtualLine = line;
|
||||
canvas?.Children.Add(line);
|
||||
}
|
||||
|
||||
public Canvas Canvas { get; set; }
|
||||
public Line VirtualLine { get; set; }
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
Canvas?.Children.Remove(VirtualLine);
|
||||
}
|
||||
}
|
||||
|
||||
public class ConnectingData
|
||||
{
|
||||
public JunctionControlBase StartJunction { get; set; }
|
||||
public JunctionControlBase ChangingJunction { get; set; }
|
||||
public Point StartPoint { get; set; }
|
||||
public MyLine VirtualLine { get; set; }
|
||||
}
|
||||
|
||||
public static class GlobalJunctionData
|
||||
{
|
||||
private static ConnectingData? myGlobalData;
|
||||
|
||||
public static ConnectingData? MyGlobalData
|
||||
{
|
||||
get => myGlobalData;
|
||||
set
|
||||
{
|
||||
if (myGlobalData == null)
|
||||
{
|
||||
myGlobalData = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static bool IsCreatingConnection => myGlobalData is not null;
|
||||
|
||||
public static bool CanCreate => myGlobalData?.ChangingJunction.Equals(myGlobalData?.StartJunction) == false;
|
||||
|
||||
public static void OK()
|
||||
{
|
||||
myGlobalData?.VirtualLine.Remove();
|
||||
myGlobalData = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user