mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-01 22:56:35 +08:00
mind
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user