From bf1aad1549513fd3fb042a9108641279d34f4298 Mon Sep 17 00:00:00 2001 From: Robert Date: Mon, 10 Jan 2022 21:32:08 +0100 Subject: [PATCH] Profile editor - Added layer deleting WIP --- .../Services/Builders/NotificationBuilder.cs | 6 +++--- .../Panels/ProfileTree/ProfileTreeView.axaml | 14 +++++++------- .../Panels/ProfileTree/TreeItemViewModel.cs | 7 +++++++ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/Avalonia/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs b/src/Avalonia/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs index 6e14d181f..22fa90f18 100644 --- a/src/Avalonia/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs +++ b/src/Avalonia/Artemis.UI.Shared/Services/Builders/NotificationBuilder.cs @@ -209,10 +209,10 @@ public class NotificationButtonBuilder internal IControl Build() { if (_action != null) - return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action())}; + return new Button {Content = _text, Command = ReactiveCommand.Create(() => _action()), Classes = new Classes("AppBarButton")}; if (_command != null) - return new Button {Content = _text, Command = _command, CommandParameter = _commandParameter}; - return new Button {Content = _text}; + return new Button {Content = _text, Command = _command, CommandParameter = _commandParameter, Classes = new Classes("AppBarButton")}; + return new Button {Content = _text, Classes = new Classes("AppBarButton")}; } } diff --git a/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml b/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml index 95fcc9084..e79601d7e 100644 --- a/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml +++ b/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/ProfileTreeView.axaml @@ -14,10 +14,10 @@ - - - - + + + + @@ -35,12 +35,12 @@ - + - + @@ -56,7 +56,7 @@ - + diff --git a/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs b/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs index 5cc8c6db3..5d16abc25 100644 --- a/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs +++ b/src/Avalonia/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/TreeItemViewModel.cs @@ -59,6 +59,12 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree RenameValue = ProfileElement?.Name; }); + Delete = ReactiveCommand.Create(() => + { + if (ProfileElement is RenderProfileElement renderProfileElement) + profileEditorService.ExecuteCommand(new RemoveProfileElement(renderProfileElement)); + }); + this.WhenActivated(d => { _profileEditorService.ProfileElement.Subscribe(element => _currentProfileElement = element).DisposeWith(d); @@ -91,6 +97,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree public ReactiveCommand AddLayer { get; } public ReactiveCommand AddFolder { get; } public ReactiveCommand Rename { get; } + public ReactiveCommand Delete { get; } public string? RenameValue {