修改暂存一下

This commit is contained in:
艾竹
2023-01-12 23:02:53 +08:00
parent 5d7717cc2b
commit 6a4c31106a
58 changed files with 776 additions and 468 deletions

View File

@@ -1,16 +1,17 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using AIStudio.Wpf.DiagramDesigner.Geometrys;
namespace AIStudio.Wpf.DiagramDesigner
{
[ValueConversion(typeof(List<Point>), typeof(PathSegmentCollection))]
public class ConnectionPathConverter : IValueConverter
public class ConnectionPathConverter : IMultiValueConverter
{
static ConnectionPathConverter()
{
@@ -23,21 +24,22 @@ namespace AIStudio.Wpf.DiagramDesigner
private set;
}
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
List<ConnectorPoint> points = (List<ConnectorPoint>)value;
PointCollection pointCollection = new PointCollection();
if (points != null)
GeometryGroup geometryGroup = new GeometryGroup();
if (values[0] is PathGeneratorResult result)
{
foreach (var point in points)
foreach (var path in result.Paths)
{
pointCollection.Add(new Point(point.X, point.Y));
PathGeometry pathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path));
geometryGroup.Children.Add(pathGeometry);
}
}
return pointCollection;
return geometryGroup;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}