diff --git a/Extensions/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs b/Extensions/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs index 599b4be..9b9c9c4 100644 --- a/Extensions/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs +++ b/Extensions/AIStudio.Wpf.Mind/ViewModels/MindDiagramViewModel.cs @@ -785,7 +785,7 @@ namespace AIStudio.Wpf.Mind.ViewModels items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout()); } - protected override List Delete(object parameter, bool delete = true, bool direct = true) + protected override void ExecuteDeleteCommand(object parameter) { List items = new List(); List others = new List(); @@ -815,47 +815,43 @@ namespace AIStudio.Wpf.Mind.ViewModels //去重 items = items.Distinct().ToList(); - if (delete) - { - Dictionary> indexs = items.ToDictionary(p => p, p => new Tuple(p.ParentNode != null ? p.ParentNode.Children.IndexOf(p) : 0, p.ParentNode)); - DoCommandManager.DoNewCommand(this.ToString(), - () => { - foreach (var item in items.ToList()) + Dictionary> indexs = items.ToDictionary(p => p, p => new Tuple(p.ParentNode != null ? p.ParentNode.Children.IndexOf(p) : 0, p.ParentNode)); + DoCommandManager.DoNewCommand(this.ToString(), + () => { + + foreach (var item in items.ToList()) + { + item.RemoveFrom(); + } + + if (others.Any()) + { + base.Delete(others); + } + + items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout()); + }, + () => { + if (others.Any()) + { + base.Add(others); + } + + foreach (var item in items) + { + item.AddTo(indexs[item].Item2, indexs[item].Item1, false); + if (item.ParentId == Guid.Empty) { - item.RemoveFrom(); + item.Offset = new PointBase(); } + } - if (others.Any()) - { - base.Delete(others); - } - - items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout()); - }, - () => { - if (others.Any()) - { - base.Add(others); - } - - foreach (var item in items) - { - item.AddTo(indexs[item].Item2, indexs[item].Item1, false); - if (item.ParentId == Guid.Empty) - { - item.Offset = new PointBase(); - } - } - - items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout()); - }); - } - return items.OfType().ToList(); + items.Select(p => p.RootNode).Distinct().ToList().ForEach(p => p.UpdatedLayout()); + }); } - else - return null; } + #endregion #region 复制,粘贴