Profiles - Fixed resetting state and reset profiles after editing them

This commit is contained in:
Robert committed 2022-08-13 11:18:24 +02:00
1 parent 041ed8e0a0
commit 19d47ec9f5
5 files changed
+36 -3

No files matched your search

@@ -2,6 +2,7 @@
using System.Linq;
using System.Threading.Tasks;
using Artemis.Core;
using Artemis.Core.Services;
using Artemis.Storage.Entities.Profile;
using Artemis.UI.Extensions;
using Artemis.UI.Ninject.Factories;
@@ -13,9 +14,17 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree;
public class LayerTreeItemViewModel : TreeItemViewModel
{
public LayerTreeItemViewModel(TreeItemViewModel? parent, Layer layer, IWindowService windowService, IProfileEditorService profileEditorService, IProfileEditorVmFactory profileEditorVmFactory)
private readonly IRgbService _rgbService;
public LayerTreeItemViewModel(TreeItemViewModel? parent,
Layer layer,
IWindowService windowService,
IProfileEditorService profileEditorService,
IRgbService rgbService,
IProfileEditorVmFactory profileEditorVmFactory)
: base(parent, layer, windowService, profileEditorService, profileEditorVmFactory)
{
_rgbService = rgbService;
Layer = layer;
}
@@ -34,6 +43,7 @@ public class LayerTreeItemViewModel : TreeItemViewModel
Layer copied = new(Layer.Profile, Layer.Parent, copy);
ProfileEditorService.ExecuteCommand(new AddProfileElement(copied, Layer.Parent, Layer.Order - 1));
Layer.Profile.PopulateLeds(_rgbService.EnabledDevices);
}
protected override async Task ExecuteCopy()
@@ -55,6 +65,7 @@ public class LayerTreeItemViewModel : TreeItemViewModel
pasted.Name = parent.GetNewLayerName(pasted.Name + " - copy");
ProfileEditorService.ExecuteCommand(new AddProfileElement(pasted, parent, Layer.Order - 1));
Layer.Profile.PopulateLeds(_rgbService.EnabledDevices);
}
/// <inheritdoc />