mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-10 11:40:48 +08:00
实现了拖拽式设置方法调用顺序、方法入参参数来源
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.Windows.Media;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using Serein.Library;
|
||||
|
||||
@@ -6,32 +8,75 @@ namespace Serein.Workbench.Node.View
|
||||
{
|
||||
public class ExecuteJunctionControl : JunctionControlBase
|
||||
{
|
||||
//public override JunctionType JunctionType { get; } = JunctionType.Execute;
|
||||
|
||||
|
||||
|
||||
public ExecuteJunctionControl()
|
||||
{
|
||||
base.JunctionType = JunctionType.Execute;
|
||||
Render();
|
||||
this.InvalidateVisual();
|
||||
|
||||
}
|
||||
|
||||
public override void Render()
|
||||
private Point _myCenterPoint;
|
||||
public override Point MyCenterPoint { get => _myCenterPoint; }
|
||||
public override void Render(DrawingContext drawingContext)
|
||||
{
|
||||
if (double.IsNaN(base.Width))
|
||||
{
|
||||
base.Width = base._MyWidth;
|
||||
}
|
||||
if (double.IsNaN(base.Height))
|
||||
{
|
||||
base.Height = base._MyHeight;
|
||||
}
|
||||
double width = ActualWidth;
|
||||
double height = ActualHeight;
|
||||
|
||||
var rect = new Rectangle
|
||||
// 绘制边框
|
||||
//var borderBrush = new SolidColorBrush(Colors.Black);
|
||||
//var borderThickness = 1.0;
|
||||
//var borderRect = new Rect(0, 0, width, height);
|
||||
//drawingContext.DrawRectangle(null, new Pen(borderBrush, borderThickness), borderRect);
|
||||
|
||||
// 输入连接器的背景
|
||||
var connectorBackground = IsMouseOver ? Brushes.DarkCyan : Brushes.Transparent;
|
||||
var connectorRect = new Rect(4, 4, width - 8, height - 8);
|
||||
drawingContext.DrawRectangle(connectorBackground, null, connectorRect);
|
||||
|
||||
// 定义圆形的大小和位置
|
||||
double connectorSize = 10; // 连接器的大小
|
||||
double circleCenterX = 8; // 圆心 X 坐标
|
||||
double circleCenterY = height / 2; // 圆心 Y 坐标
|
||||
|
||||
var circlePoint = new Point(circleCenterX, circleCenterY);
|
||||
// 绘制连接器的圆形部分
|
||||
var ellipse = new EllipseGeometry(circlePoint, connectorSize / 2, connectorSize / 2);
|
||||
_myCenterPoint = new Point(circleCenterX - connectorSize / 2, circleCenterY);
|
||||
|
||||
|
||||
drawingContext.DrawGeometry(IsMouseOver ? Brushes.DarkCyan : Brushes.Transparent, new Pen(Brushes.Black, 1), ellipse);
|
||||
|
||||
|
||||
|
||||
|
||||
// 定义三角形的间距
|
||||
double triangleOffsetX = 4; // 三角形与圆形的间距
|
||||
double triangleCenterX = circleCenterX + connectorSize / 2 + triangleOffsetX; // 三角形中心 X 坐标
|
||||
double triangleCenterY = circleCenterY; // 三角形中心 Y 坐标
|
||||
|
||||
// 绘制三角形
|
||||
var pathGeometry = new StreamGeometry();
|
||||
using (var context = pathGeometry.Open())
|
||||
{
|
||||
Width = base.Width,
|
||||
Height = base.Height,
|
||||
Fill = Brushes.Green,
|
||||
ToolTip = "方法执行"
|
||||
};
|
||||
Content = rect;
|
||||
context.BeginFigure(new Point(triangleCenterX, triangleCenterY - 4.5), true, true);
|
||||
context.LineTo(new Point(triangleCenterX + 5, triangleCenterY), true, false);
|
||||
context.LineTo(new Point(triangleCenterX, triangleCenterY + 4.5), true, false);
|
||||
context.LineTo(new Point(triangleCenterX, triangleCenterY - 4.5), true, false);
|
||||
}
|
||||
drawingContext.DrawGeometry(IsMouseOver ? Brushes.DarkCyan : Brushes.Transparent, new Pen(Brushes.Black, 1), pathGeometry);
|
||||
|
||||
// 绘制标签
|
||||
//var formattedText = new FormattedText(
|
||||
// "执行",
|
||||
// System.Globalization.CultureInfo.CurrentCulture,
|
||||
// FlowDirection.LeftToRight,
|
||||
// new Typeface("Segoe UI"),
|
||||
// 12,
|
||||
// Brushes.Black,
|
||||
// VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||
//drawingContext.DrawText(formattedText, new Point(18,1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user