Profile editor - Fixed freeze on delete

This commit is contained in:
Robert committed 2021-06-12 22:54:55 +02:00
1 parent 3f22ebae8a
commit 10c80fb9c2
3 files changed
+4 -7

No files matched your search

@@ -95,7 +95,7 @@
</ContextMenu> </ContextMenu>
</TreeView.ContextMenu> </TreeView.ContextMenu>
<b:Interaction.Behaviors> <b:Interaction.Behaviors>
<behaviors:TreeViewSelectionBehavior SelectedItem="{Binding SelectedTreeItem, IsAsync=True}" /> <behaviors:TreeViewSelectionBehavior SelectedItem="{Binding SelectedTreeItem}" />
</b:Interaction.Behaviors> </b:Interaction.Behaviors>
<TreeView.Resources> <TreeView.Resources>
<HierarchicalDataTemplate DataType="{x:Type treeItem:FolderViewModel}" ItemsSource="{Binding Items}"> <HierarchicalDataTemplate DataType="{x:Type treeItem:FolderViewModel}" ItemsSource="{Binding Items}">
@@ -33,11 +33,8 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
get => _selectedTreeItem; get => _selectedTreeItem;
set set
{ {
if (_updatingTree) return; if (!_updatingTree && SetAndNotify(ref _selectedTreeItem, value) && !_draggingTreeView)
if (!SetAndNotify(ref _selectedTreeItem, value)) return; ApplySelectedTreeItem();
if (_draggingTreeView) return;
ApplySelectedTreeItem();
} }
} }
@@ -184,6 +184,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
else else
newSelection = ProfileElement.Parent; newSelection = ProfileElement.Parent;
} }
_profileEditorService.ChangeSelectedProfileElement(newSelection as RenderProfileElement);
// Farewell, cruel world // Farewell, cruel world
TreeItemViewModel parent = (TreeItemViewModel) Parent; TreeItemViewModel parent = (TreeItemViewModel) Parent;
@@ -191,7 +192,6 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
parent.RemoveExistingElement(this); parent.RemoveExistingElement(this);
_profileEditorService.SaveSelectedProfileConfiguration(); _profileEditorService.SaveSelectedProfileConfiguration();
_profileEditorService.ChangeSelectedProfileElement(newSelection as RenderProfileElement);
} }
public void DuplicateElement() public void DuplicateElement()