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();
|
Timeline.JumpToStart();
|
||||||
else
|
else
|
||||||
Timeline.JumpToEnd();
|
Timeline.JumpToEnd();
|
||||||
|
|
||||||
|
foreach (ProfileElement child in Children)
|
||||||
|
child.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -109,7 +109,11 @@ internal class ProfileEditorService : IProfileEditorService
|
|||||||
// Stop playing and save the current profile
|
// Stop playing and save the current profile
|
||||||
Pause();
|
Pause();
|
||||||
if (_profileConfigurationSubject.Value?.Profile != null)
|
if (_profileConfigurationSubject.Value?.Profile != null)
|
||||||
|
{
|
||||||
|
_profileConfigurationSubject.Value.Profile.Reset();
|
||||||
_profileConfigurationSubject.Value.Profile.LastSelectedProfileElement = _profileElementSubject.Value;
|
_profileConfigurationSubject.Value.Profile.LastSelectedProfileElement = _profileElementSubject.Value;
|
||||||
|
}
|
||||||
|
|
||||||
SaveProfile();
|
SaveProfile();
|
||||||
|
|
||||||
// No need to deactivate the profile, if needed it will be deactivated next update
|
// No need to deactivate the profile, if needed it will be deactivated next update
|
||||||
@ -173,6 +177,7 @@ internal class ProfileEditorService : IProfileEditorService
|
|||||||
{
|
{
|
||||||
Pause();
|
Pause();
|
||||||
_profileService.RenderForEditor = false;
|
_profileService.RenderForEditor = false;
|
||||||
|
_profileConfigurationSubject.Value?.Profile?.Reset();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
|
using Artemis.Core.Services;
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
using Artemis.UI.Extensions;
|
using Artemis.UI.Extensions;
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
@ -13,9 +14,17 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree;
|
|||||||
|
|
||||||
public class FolderTreeItemViewModel : TreeItemViewModel
|
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)
|
: base(parent, folder, windowService, profileEditorService, profileEditorVmFactory)
|
||||||
{
|
{
|
||||||
|
_rgbService = rgbService;
|
||||||
Folder = folder;
|
Folder = folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,6 +63,7 @@ public class FolderTreeItemViewModel : TreeItemViewModel
|
|||||||
pasted.Name = parent.GetNewFolderName(pasted.Name + " - copy");
|
pasted.Name = parent.GetNewFolderName(pasted.Name + " - copy");
|
||||||
|
|
||||||
ProfileEditorService.ExecuteCommand(new AddProfileElement(pasted, parent, Folder.Order - 1));
|
ProfileEditorService.ExecuteCommand(new AddProfileElement(pasted, parent, Folder.Order - 1));
|
||||||
|
Folder.Profile.PopulateLeds(_rgbService.EnabledDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ExecutePasteInto()
|
private async Task ExecutePasteInto()
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
|
using Artemis.Core.Services;
|
||||||
using Artemis.Storage.Entities.Profile;
|
using Artemis.Storage.Entities.Profile;
|
||||||
using Artemis.UI.Extensions;
|
using Artemis.UI.Extensions;
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
@ -13,9 +14,17 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree;
|
|||||||
|
|
||||||
public class LayerTreeItemViewModel : TreeItemViewModel
|
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)
|
: base(parent, layer, windowService, profileEditorService, profileEditorVmFactory)
|
||||||
{
|
{
|
||||||
|
_rgbService = rgbService;
|
||||||
Layer = layer;
|
Layer = layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,6 +43,7 @@ public class LayerTreeItemViewModel : TreeItemViewModel
|
|||||||
|
|
||||||
Layer copied = new(Layer.Profile, Layer.Parent, copy);
|
Layer copied = new(Layer.Profile, Layer.Parent, copy);
|
||||||
ProfileEditorService.ExecuteCommand(new AddProfileElement(copied, Layer.Parent, Layer.Order - 1));
|
ProfileEditorService.ExecuteCommand(new AddProfileElement(copied, Layer.Parent, Layer.Order - 1));
|
||||||
|
Layer.Profile.PopulateLeds(_rgbService.EnabledDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task ExecuteCopy()
|
protected override async Task ExecuteCopy()
|
||||||
@ -55,6 +65,7 @@ public class LayerTreeItemViewModel : TreeItemViewModel
|
|||||||
pasted.Name = parent.GetNewLayerName(pasted.Name + " - copy");
|
pasted.Name = parent.GetNewLayerName(pasted.Name + " - copy");
|
||||||
|
|
||||||
ProfileEditorService.ExecuteCommand(new AddProfileElement(pasted, parent, Layer.Order - 1));
|
ProfileEditorService.ExecuteCommand(new AddProfileElement(pasted, parent, Layer.Order - 1));
|
||||||
|
Layer.Profile.PopulateLeds(_rgbService.EnabledDevices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@ -53,7 +53,11 @@ public class DataBindingViewModel : ActivatableViewModelBase
|
|||||||
|
|
||||||
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Render, Update);
|
DispatcherTimer updateTimer = new(TimeSpan.FromMilliseconds(60.0 / 1000), DispatcherPriority.Render, Update);
|
||||||
updateTimer.Start();
|
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