mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
Profile adaption - Added support for device hint to 'all' devices
Layouts - Round LED sizes to integers Auto-update - Use modern Windows 10 toasts UI - On shutdown wait 6 seconds longer before force-shutdown UI - Use black icons in notifications on white Windows theme Message service - Added optional toast callbacks
This commit is contained in:
1 parent
5c337e9c5e
commit
96c55e5c03
26 files changed
+886
-674
No files matched your search
@@ -48,7 +48,7 @@ namespace Artemis.Core
|
||||
public void Apply(Layer layer, List<ArtemisDevice> devices)
|
||||
{
|
||||
IEnumerable<ArtemisDevice> matches = devices
|
||||
.Where(d => d.RgbDevice.DeviceInfo.DeviceType == DeviceType)
|
||||
.Where(d => DeviceType == RGBDeviceType.All || d.RgbDevice.DeviceInfo.DeviceType == DeviceType)
|
||||
.OrderBy(d => d.Rectangle.Top)
|
||||
.ThenBy(d => d.Rectangle.Left)
|
||||
.Skip(Skip);
|
||||
|
||||
@@ -66,8 +66,8 @@ namespace Artemis.Core
|
||||
|
||||
_leds = new List<ArtemisLed>();
|
||||
|
||||
Load();
|
||||
Adapter = new LayerAdapter(this);
|
||||
Load();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
@@ -242,6 +242,7 @@ namespace Artemis.Core
|
||||
|
||||
ExpandedPropertyGroups.AddRange(LayerEntity.ExpandedPropertyGroups);
|
||||
LoadRenderElement();
|
||||
Adapter.Load();
|
||||
}
|
||||
|
||||
internal override void Save()
|
||||
@@ -276,6 +277,9 @@ namespace Artemis.Core
|
||||
LayerEntity.Leds.Add(ledEntity);
|
||||
}
|
||||
|
||||
// Adaption hints
|
||||
Adapter.Save();
|
||||
|
||||
SaveRenderElement();
|
||||
}
|
||||
|
||||
|
||||
@@ -70,33 +70,42 @@ namespace Artemis.Core
|
||||
public List<IAdaptionHint> DetermineHints(IEnumerable<ArtemisDevice> devices)
|
||||
{
|
||||
List<IAdaptionHint> newHints = new();
|
||||
// Any fully covered device will add a device adaption hint for that type
|
||||
foreach (IGrouping<ArtemisDevice, ArtemisLed> deviceLeds in Layer.Leds.GroupBy(l => l.Device))
|
||||
if (devices.All(DoesLayerCoverDevice))
|
||||
{
|
||||
ArtemisDevice device = deviceLeds.Key;
|
||||
// If there is already an adaption hint for this type, don't add another
|
||||
if (AdaptionHints.Any(h => h is DeviceAdaptionHint d && d.DeviceType == device.RgbDevice.DeviceInfo.DeviceType))
|
||||
continue;
|
||||
if (DoesLayerCoverDevice(device))
|
||||
{
|
||||
DeviceAdaptionHint hint = new() {DeviceType = device.RgbDevice.DeviceInfo.DeviceType};
|
||||
AdaptionHints.Add(hint);
|
||||
newHints.Add(hint);
|
||||
}
|
||||
DeviceAdaptionHint hint = new() {DeviceType = RGBDeviceType.All};
|
||||
AdaptionHints.Add(hint);
|
||||
newHints.Add(hint);
|
||||
}
|
||||
|
||||
// Any fully covered category will add a category adaption hint for its category
|
||||
foreach (DeviceCategory deviceCategory in Enum.GetValues<DeviceCategory>())
|
||||
else
|
||||
{
|
||||
if (AdaptionHints.Any(h => h is CategoryAdaptionHint c && c.Category == deviceCategory))
|
||||
continue;
|
||||
|
||||
List<ArtemisDevice> categoryDevices = devices.Where(d => d.Categories.Contains(deviceCategory)).ToList();
|
||||
if (categoryDevices.Any() && categoryDevices.All(DoesLayerCoverDevice))
|
||||
// Any fully covered device will add a device adaption hint for that type
|
||||
foreach (IGrouping<ArtemisDevice, ArtemisLed> deviceLeds in Layer.Leds.GroupBy(l => l.Device))
|
||||
{
|
||||
CategoryAdaptionHint hint = new() {Category = deviceCategory};
|
||||
AdaptionHints.Add(hint);
|
||||
newHints.Add(hint);
|
||||
ArtemisDevice device = deviceLeds.Key;
|
||||
// If there is already an adaption hint for this type, don't add another
|
||||
if (AdaptionHints.Any(h => h is DeviceAdaptionHint d && d.DeviceType == device.RgbDevice.DeviceInfo.DeviceType))
|
||||
continue;
|
||||
if (DoesLayerCoverDevice(device))
|
||||
{
|
||||
DeviceAdaptionHint hint = new() {DeviceType = device.RgbDevice.DeviceInfo.DeviceType};
|
||||
AdaptionHints.Add(hint);
|
||||
newHints.Add(hint);
|
||||
}
|
||||
}
|
||||
|
||||
// Any fully covered category will add a category adaption hint for its category
|
||||
foreach (DeviceCategory deviceCategory in Enum.GetValues<DeviceCategory>())
|
||||
{
|
||||
if (AdaptionHints.Any(h => h is CategoryAdaptionHint c && c.Category == deviceCategory))
|
||||
continue;
|
||||
|
||||
List<ArtemisDevice> categoryDevices = devices.Where(d => d.Categories.Contains(deviceCategory)).ToList();
|
||||
if (categoryDevices.Any() && categoryDevices.All(DoesLayerCoverDevice))
|
||||
{
|
||||
CategoryAdaptionHint hint = new() {Category = deviceCategory};
|
||||
AdaptionHints.Add(hint);
|
||||
newHints.Add(hint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Artemis.Core
|
||||
internal ProfileDescriptor(ProfileModule profileModule, ProfileEntity profileEntity)
|
||||
{
|
||||
ProfileModule = profileModule;
|
||||
|
||||
|
||||
Id = profileEntity.Id;
|
||||
Name = profileEntity.Name;
|
||||
IsLastActiveProfile = profileEntity.IsActive;
|
||||
@@ -38,5 +38,9 @@ namespace Artemis.Core
|
||||
/// </summary>
|
||||
public bool IsLastActiveProfile { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a boolean indicating whether the profile will be adapted the next time it is activated
|
||||
/// </summary>
|
||||
public bool NeedsAdaption { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user