diff --git a/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesModel.cs b/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesModel.cs
index fccb322f9..b31c0972e 100644
--- a/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesModel.cs
+++ b/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesModel.cs
@@ -1,4 +1,5 @@
-using Artemis.Profiles.Layers.Models;
+using System.ComponentModel;
+using Artemis.Profiles.Layers.Models;
namespace Artemis.Profiles.Layers.Types.Audio
{
@@ -10,5 +11,14 @@ namespace Artemis.Profiles.Layers.Types.Audio
public int Sensitivity { get; set; }
public double FadeSpeed { get; set; }
+ public Direction Direction { get; set; }
+ }
+
+ public enum Direction
+ {
+ [Description("Top to bottom")] TopToBottom,
+ [Description("Bottom to top")] BottomToTop,
+ [Description("Left to right")] LeftToRight,
+ [Description("Right to left")] RightToLeft
}
}
\ No newline at end of file
diff --git a/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesView.xaml b/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesView.xaml
index 37d65e0fd..a400d2b0a 100644
--- a/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesView.xaml
+++ b/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioPropertiesView.xaml
@@ -4,9 +4,21 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
- xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:properties="clr-namespace:Artemis.Profiles.Layers.Types.Audio"
+ xmlns:system="clr-namespace:System;assembly=mscorlib"
+ xmlns:converters="clr-namespace:Artemis.Utilities.Converters"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="500">
+
+
+
+
+
+
+
+
@@ -49,12 +61,18 @@
-
+
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioType.cs b/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioType.cs
index cf471f533..41467bb04 100644
--- a/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioType.cs
+++ b/Artemis/Artemis/Profiles/Layers/Types/Audio/AudioType.cs
@@ -41,6 +41,7 @@ namespace Artemis.Profiles.Layers.Types.Audio
_waveIn.StartRecording();
}
+ [JsonIgnore]
public List SpectrumData { get; set; } = new List();
public string Name { get; } = "Keyboard - Audio visualization";
diff --git a/Artemis/Artemis/Profiles/Layers/Types/KeyPress/KeyPressPropertiesView.xaml b/Artemis/Artemis/Profiles/Layers/Types/KeyPress/KeyPressPropertiesView.xaml
index ef1366a7e..49378d184 100644
--- a/Artemis/Artemis/Profiles/Layers/Types/KeyPress/KeyPressPropertiesView.xaml
+++ b/Artemis/Artemis/Profiles/Layers/Types/KeyPress/KeyPressPropertiesView.xaml
@@ -35,7 +35,7 @@
VerticalAlignment="Top" Height="18" />
diff --git a/Artemis/Artemis/ViewModels/Profiles/LayerEditorViewModel.cs b/Artemis/Artemis/ViewModels/Profiles/LayerEditorViewModel.cs
index b2218c502..87920681f 100644
--- a/Artemis/Artemis/ViewModels/Profiles/LayerEditorViewModel.cs
+++ b/Artemis/Artemis/ViewModels/Profiles/LayerEditorViewModel.cs
@@ -15,6 +15,7 @@ using Artemis.ViewModels.Profiles.Events;
using Caliburn.Micro;
using Newtonsoft.Json;
using Ninject;
+using NuGet;
namespace Artemis.ViewModels.Profiles
{
@@ -40,6 +41,7 @@ namespace Artemis.ViewModels.Profiles
Layer = layer;
ProposedLayer = GeneralHelpers.Clone(layer);
+ ProposedLayer.Children.Clear();
if (Layer.Properties == null)
Layer.SetupProperties();
@@ -165,24 +167,7 @@ namespace Artemis.ViewModels.Profiles
public void Apply()
{
LayerPropertiesViewModel?.ApplyProperties();
- var appliedLayer = GeneralHelpers.Clone(ProposedLayer);
-
- // Fix relations
- if (Layer.Parent != null)
- {
- Layer.Parent.Children.Add(appliedLayer);
- Layer.Parent.Children.Remove(Layer);
- }
- else
- {
- Layer.Profile.Layers.Add(appliedLayer);
- Layer.Profile.Layers.Remove(Layer);
- }
- appliedLayer.Children.Clear();
- foreach (var layerModel in Layer.Children)
- appliedLayer.Children.Add(layerModel);
-
- Layer = appliedLayer;
+ JsonConvert.PopulateObject(JsonConvert.SerializeObject(ProposedLayer), Layer);
// TODO: EventPropVM must have layer too
if (EventPropertiesViewModel != null)
@@ -227,7 +212,11 @@ namespace Artemis.ViewModels.Profiles
ProposedLayer.Properties.Contain = Layer.Properties.Contain;
}
- var current = JsonConvert.SerializeObject(Layer, Formatting.Indented);
+ // Ignore the children, can't just temporarily add them to the proposed layer because
+ // that would upset the child layers' relations (sounds like an episode of Dr. Phil amirite?)
+ var currentObj = GeneralHelpers.Clone(Layer);
+ currentObj.Children.Clear();
+ var current = JsonConvert.SerializeObject(currentObj, Formatting.Indented);
var proposed = JsonConvert.SerializeObject(ProposedLayer, Formatting.Indented);
if (current.Equals(proposed))