From 10c80fb9c2ca3f6a64f4f00b3cc87eac2bb0aaaf Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 12 Jun 2021 22:54:55 +0200 Subject: [PATCH] Profile editor - Fixed freeze on delete --- .../Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml | 2 +- .../ProfileEditor/ProfileTree/ProfileTreeViewModel.cs | 7 ++----- .../ProfileTree/TreeItem/TreeItemViewModel.cs | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml index ce49b864f..c3388512a 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeView.xaml @@ -95,7 +95,7 @@ - + diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs index 39cd410a8..9156b86f1 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/ProfileTreeViewModel.cs @@ -33,11 +33,8 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree get => _selectedTreeItem; set { - if (_updatingTree) return; - if (!SetAndNotify(ref _selectedTreeItem, value)) return; - if (_draggingTreeView) return; - - ApplySelectedTreeItem(); + if (!_updatingTree && SetAndNotify(ref _selectedTreeItem, value) && !_draggingTreeView) + ApplySelectedTreeItem(); } } diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs index 2ae8702b1..e4309201c 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs @@ -184,6 +184,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem else newSelection = ProfileElement.Parent; } + _profileEditorService.ChangeSelectedProfileElement(newSelection as RenderProfileElement); // Farewell, cruel world TreeItemViewModel parent = (TreeItemViewModel) Parent; @@ -191,7 +192,6 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem parent.RemoveExistingElement(this); _profileEditorService.SaveSelectedProfileConfiguration(); - _profileEditorService.ChangeSelectedProfileElement(newSelection as RenderProfileElement); } public void DuplicateElement()