mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Redid some of the surface editor and started working on layout saving
This commit is contained in:
1 parent
f3650445d9
commit
a34786fb5d
48 files changed
+1012
-107
No files matched your search
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.Models.Surface;
|
||||
using Artemis.Core.Services.Interfaces;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
|
||||
namespace Artemis.Core.Services.Storage
|
||||
{
|
||||
public class SurfaceService : ISurfaceService
|
||||
{
|
||||
private readonly ISurfaceRepository _surfaceRepository;
|
||||
|
||||
public SurfaceService(ISurfaceRepository surfaceRepository)
|
||||
{
|
||||
_surfaceRepository = surfaceRepository;
|
||||
}
|
||||
|
||||
public async Task<List<SurfaceConfiguration>> GetSurfaceConfigurations()
|
||||
{
|
||||
var surfaceEntities = await _surfaceRepository.GetAllAsync();
|
||||
var configs = new List<SurfaceConfiguration>();
|
||||
foreach (var surfaceEntity in surfaceEntities)
|
||||
configs.Add(new SurfaceConfiguration(surfaceEntity));
|
||||
|
||||
return configs;
|
||||
}
|
||||
|
||||
public SurfaceConfiguration GetActiveSurfaceConfiguration()
|
||||
{
|
||||
var entity = _surfaceRepository.GetAll().FirstOrDefault(d => d.IsActive);
|
||||
return entity != null ? new SurfaceConfiguration(entity) : null;
|
||||
}
|
||||
}
|
||||
|
||||
public interface ISurfaceService : IArtemisService
|
||||
{
|
||||
Task<List<SurfaceConfiguration>> GetSurfaceConfigurations();
|
||||
SurfaceConfiguration GetActiveSurfaceConfiguration();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user