mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Profiles - Fixed resetting state and reset profiles after editing them
This commit is contained in:
parent
041ed8e0a0
commit
19d47ec9f5
@ -124,6 +124,9 @@ namespace Artemis.Core
|
||||
Timeline.JumpToStart();
|
||||
else
|
||||
Timeline.JumpToEnd();
|
||||
|
||||
foreach (ProfileElement child in Children)
|
||||
child.Reset();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@ -109,7 +109,11 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
// Stop playing and save the current profile
|
||||
Pause();
|
||||
if (_profileConfigurationSubject.Value?.Profile != null)
|
||||
{
|
||||
_profileConfigurationSubject.Value.Profile.Reset();
|
||||
_profileConfigurationSubject.Value.Profile.LastSelectedProfileElement = _profileElementSubject.Value;
|
||||
}
|
||||
|
||||
SaveProfile();
|
||||
|
||||
// No need to deactivate the profile, if needed it will be deactivated next update
|
||||
@ -173,6 +177,7 @@ internal class ProfileEditorService : IProfileEditorService
|
||||
{
|
||||
Pause();
|
||||
_profileService.RenderForEditor = false;
|
||||
_profileConfigurationSubject.Value?.Profile?.Reset();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -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 />
|
||||
|
||||
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user