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

Profile editor - Added layer deleting WIP

This commit is contained in:
Robert 2022-01-10 21:32:08 +01:00
parent 5802855eb1
commit bf1aad1549
3 changed files with 17 additions and 10 deletions

View File

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

View File

@ -14,10 +14,10 @@
</TreeView.Styles>
<TreeView.KeyBindings>
<KeyBinding Gesture="F2" Command="{Binding SelectedChild.Rename}" />
<KeyBinding Gesture="Delete" Command="{Binding Delete}" CommandParameter="{Binding SelectedTreeItem}" />
<KeyBinding Gesture="Ctrl+D" Command="{Binding Duplicate}" CommandParameter="{Binding SelectedTreeItem}" />
<KeyBinding Gesture="Ctrl+C" Command="{Binding Copy}" CommandParameter="{Binding SelectedTreeItem}" />
<KeyBinding Gesture="Ctrl+V" Command="{Binding Paste}" CommandParameter="{Binding SelectedTreeItem}" />
<KeyBinding Gesture="Delete" Command="{Binding SelectedChild.Delete}" />
<KeyBinding Gesture="Ctrl+D" Command="{Binding SelectedChild.Duplicate}" />
<KeyBinding Gesture="Ctrl+C" Command="{Binding SelectedChild.Copy}" />
<KeyBinding Gesture="Ctrl+V" Command="{Binding SelectedChild.Paste}" />
</TreeView.KeyBindings>
<TreeView.ItemTemplate>
<TreeDataTemplate ItemsSource="{Binding Children}">
@ -35,12 +35,12 @@
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Header="Duplicate" Command="{Binding Duplicate}" InputGesture="Ctrl+D" IsEnabled="False">
<MenuItem Header="Duplicate" Command="{Binding Duplicate}" InputGesture="Ctrl+D">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="ContentDuplicate" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Copy" Command="{Binding Copy}" InputGesture="Ctrl+C" IsEnabled="False">
<MenuItem Header="Copy" Command="{Binding Copy}" InputGesture="Ctrl+C">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="ContentCopy" />
</MenuItem.Icon>
@ -56,7 +56,7 @@
<avalonia:MaterialIcon Kind="RenameBox" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Delete" Command="{Binding Delete}" InputGesture="Delete" IsEnabled="False">
<MenuItem Header="Delete" Command="{Binding Delete}" InputGesture="Delete">
<MenuItem.Icon>
<avalonia:MaterialIcon Kind="TrashCan" />
</MenuItem.Icon>

View File

@ -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<Unit, Unit> AddLayer { get; }
public ReactiveCommand<Unit, Unit> AddFolder { get; }
public ReactiveCommand<Unit, Unit> Rename { get; }
public ReactiveCommand<Unit, Unit> Delete { get; }
public string? RenameValue
{