mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Profile editor - Finished most of the refactor except databindings
This commit is contained in:
1 parent
7fff1a593f
commit
fea454ad12
56 files changed
+866
-459
No files matched your search
@@ -22,5 +22,10 @@ namespace Artemis.Core.Services
|
||||
/// Returns a list of all registered layer brush descriptors
|
||||
/// </summary>
|
||||
List<LayerBrushDescriptor> GetLayerBrushes();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the descriptor of the default layer brush
|
||||
/// </summary>
|
||||
LayerBrushDescriptor GetDefaultLayerBrush();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,13 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
internal class LayerBrushService : ILayerBrushService
|
||||
{
|
||||
private readonly ISettingsService _settingsService;
|
||||
|
||||
public LayerBrushService(ISettingsService settingsService)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
}
|
||||
|
||||
public LayerBrushRegistration RegisterLayerBrush(LayerBrushDescriptor descriptor)
|
||||
{
|
||||
if (descriptor == null)
|
||||
@@ -26,5 +33,16 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
return LayerBrushStore.GetAll().Select(r => r.LayerBrushDescriptor).ToList();
|
||||
}
|
||||
|
||||
public LayerBrushDescriptor GetDefaultLayerBrush()
|
||||
{
|
||||
var defaultReference = _settingsService.GetSetting("ProfileEditor.DefaultLayerBrushDescriptor", new LayerBrushReference
|
||||
{
|
||||
BrushPluginGuid = Guid.Parse("92a9d6ba-6f7a-4937-94d5-c1d715b4141a"),
|
||||
BrushType = "ColorBrush"
|
||||
});
|
||||
|
||||
return LayerBrushStore.Get(defaultReference.Value.BrushPluginGuid, defaultReference.Value.BrushType)?.LayerBrushDescriptor;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Core.LayerEffects;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.Storage.Entities.Profile;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
@@ -19,7 +17,12 @@ namespace Artemis.Core.Services
|
||||
private readonly IProfileRepository _profileRepository;
|
||||
private readonly ISurfaceService _surfaceService;
|
||||
|
||||
internal ProfileService(ILogger logger, IPluginService pluginService, ISurfaceService surfaceService, IProfileRepository profileRepository)
|
||||
internal ProfileService(ILogger logger,
|
||||
IPluginService pluginService,
|
||||
ISurfaceService surfaceService,
|
||||
IConditionOperatorService conditionOperatorService,
|
||||
IDataBindingService dataBindingService,
|
||||
IProfileRepository profileRepository)
|
||||
{
|
||||
_logger = logger;
|
||||
_pluginService = pluginService;
|
||||
@@ -261,7 +264,7 @@ namespace Artemis.Core.Services
|
||||
_profileRepository.Save(profileEntity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Populates all missing LEDs on all currently active profiles
|
||||
/// </summary>
|
||||
@@ -272,7 +275,7 @@ namespace Artemis.Core.Services
|
||||
foreach (var profileModule in profileModules.Where(p => p.ActiveProfile != null).ToList())
|
||||
profileModule.ActiveProfile.PopulateLeds(surface);
|
||||
}
|
||||
|
||||
|
||||
#region Event handlers
|
||||
|
||||
private void OnActiveSurfaceConfigurationSelected(object sender, SurfaceConfigurationEventArgs e)
|
||||
@@ -285,7 +288,7 @@ namespace Artemis.Core.Services
|
||||
if (e.Surface.IsActive)
|
||||
ActiveProfilesPopulateLeds(e.Surface);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user