mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Made devices aware of the plugin that loaded them
Fixed Corsair LL Fans layout Expanded render events Added identify option to device settings, must move this to be reusable though
This commit is contained in:
1 parent
ae41c6cac3
commit
05eed5ba00
23 files changed
+400
-229
No files matched your search
@@ -1,18 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using Artemis.Core.Extensions;
|
||||
using Artemis.Core.Plugins.Abstract;
|
||||
using Artemis.Storage.Entities;
|
||||
using RGB.NET.Core;
|
||||
using Point = RGB.NET.Core.Point;
|
||||
using Rectangle = System.Drawing.Rectangle;
|
||||
|
||||
namespace Artemis.Core.Models.Surface
|
||||
{
|
||||
public class Device
|
||||
{
|
||||
internal Device(IRGBDevice rgbDevice, Surface surface)
|
||||
internal Device(IRGBDevice rgbDevice, Plugin plugin, Surface surface)
|
||||
{
|
||||
RgbDevice = rgbDevice;
|
||||
Plugin = plugin;
|
||||
Surface = surface;
|
||||
Configuration = new DeviceEntity();
|
||||
Leds = rgbDevice.Select(l => new DeviceLed(l, this)).ToList().AsReadOnly();
|
||||
@@ -24,9 +29,10 @@ namespace Artemis.Core.Models.Surface
|
||||
CalculateRenderRectangle();
|
||||
}
|
||||
|
||||
internal Device(IRGBDevice rgbDevice, Surface surface, DeviceEntity configuration)
|
||||
internal Device(IRGBDevice rgbDevice, Plugin plugin, Surface surface, DeviceEntity configuration)
|
||||
{
|
||||
RgbDevice = rgbDevice;
|
||||
Plugin = plugin;
|
||||
Surface = surface;
|
||||
Configuration = configuration;
|
||||
Leds = rgbDevice.Select(l => new DeviceLed(l, this)).ToList().AsReadOnly();
|
||||
@@ -36,8 +42,10 @@ namespace Artemis.Core.Models.Surface
|
||||
}
|
||||
|
||||
public Rectangle RenderRectangle { get; private set; }
|
||||
public GraphicsPath RenderPath { get; private set; }
|
||||
|
||||
public IRGBDevice RgbDevice { get; private set; }
|
||||
public Plugin Plugin { get; }
|
||||
public Surface Surface { get; private set; }
|
||||
public DeviceEntity Configuration { get; private set; }
|
||||
public ReadOnlyCollection<DeviceLed> Leds { get; set; }
|
||||
@@ -93,8 +101,12 @@ namespace Artemis.Core.Models.Surface
|
||||
|
||||
foreach (var led in Leds)
|
||||
led.CalculateRenderRectangle();
|
||||
}
|
||||
|
||||
var path = new GraphicsPath();
|
||||
path.AddRectangles(Leds.Select(l => l.AbsoluteRenderRectangle).ToArray());
|
||||
RenderPath = path;
|
||||
}
|
||||
|
||||
internal void Destroy()
|
||||
{
|
||||
Configuration = null;
|
||||
|
||||
@@ -33,16 +33,6 @@ namespace Artemis.Core.Models.Surface
|
||||
Name = surfaceEntity.Name;
|
||||
IsActive = surfaceEntity.IsActive;
|
||||
Devices = new List<Device>();
|
||||
|
||||
if (surfaceEntity.DeviceEntities == null)
|
||||
return;
|
||||
|
||||
foreach (var position in surfaceEntity.DeviceEntities)
|
||||
{
|
||||
var device = rgbSurface.Devices.FirstOrDefault(d => d.GetDeviceHashCode() == position.DeviceHashCode);
|
||||
if (device != null)
|
||||
Devices.Add(new Device(device, this, position));
|
||||
}
|
||||
}
|
||||
|
||||
public RGBSurface RgbSurface { get; }
|
||||
|
||||
Reference in new issue
Block a user