diff --git a/src/Artemis.Core/Models/Profile/Folder.cs b/src/Artemis.Core/Models/Profile/Folder.cs
index afc95727b..ecab68953 100644
--- a/src/Artemis.Core/Models/Profile/Folder.cs
+++ b/src/Artemis.Core/Models/Profile/Folder.cs
@@ -124,6 +124,9 @@ namespace Artemis.Core
Timeline.JumpToStart();
else
Timeline.JumpToEnd();
+
+ foreach (ProfileElement child in Children)
+ child.Reset();
}
///
diff --git a/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorService.cs b/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorService.cs
index d3bc3a8a0..14fd740e3 100644
--- a/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorService.cs
+++ b/src/Artemis.UI.Shared/Services/ProfileEditor/ProfileEditorService.cs
@@ -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
{
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemViewModel.cs
index fbf182b06..bb8e7492e 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/FolderTreeItemViewModel.cs
@@ -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()
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs
index 7a8e24eee..c6cb955ae 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/ProfileTree/LayerTreeItemViewModel.cs
@@ -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);
}
///
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs
index 3b6c99d43..95e39f84e 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Panels/Properties/DataBinding/DataBindingViewModel.cs
@@ -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);
});
}