diff --git a/src/Artemis.Core/Services/Storage/Interfaces/ISurfaceService.cs b/src/Artemis.Core/Services/Storage/Interfaces/ISurfaceService.cs
index 23a6c87bf..630a65220 100644
--- a/src/Artemis.Core/Services/Storage/Interfaces/ISurfaceService.cs
+++ b/src/Artemis.Core/Services/Storage/Interfaces/ISurfaceService.cs
@@ -45,9 +45,13 @@ namespace Artemis.Core.Services
void DeleteSurfaceConfiguration(ArtemisSurface surface);
///
- /// Applies auto-arranging logic to the current active surface
+ /// Applies auto-arranging logic to a surface
///
- void AutoArrange();
+ ///
+ /// The surface to apply auto-arrange to. If the
+ /// is used.
+ ///
+ void AutoArrange(ArtemisSurface? artemisSurface = null);
///
/// Occurs when the active device entity has been changed
diff --git a/src/Artemis.Core/Services/Storage/SurfaceService.cs b/src/Artemis.Core/Services/Storage/SurfaceService.cs
index 829d04424..7d1229fb5 100644
--- a/src/Artemis.Core/Services/Storage/SurfaceService.cs
+++ b/src/Artemis.Core/Services/Storage/SurfaceService.cs
@@ -49,6 +49,9 @@ namespace Artemis.Core.Services
configuration.Devices.Add(new ArtemisDevice(rgbDevice, deviceProvider, configuration));
}
+ // Auto-arrange the new config
+ AutoArrange(configuration);
+
lock (_surfaceConfigurations)
{
_surfaceRepository.Add(configuration.SurfaceEntity);
@@ -102,6 +105,7 @@ namespace Artemis.Core.Services
deviceConfiguration.ApplyToRgbDevice();
}
}
+
surface.UpdateLedMap();
_surfaceRepository.Save(surface.SurfaceEntity);
@@ -200,11 +204,13 @@ namespace Artemis.Core.Services
#region AutoLayout
- public void AutoArrange()
+ public void AutoArrange(ArtemisSurface? artemisSurface = null)
{
+ artemisSurface ??= ActiveSurface;
+
SurfaceArrangement surfaceArrangement = SurfaceArrangement.GetDefaultArrangement();
- surfaceArrangement.Arrange(ActiveSurface);
- UpdateSurfaceConfiguration(ActiveSurface, true);
+ surfaceArrangement.Arrange(artemisSurface);
+ UpdateSurfaceConfiguration(artemisSurface, true);
}
#endregion