This commit is contained in:
艾竹
2023-06-27 22:57:08 +08:00
parent 6995fe1476
commit d2e00c6149
8 changed files with 70 additions and 73 deletions

View File

@@ -33,12 +33,12 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
private ICommand _addChildCommand;
public ICommand AddChildCommand
private ICommand _insertChildCommand;
public ICommand InsertChildCommand
{
get
{
return this._addChildCommand ?? (this._addChildCommand = new SimpleCommand(ExecuteEnable, this.ExecutedAddChildCommand));
return this._insertChildCommand ?? (this._insertChildCommand = new SimpleCommand(ExecuteEnable, this.ExecutedInsertChildCommand));
}
}
@@ -81,13 +81,13 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
private void ExecutedAddChildCommand(object parameter)
private void ExecutedInsertChildCommand(object parameter)
{
if (parameter is BlockContainerPara blockContainerPara)
{
DoCommandManager.DoNewCommand(this.ToString(),
() => {
blockContainerPara.Item.AddChild(blockContainerPara.Child, blockContainerPara.Container);
blockContainerPara.Item.InsertChild(blockContainerPara.Child, blockContainerPara.Container, blockContainerPara.Index);
},
() => {
blockContainerPara.Item.RemoveChild(blockContainerPara.Child, blockContainerPara.Container);
@@ -98,12 +98,13 @@ namespace AIStudio.Wpf.DiagramDesigner
{
if (parameter is BlockContainerPara blockContainerPara)
{
int index = blockContainerPara.Container.Children.IndexOf(blockContainerPara.Child);
DoCommandManager.DoNewCommand(this.ToString(),
() => {
blockContainerPara.Item.RemoveChild(blockContainerPara.Child, blockContainerPara.Container);
},
() => {
blockContainerPara.Item.AddChild(blockContainerPara.Child, blockContainerPara.Container);
blockContainerPara.Item.InsertChild(blockContainerPara.Child, blockContainerPara.Container, index);
});
}
}
@@ -136,5 +137,9 @@ namespace AIStudio.Wpf.DiagramDesigner
{
get; set;
}
public int Index
{
get;set;
}
}
}