From 8b8e4741c6ffa03587fe2f60f2eddb1afd9ea546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=89=BE=E7=AB=B9?= Date: Mon, 5 Jun 2023 22:35:36 +0800 Subject: [PATCH] =?UTF-8?q?mind=E4=B8=8D=E5=8F=AF=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/MindDiagramViewModel.cs | 68 +++++++++---------- 1 file changed, 32 insertions(+), 36 deletions(-) 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 复制,粘贴