diff --git a/docfx/docfx_project/filterConfig.yml b/docfx/docfx_project/filterConfig.yml index 25ee42545..1c9458383 100644 --- a/docfx/docfx_project/filterConfig.yml +++ b/docfx/docfx_project/filterConfig.yml @@ -14,6 +14,9 @@ apiRules: - exclude: uidRegex: ^Artemis\.Core\.Properties type: Type +- exclude: + uidRegex: ^Artemis\.Core\.Services\.IArtemisService + type: Type - exclude: uidRegex: ^Artemis\.UI\.Shared\.Properties type: Type \ No newline at end of file diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index 86a470004..baa5c2106 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -59,6 +59,9 @@ + + ..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Brushes.dll + ..\..\..\RGB.NET\bin\netstandard2.0\RGB.NET.Core.dll diff --git a/src/Artemis.Core/Services/DeviceService.cs b/src/Artemis.Core/Services/DeviceService.cs index 473c333cf..8fdc47766 100644 --- a/src/Artemis.Core/Services/DeviceService.cs +++ b/src/Artemis.Core/Services/DeviceService.cs @@ -1,17 +1,13 @@ -using System.Threading.Tasks; -using SkiaSharp; +using System.Linq; +using System.Threading.Tasks; +using RGB.NET.Brushes; +using RGB.NET.Core; +using RGB.NET.Groups; namespace Artemis.Core.Services { internal class DeviceService : IDeviceService { - private readonly ICoreService _coreService; - - public DeviceService(ICoreService coreService) - { - _coreService = coreService; - } - public void IdentifyDevice(ArtemisDevice device) { BlinkDevice(device, 0); @@ -19,36 +15,26 @@ namespace Artemis.Core.Services private void BlinkDevice(ArtemisDevice device, int blinkCount) { - // Draw a white overlay over the device - void DrawOverlay(object sender, FrameRenderingEventArgs args) + // Create a LED group way at the top + var ledGroup = new ListLedGroup(device.Leds.Select(l => l.RgbLed)) { - args.Canvas.DrawPath(device.RenderPath, new SKPaint {Color = new SKColor(255, 255, 255)}); - } + Brush = new SolidColorBrush(new Color(255, 255, 255)), + ZIndex = 999 + }; - _coreService.FrameRendering += DrawOverlay; - - // After 200ms, stop drawing the overlay + // After 200ms, detach the LED group Task.Run(async () => { await Task.Delay(200); - _coreService.FrameRendering -= DrawOverlay; + ledGroup.Detach(); if (blinkCount < 5) { - // After another 200ms, draw the overlay again, repeat six times + // After another 200ms, start over, repeat six times await Task.Delay(200); BlinkDevice(device, blinkCount + 1); } }); } } - - public interface IDeviceService : IArtemisService - { - /// - /// Identifies the device by making it blink white 5 times - /// - /// - void IdentifyDevice(ArtemisDevice device); - } } \ No newline at end of file diff --git a/src/Artemis.Core/Services/Interfaces/IDeviceService.cs b/src/Artemis.Core/Services/Interfaces/IDeviceService.cs new file mode 100644 index 000000000..cb09e83e7 --- /dev/null +++ b/src/Artemis.Core/Services/Interfaces/IDeviceService.cs @@ -0,0 +1,11 @@ +namespace Artemis.Core.Services +{ + public interface IDeviceService : IArtemisService + { + /// + /// Identifies the device by making it blink white 5 times + /// + /// + void IdentifyDevice(ArtemisDevice device); + } +} \ No newline at end of file diff --git a/src/Artemis.Core/Services/Storage/SurfaceService.cs b/src/Artemis.Core/Services/Storage/SurfaceService.cs index 8d6a57758..fabee1a66 100644 --- a/src/Artemis.Core/Services/Storage/SurfaceService.cs +++ b/src/Artemis.Core/Services/Storage/SurfaceService.cs @@ -8,7 +8,7 @@ using Serilog; namespace Artemis.Core.Services { - public class SurfaceService : ISurfaceService + internal class SurfaceService : ISurfaceService { private readonly ILogger _logger; private readonly IPluginService _pluginService; @@ -17,7 +17,7 @@ namespace Artemis.Core.Services private readonly List _surfaceConfigurations; private readonly ISurfaceRepository _surfaceRepository; - internal SurfaceService(ILogger logger, ISurfaceRepository surfaceRepository, IRgbService rgbService, IPluginService pluginService, ISettingsService settingsService) + public SurfaceService(ILogger logger, ISurfaceRepository surfaceRepository, IRgbService rgbService, IPluginService pluginService, ISettingsService settingsService) { _logger = logger; _surfaceRepository = surfaceRepository;