mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Profiles - Fixed resetting state and reset profiles after editing them
This commit is contained in:
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 FolderTreeItemViewModel : TreeItemViewModel
|
||||
{
|
||||
public FolderTreeItemViewModel(TreeItemViewModel? parent, Folder folder, IWindowService windowService, IProfileEditorService profileEditorService, IProfileEditorVmFactory profileEditorVmFactory)
|
||||
private readonly IRgbService _rgbService;
|
||||
|
||||
public FolderTreeItemViewModel(TreeItemViewModel? parent,
|
||||
Folder folder,
|
||||
IWindowService windowService,
|
||||
IProfileEditorService profileEditorService,
|
||||
IRgbService rgbService,
|
||||
IProfileEditorVmFactory profileEditorVmFactory)
|
||||
: base(parent, folder, windowService, profileEditorService, profileEditorVmFactory)
|
||||
{
|
||||
_rgbService = rgbService;
|
||||
Folder = folder;
|
||||
}
|
||||
|
||||
@@ -54,6 +63,7 @@ public class FolderTreeItemViewModel : TreeItemViewModel
|
||||
pasted.Name = parent.GetNewFolderName(pasted.Name + " - copy");
|
||||
|
||||
ProfileEditorService.ExecuteCommand(new AddProfileElement(pasted, parent, Folder.Order - 1));
|
||||
Folder.Profile.PopulateLeds(_rgbService.EnabledDevices);
|
||||
}
|
||||
|
||||
private async Task ExecutePasteInto()
|
||||
|
||||
@@ -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 />
|
||||
|
||||
+5
-1
@@ -53,7 +53,11 @@ public class DataBindingViewModel : ActivatableViewModelBase
|
||||
|
||||
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Render, Update);
|
||||
updateTimer.Start();
|
||||
Disposable.Create(() => updateTimer.Stop()).DisposeWith(d);
|
||||
Disposable.Create(() =>
|
||||
{
|
||||
updateTimer.Stop();
|
||||
_profileEditorService.SaveProfile();
|
||||
}).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user