1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Profile editor - Fixed freeze on delete

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

View File

@ -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}">

View File

@ -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();
} }
} }

View File

@ -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()