Profile elements - Added Windows Explorer-like naming of new elements

This commit is contained in:
Robert committed 2022-02-15 23:19:38 +01:00
1 parent b503906b9a
commit 013bc1c316
4 files changed
+92 -58

No files matched your search

@@ -42,13 +42,13 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
{
if (ProfileElement is Layer targetLayer)
{
Layer layer = new(targetLayer.Parent, "New layer");
Layer layer = new(targetLayer.Parent, targetLayer.GetNewLayerName());
layer.AddLeds(rgbService.EnabledDevices.SelectMany(d => d.Leds));
profileEditorService.ExecuteCommand(new AddProfileElement(layer, targetLayer.Parent, targetLayer.Order));
}
else if (ProfileElement != null)
{
Layer layer = new(ProfileElement, "New layer");
Layer layer = new(ProfileElement, ProfileElement.GetNewLayerName());
layer.AddLeds(rgbService.EnabledDevices.SelectMany(d => d.Leds));
profileEditorService.ExecuteCommand(new AddProfileElement(layer, ProfileElement, 0));
}
@@ -57,9 +57,9 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree
AddFolder = ReactiveCommand.Create(() =>
{
if (ProfileElement is Layer targetLayer)
profileEditorService.ExecuteCommand(new AddProfileElement(new Folder(targetLayer.Parent, "New folder"), targetLayer.Parent, targetLayer.Order));
profileEditorService.ExecuteCommand(new AddProfileElement(new Folder(targetLayer.Parent, targetLayer.Parent.GetNewFolderName()), targetLayer.Parent, targetLayer.Order));
else if (ProfileElement != null)
profileEditorService.ExecuteCommand(new AddProfileElement(new Folder(ProfileElement, "New folder"), ProfileElement, 0));
profileEditorService.ExecuteCommand(new AddProfileElement(new Folder(ProfileElement, ProfileElement.GetNewFolderName()), ProfileElement, 0));
});
Rename = ReactiveCommand.Create(() =>
@@ -56,6 +56,7 @@ public class VisualEditorViewModel : ActivatableViewModelBase
private void CreateVisualizers(ProfileConfiguration? profileConfiguration)
{
// TODO: Monitor and respond to new layers/folders and deletions
_visualizers.Edit(list =>
{
list.Clear();
@@ -7,7 +7,6 @@ using Artemis.UI.Shared.Services.ProfileEditor;
using Avalonia;
using Avalonia.Controls.Mixins;
using ReactiveUI;
using ShimSkiaSharp;
using SKRect = SkiaSharp.SKRect;
namespace Artemis.UI.Screens.ProfileEditor.VisualEditor.Visualizers;