This commit is contained in:
kwai
2023-03-08 19:45:07 +08:00
parent f48838f54a
commit c80923d19c
8 changed files with 86 additions and 26 deletions

View File

@@ -106,15 +106,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
}
}
private SimpleCommand _resetLayoutCommand;
public SimpleCommand ResetLayoutCommand
{
get
{
return this._resetLayoutCommand ?? (this._resetLayoutCommand = new SimpleCommand(MindExecuteEnable, this.ExecutedResetLayoutCommand));
}
}
private SimpleCommand _expand2Level1Command;
public SimpleCommand Expand2Level1Command
{
@@ -443,10 +434,6 @@ namespace AIStudio.Wpf.Mind.ViewModels
}
private void ExecutedResetLayoutCommand(object obj)
{
throw new NotImplementedException();
}
private void ExecutedExpand2Level1Command(object obj)
{
@@ -478,6 +465,31 @@ namespace AIStudio.Wpf.Mind.ViewModels
throw new NotImplementedException();
}
#endregion
protected override void ExecutedInitLayoutCommand(object obj)
{
GetChildren(RootItem);
RootItem?.LayoutUpdated();
}
protected override void ExecutedResetLayoutCommand(object obj)
{
foreach (var item in Items.OfType<MindNode>())
{
item.Offset = new DiagramDesigner.Geometrys.PointBase();
}
RootItem?.LayoutUpdated();
}
private void GetChildren(MindNode parent)
{
if (parent == null)
return;
parent.Children = new System.Collections.ObjectModel.ObservableCollection<MindNode>(Items.OfType<MindNode>().Where(p => p.ParentId == parent.Id));
foreach (var item in Items.OfType<MindNode>().Where(p => p.ParentId == parent.Id))
{
GetChildren(item);
}
}
}
}