Profiles - Added profile adaption based on configurable hints

Layers - Added hints UI accesible from profile tree
Surface - Added device categories used by profile adaption
This commit is contained in:
Robert Beekman authored and Robert committed 2021-05-13 19:57:38 +02:00
1 parent 4865254ab6
commit 57193e739e
34 files changed
+1295 -58

No files matched your search

+3
View File
@@ -314,6 +314,9 @@ namespace Artemis.Core.Services
{
SurfaceArrangement surfaceArrangement = SurfaceArrangement.GetDefaultArrangement();
surfaceArrangement.Arrange(_devices);
foreach (ArtemisDevice artemisDevice in _devices)
artemisDevice.ApplyDefaultCategories();
SaveDevices();
}
@@ -121,5 +121,11 @@ namespace Artemis.Core.Services
/// <param name="nameAffix">Text to add after the name of the profile (separated by a dash)</param>
/// <returns></returns>
ProfileDescriptor ImportProfile(string json, ProfileModule profileModule, string nameAffix = "imported");
/// <summary>
/// Adapts a given profile to the currently active devices
/// </summary>
/// <param name="profile">The profile to adapt</param>
void AdaptProfile(Profile profile);
}
}
@@ -122,7 +122,7 @@ namespace Artemis.Core.Services
ProfileEntity entity = _profileRepository.Get(module.ActiveProfile.EntityId);
Profile profile = new(module, entity);
InstantiateProfile(profile);
module.ChangeActiveProfile(null, _rgbService.EnabledDevices);
module.ChangeActiveProfile(profile, _rgbService.EnabledDevices);
}
@@ -166,7 +166,6 @@ namespace Artemis.Core.Services
}
public void ClearActiveProfile(ProfileModule module)
{
module.ChangeActiveProfile(null, _rgbService.EnabledDevices);
@@ -294,13 +293,21 @@ namespace Artemis.Core.Services
return new ProfileDescriptor(profileModule, profileEntity);
}
/// <inheritdoc />
public void AdaptProfile(Profile profile)
{
List<ArtemisDevice> devices = _rgbService.EnabledDevices.ToList();
foreach (Layer layer in profile.GetAllLayers())
layer.Adapter.Adapt(devices);
}
#region Event handlers
private void RgbServiceOnLedsChanged(object? sender, EventArgs e)
{
ActiveProfilesPopulateLeds();
}
#endregion
}
}