From 3792dd53d28f3d6c3cd608e144d40ee10e4363a4 Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 16 Dec 2020 22:39:46 +0100 Subject: [PATCH] Profile editor - Don't confirm when deleting layers (we have undo) Profile editor - Apply new brushes before saving to fix undo crash --- .../PropertyInput/PropertyInputViewModel.cs | 21 ++++++++----------- .../ProfileTree/TreeItem/TreeItemViewModel.cs | 12 +---------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs index d6b4909bb..b15993d85 100644 --- a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs +++ b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs @@ -136,19 +136,16 @@ namespace Artemis.UI.Shared Validate(); // Only apply the input value to the layer property if the validator found no errors if (!HasErrors) - SetCurrentValue(_inputValue, !InputDragging); + { + OnInputValueChanged(); + LayerProperty.SetCurrentValue(_inputValue, ProfileEditorService.CurrentTime); + OnInputValueApplied(); - OnInputValueChanged(); - OnInputValueApplied(); - } - - private void SetCurrentValue(T value, bool saveChanges) - { - LayerProperty.SetCurrentValue(value, ProfileEditorService.CurrentTime); - if (saveChanges) - ProfileEditorService.UpdateSelectedProfileElement(); - else - ProfileEditorService.UpdateProfilePreview(); + if (InputDragging) + ProfileEditorService.UpdateProfilePreview(); + else + ProfileEditorService.UpdateSelectedProfileElement(); + } } private void UpdateInputValue() diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs index f4c5e1db5..c742e36fb 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs @@ -167,18 +167,8 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem } } - // ReSharper disable once UnusedMember.Global - Called from view - public async Task DeleteElement() + public void DeleteElement() { - bool result = await _dialogService.ShowConfirmDialogAt( - "ProfileTreeDialog", - "Delete profile element", - "Are you sure?" - ); - - if (!result) - return; - ProfileElement newSelection = null; if (ProfileElement.Parent != null) {