This commit is contained in:
艾竹
2023-06-17 09:31:15 +08:00
parent bdf7385a39
commit 56545ece4b
6 changed files with 77 additions and 32 deletions

View File

@@ -3346,6 +3346,8 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
}
#endregion
public override string ToString()

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AIStudio.Wpf.DiagramDesigner
{
public class BlockDesignerItemTempLink
{
List<BlockDesignerItemViewModel> Items
{
get;set;
} = new List<BlockDesignerItemViewModel>();
//public static List<BlockDesignerItemTempLink> Build(List<BlockDesignerItemViewModel> blocks)
//{
// List<BlockDesignerItemTempLink> links = new List<BlockDesignerItemTempLink>(){
// new BlockDesignerItemTempLink() };
// foreach(var )
//}
}
}

View File

@@ -36,16 +36,6 @@ namespace AIStudio.Wpf.DiagramDesigner
IsReadOnlyText = true;
}
public BlockDesignerItemViewModel Next
{
get; set;
}
public BlockItemsContainerInfo ParentContain
{
get; set;
}
public void AddNext(BlockDesignerItemViewModel next)
{
if (this.Next == next)
@@ -91,19 +81,6 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
public BlockDesignerItemViewModel GetLastNext()
{
var next = this.Next;
if (next != null)
{
while (next.Next != null)
{
next = next.Next;
}
}
return next;
}
public override void AddToSelection(bool selected, bool clearother)
{
if (clearother)
@@ -120,11 +97,10 @@ namespace AIStudio.Wpf.DiagramDesigner
IsSelected = selected;
}
public virtual void AddChild(BlockDesignerItemViewModel child)
{
child.RemoveFromSelection();
this.GetRootParent.AddToSelection(true, true);
this.GetRootContainItem.AddToSelection(true, true);
System.Windows.Application.Current?.Dispatcher.BeginInvoke(new Action(async () => {
await Task.Delay(10);
@@ -144,6 +120,24 @@ namespace AIStudio.Wpf.DiagramDesigner
}));
}
public BlockDesignerItemViewModel Prev
{
get
{
return Parent as BlockDesignerItemViewModel;
}
}
public BlockDesignerItemViewModel Next
{
get; set;
}
public BlockItemsContainerInfo ParentContain
{
get; set;
}
public ObservableCollection<BlockItemsContainerInfo> Contains
{
get; set;
@@ -155,14 +149,40 @@ namespace AIStudio.Wpf.DiagramDesigner
{
return Contains?.FirstOrDefault();
}
}
}
public BlockDesignerItemViewModel GetFirst()
{
var parent = this.Next;
if (parent != null)
{
while (parent.Parent != null)
{
parent = parent.Parent as BlockDesignerItemViewModel;
}
}
return parent;
}
public BlockDesignerItemViewModel GetLast()
{
var next = this;
if (next != null)
{
while (next.Next != null)
{
next = next.Next;
}
}
return next;
}
public List<BlockItemsContainerInfo> GetAllContain()
{
return Contains.SelectMany(p => p.GetAllContain(p.Children, true)).ToList();
}
public BlockDesignerItemViewModel GetRootParent
public BlockDesignerItemViewModel GetRootContainItem
{
get
{
@@ -172,7 +192,7 @@ namespace AIStudio.Wpf.DiagramDesigner
}
else
{
return ParentContain.DataItem.GetRootParent;
return ParentContain.DataItem.GetRootContainItem;
}
}
}