mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-03 08:10:50 +08:00
block
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user