2023-06-20 13:46:26 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2023-07-02 11:23:00 +08:00
|
|
|
|
using System.Diagnostics;
|
2023-06-20 13:46:26 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
2023-06-27 22:57:08 +08:00
|
|
|
|
using System.Windows;
|
2023-07-01 21:38:23 +08:00
|
|
|
|
using System.Windows.Documents;
|
2023-06-20 13:46:26 +08:00
|
|
|
|
|
|
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner
|
|
|
|
|
|
{
|
2023-06-28 12:06:58 +08:00
|
|
|
|
public static partial class BlockDesignerItemViewModelHelper
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// type=0最近且没有依附;=1
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="blockDesignerItemViewModel"></param>
|
|
|
|
|
|
/// <param name="type"></param>
|
|
|
|
|
|
/// <returns></returns>
|
2023-06-27 22:57:08 +08:00
|
|
|
|
public static Tuple<FullyCreatedConnectorInfo, FullyCreatedConnectorInfo> FindNearPortToAttachTo(this IDiagramViewModel diagramViewModel, BlockDesignerItemTempLink blockDesignerItemTempLink)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (blockDesignerItemTempLink == null || blockDesignerItemTempLink.LinkList == null || blockDesignerItemTempLink.LinkList.Count == 0)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
return new Tuple<FullyCreatedConnectorInfo, FullyCreatedConnectorInfo>(null, null);
|
|
|
|
|
|
|
2023-08-12 22:58:24 +08:00
|
|
|
|
List<BlockDesignerItemViewModel> items = diagramViewModel.Items.OfType<BlockDesignerItemViewModel>().Where(p => !blockDesignerItemTempLink.LinkList.Contains(p)).ToList();
|
2023-06-27 22:57:08 +08:00
|
|
|
|
|
|
|
|
|
|
return diagramViewModel.FindNearPortToAttachTo(items, blockDesignerItemTempLink);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static Tuple<FullyCreatedConnectorInfo, FullyCreatedConnectorInfo> FindNearPortToAttachTo(this IDiagramViewModel diagramViewModel, List<BlockDesignerItemViewModel> items, BlockDesignerItemTempLink blockDesignerItemTempLink)
|
|
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (blockDesignerItemTempLink == null || blockDesignerItemTempLink.LinkList == null || blockDesignerItemTempLink.LinkList.Count == 0)
|
2023-06-27 22:57:08 +08:00
|
|
|
|
return new Tuple<FullyCreatedConnectorInfo, FullyCreatedConnectorInfo>(null, null);
|
2023-06-20 13:46:26 +08:00
|
|
|
|
|
|
|
|
|
|
FullyCreatedConnectorInfo parent = null;
|
|
|
|
|
|
FullyCreatedConnectorInfo next = null;
|
|
|
|
|
|
|
2023-07-02 11:23:00 +08:00
|
|
|
|
|
|
|
|
|
|
foreach (var port2 in blockDesignerItemTempLink.Connectors.OfType<BlockConnectorInfo>())
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-01 21:38:23 +08:00
|
|
|
|
bool success = false;
|
2023-07-02 11:23:00 +08:00
|
|
|
|
foreach (var item in items)
|
2023-08-12 22:58:24 +08:00
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
foreach (var port in item.Connectors.OfType<BlockConnectorInfo>())
|
2023-07-01 21:38:23 +08:00
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
//已经被连接的不允许在顶部吸附了
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if ((port.Orientation == ConnectorOrientation.Top || port.Orientation == ConnectorOrientation.Left) && port.DataItem.LinkNode.Previous != null)
|
2023-07-02 11:23:00 +08:00
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
|
2023-07-01 21:38:23 +08:00
|
|
|
|
//parent
|
|
|
|
|
|
if (parent == null)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-01 21:38:23 +08:00
|
|
|
|
if ((port.Orientation == ConnectorOrientation.Right && port2.Orientation == ConnectorOrientation.Left)
|
|
|
|
|
|
|| (port.Orientation == ConnectorOrientation.Bottom && port2.Orientation == ConnectorOrientation.Top))
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
var dis = port.DistanceTo(port2);
|
2023-07-31 22:50:19 +08:00
|
|
|
|
//Debug.WriteLine($"{port.DataItem.Name}-{port2.DataItem.Name}:{dis}");
|
2023-07-02 11:23:00 +08:00
|
|
|
|
if (dis < diagramViewModel.DiagramOption.SnappingOption.BlockSnappingRadius)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-01 21:38:23 +08:00
|
|
|
|
port.DataItem.ShowConnectors = true;
|
2023-07-02 11:23:00 +08:00
|
|
|
|
if (port.CanAttachTo(port2) == true)
|
2023-07-01 21:38:23 +08:00
|
|
|
|
{
|
|
|
|
|
|
diagramViewModel.AddAttachTo(port, true);
|
|
|
|
|
|
parent = port;
|
|
|
|
|
|
success = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
diagramViewModel.AddAttachTo(port, false);
|
|
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
|
2023-07-01 21:38:23 +08:00
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-01 21:38:23 +08:00
|
|
|
|
//next
|
|
|
|
|
|
if (next == null)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-01 21:38:23 +08:00
|
|
|
|
if ((port.Orientation == ConnectorOrientation.Left && port2.Orientation == ConnectorOrientation.Right)
|
|
|
|
|
|
|| (port.Orientation == ConnectorOrientation.Top && port2.Orientation == ConnectorOrientation.Bottom))
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
var dis = port.DistanceTo(port2);
|
2023-07-31 22:50:19 +08:00
|
|
|
|
//Debug.WriteLine($"{port.DataItem.Name}-{port2.DataItem.Name}:{dis}");
|
2023-07-02 11:23:00 +08:00
|
|
|
|
if (dis < diagramViewModel.DiagramOption.SnappingOption.BlockSnappingRadius)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-01 21:38:23 +08:00
|
|
|
|
port.DataItem.ShowConnectors = true;
|
2023-07-02 11:23:00 +08:00
|
|
|
|
if (port.CanAttachTo(port2) == true)
|
2023-07-01 21:38:23 +08:00
|
|
|
|
{
|
|
|
|
|
|
diagramViewModel.AddAttachTo(port, true);
|
|
|
|
|
|
next = port;
|
|
|
|
|
|
success = true;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
diagramViewModel.AddAttachTo(port, false);
|
|
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
|
2023-07-01 21:38:23 +08:00
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-07-01 21:38:23 +08:00
|
|
|
|
|
|
|
|
|
|
if (success)
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
2023-07-02 11:23:00 +08:00
|
|
|
|
|
|
|
|
|
|
if (success)
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new Tuple<FullyCreatedConnectorInfo, FullyCreatedConnectorInfo>(parent, next);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static BlockItemsContainerInfo FindNearContainerToAttachTo(this IDiagramViewModel diagramViewModel, BlockDesignerItemTempLink blockDesignerItemTempLink)
|
|
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (blockDesignerItemTempLink == null || blockDesignerItemTempLink.LinkList == null || blockDesignerItemTempLink.LinkList.Count == 0)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
List<BlockDesignerItemViewModel> items;
|
|
|
|
|
|
|
2023-08-12 22:58:24 +08:00
|
|
|
|
items = diagramViewModel.Items.OfType<BlockDesignerItemViewModel>().Where(p => !blockDesignerItemTempLink.LinkList.Contains(p)).ToList();
|
2023-06-20 13:46:26 +08:00
|
|
|
|
|
2023-06-26 16:45:48 +08:00
|
|
|
|
foreach (var container in items.SelectMany(n => n.Containers))
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-06-26 16:45:48 +08:00
|
|
|
|
if (container.GetBounds().IntersectsWith(blockDesignerItemTempLink.GetBounds())) //如果两个位置相交
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-06-26 16:45:48 +08:00
|
|
|
|
var innerport = container.GetAllContainers(container.Children, false).Where(p => p.GetBounds().IntersectsWith(blockDesignerItemTempLink.GetBounds())).OrderByDescending(p => p.ContainerLevel).FirstOrDefault();
|
2023-06-20 13:46:26 +08:00
|
|
|
|
if (innerport != null)
|
2023-07-02 11:23:00 +08:00
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (innerport.CanAttachTo(blockDesignerItemTempLink.LinkList.FirstOrDefault()) == true)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
innerport.DataItem.ShowConnectors = true;
|
2023-06-27 19:58:08 +08:00
|
|
|
|
if (innerport.OnlyOneChild || innerport.Children.Count == 0)
|
2023-06-26 16:45:48 +08:00
|
|
|
|
{
|
2023-06-28 12:06:58 +08:00
|
|
|
|
diagramViewModel.AddAttachTo(innerport, true);
|
2023-06-26 16:45:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
diagramViewModel.FindNearPortToAttachTo(innerport.Children.ToList(), blockDesignerItemTempLink);
|
2023-06-26 16:45:48 +08:00
|
|
|
|
}
|
2023-06-28 12:06:58 +08:00
|
|
|
|
return innerport;
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// innerport.DisableAttachTo = true;
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (container.CanAttachTo(blockDesignerItemTempLink.LinkList.FirstOrDefault()) == true)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-06-28 12:06:58 +08:00
|
|
|
|
container.DataItem.ShowConnectors = true;
|
2023-06-27 22:57:08 +08:00
|
|
|
|
if (container.OnlyOneChild || container.Children.Count == 0)
|
|
|
|
|
|
{
|
2023-06-28 12:06:58 +08:00
|
|
|
|
diagramViewModel.AddAttachTo(container, true);
|
2023-06-27 22:57:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
diagramViewModel.FindNearPortToAttachTo(container.Children.ToList(), blockDesignerItemTempLink);
|
2023-06-28 12:06:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
return container;
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// port.DisableAttachTo = true;
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Block拖拽预览-拖拽完成
|
|
|
|
|
|
public static void PreviewNearBlock(this IBlockDiagramViewModel diagramViewModel, List<BlockDesignerItemViewModel> blocks)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (diagramViewModel == null)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (blocks.Any())
|
|
|
|
|
|
{
|
2023-06-28 12:06:58 +08:00
|
|
|
|
diagramViewModel.ClearAttachTo();
|
2023-06-20 13:46:26 +08:00
|
|
|
|
var links = BlockDesignerItemTempLink.Build(blocks);
|
2023-07-01 21:38:23 +08:00
|
|
|
|
|
|
|
|
|
|
blocks.ToList().ForEach(p => {
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (p.ZIndex != int.MaxValue)
|
|
|
|
|
|
{
|
|
|
|
|
|
p.SetOldValue(p.ZIndex, "ZIndex");
|
|
|
|
|
|
}
|
2023-07-01 21:38:23 +08:00
|
|
|
|
p.ZIndex = int.MaxValue;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2023-06-20 13:46:26 +08:00
|
|
|
|
foreach (BlockDesignerItemTempLink item in links)
|
|
|
|
|
|
{
|
|
|
|
|
|
var container = diagramViewModel.FindNearContainerToAttachTo(item);
|
|
|
|
|
|
if (container != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2023-06-27 22:57:08 +08:00
|
|
|
|
diagramViewModel.FindNearPortToAttachTo(item);
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void FinishNearBlock(this IBlockDiagramViewModel diagramViewModel, List<BlockDesignerItemViewModel> blocks)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (diagramViewModel == null)
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
if (blocks.Any())
|
2023-07-02 11:23:00 +08:00
|
|
|
|
{
|
2023-06-20 13:46:26 +08:00
|
|
|
|
var links = BlockDesignerItemTempLink.Build(blocks);
|
|
|
|
|
|
|
2023-07-01 21:38:23 +08:00
|
|
|
|
blocks.ToList().ForEach(p => {
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (p.HasOldValue("ZIndex"))
|
|
|
|
|
|
{
|
|
|
|
|
|
p.ZIndex = p.GetOldValue<int>("ZIndex");
|
|
|
|
|
|
}
|
2023-07-01 21:38:23 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
2023-06-20 13:46:26 +08:00
|
|
|
|
foreach (BlockDesignerItemTempLink item in links)
|
|
|
|
|
|
{
|
|
|
|
|
|
var container = diagramViewModel.FindNearContainerToAttachTo(item);
|
|
|
|
|
|
if (container != null)
|
|
|
|
|
|
{
|
2023-06-27 22:57:08 +08:00
|
|
|
|
int index = 0;
|
|
|
|
|
|
var child = container.Children.FirstOrDefault(p => p.Connectors.Any(q => q.BeAttachTo == true));
|
|
|
|
|
|
if (child != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
index = container.Children.IndexOf(child);
|
|
|
|
|
|
if (child.RightConnector?.BeAttachTo == true || child.BottomConnector?.BeAttachTo == true)
|
|
|
|
|
|
{
|
2023-07-02 11:23:00 +08:00
|
|
|
|
index++;
|
2023-06-27 22:57:08 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-12 22:58:24 +08:00
|
|
|
|
diagramViewModel.InsertChildCommand.Execute(new BlockContainerPara() { Item = container.DataItem, Child = item.LinkList.FirstOrDefault(), Container = container, Index = index });
|
2023-06-20 13:46:26 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-06-27 22:57:08 +08:00
|
|
|
|
var portTuple = diagramViewModel.FindNearPortToAttachTo(item);
|
2023-06-20 13:46:26 +08:00
|
|
|
|
var portParent = portTuple.Item1;
|
|
|
|
|
|
var portNext = portTuple.Item2;
|
|
|
|
|
|
|
|
|
|
|
|
if (portParent != null)
|
|
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
diagramViewModel.AddNextCommand.Execute(new BlockNextPara() { Item = portParent.DataItem as BlockDesignerItemViewModel, Next = item.LinkList.FirstOrDefault() });
|
2023-06-20 13:46:26 +08:00
|
|
|
|
portParent.BeAttachTo = false;
|
|
|
|
|
|
portParent.DisableAttachTo = false;
|
|
|
|
|
|
}
|
2023-08-12 22:58:24 +08:00
|
|
|
|
else if (portNext != null)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
diagramViewModel.AddNextCommand.Execute(new BlockNextPara() { First = item.LinkList.FirstOrDefault(), Item = item.LinkList.LastOrDefault(), Next = portNext.DataItem as BlockDesignerItemViewModel });
|
2023-06-20 13:46:26 +08:00
|
|
|
|
portNext.BeAttachTo = false;
|
|
|
|
|
|
portNext.DisableAttachTo = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
if (item.LinkList.FirstOrDefault().LinkNode.Previous != null)
|
2023-06-20 13:46:26 +08:00
|
|
|
|
{
|
2023-08-12 22:58:24 +08:00
|
|
|
|
diagramViewModel.RemoveNextCommand.Execute(new BlockNextPara() { Item = item.LinkList.FirstOrDefault().LinkNode.Previous.Value, Next = item.LinkList.FirstOrDefault().LinkNode.Value });
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-07-02 11:23:00 +08:00
|
|
|
|
|
2023-06-28 12:06:58 +08:00
|
|
|
|
diagramViewModel.ClearAttachTo();
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
2023-08-12 22:58:24 +08:00
|
|
|
|
|
|
|
|
|
|
public static class LinkedListExtensions
|
|
|
|
|
|
{
|
|
|
|
|
|
public static void InsertRange(this LinkedList<BlockDesignerItemViewModel> source, LinkedListNode<BlockDesignerItemViewModel> node, IEnumerable<BlockDesignerItemViewModel> items)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (node == null || items.Count() == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BlockDesignerItemViewModel last = null;
|
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.LinkNode = source.AddAfter(node, item);
|
|
|
|
|
|
item.ParentId = item.LinkNode.Previous.Value.Id;
|
|
|
|
|
|
node = item.LinkNode;
|
|
|
|
|
|
|
|
|
|
|
|
last = item;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//把后面的接上
|
|
|
|
|
|
var lastnode = source.Find(last);
|
|
|
|
|
|
if (lastnode.Next != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
lastnode.Next.Value.ParentId = last.Id;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void AppendRange(this LinkedList<BlockDesignerItemViewModel> source, IEnumerable<BlockDesignerItemViewModel> items)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.LinkNode = source.AddLast(item);
|
|
|
|
|
|
item.ParentId = item.LinkNode.Previous?.Value.Id ?? new Guid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void PrependRange(this LinkedList<BlockDesignerItemViewModel> source, IEnumerable<BlockDesignerItemViewModel> items)
|
|
|
|
|
|
{
|
|
|
|
|
|
var first = source.First; // If the list is empty, we can just append everything.
|
|
|
|
|
|
if (first is null)
|
|
|
|
|
|
{
|
|
|
|
|
|
AppendRange(source, items); return;
|
|
|
|
|
|
} // Otherwise, add each item in turn just before the original first item
|
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
|
{
|
|
|
|
|
|
item.LinkNode = source.AddBefore(first, item);
|
|
|
|
|
|
item.ParentId = item.LinkNode.Previous.Value.Id;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-06-20 13:46:26 +08:00
|
|
|
|
}
|