Added UI elements borrowed from DarthAffe

Added a WIP of profile classes
This commit is contained in:
SpoinkyNL committed 2018-01-13 00:06:28 +01:00
1 parent 7d4c5dbae6
commit 0c47b9a2fb
23 files changed
+847 -108

No files matched your search

+60 -51
View File
@@ -68,39 +68,6 @@
<Reference Include="Ninject.Extensions.Factory, Version=3.3.2.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Brushes, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Brushes.0.0.1.20\lib\net45\RGB.NET.Brushes.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Core, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Core.0.0.1.20\lib\net45\RGB.NET.Core.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Decorators, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Decorators.0.0.1.20\lib\net45\RGB.NET.Decorators.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Asus, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.Asus.0.0.1.20\lib\net45\RGB.NET.Devices.Asus.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.CoolerMaster, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\lib\net45\RGB.NET.Devices.CoolerMaster.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Corsair, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.Corsair.0.0.1.20\lib\net45\RGB.NET.Devices.Corsair.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Logitech, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.Logitech.0.0.1.20\lib\net45\RGB.NET.Devices.Logitech.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Msi, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.Msi.0.0.1.20\lib\net45\RGB.NET.Devices.Msi.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Novation, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.Novation.0.0.1.20\lib\net45\RGB.NET.Devices.Novation.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Devices.Razer, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Devices.Razer.0.0.1.20\lib\net45\RGB.NET.Devices.Razer.dll</HintPath>
</Reference>
<Reference Include="RGB.NET.Groups, Version=0.0.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RGB.NET.Groups.0.0.1.20\lib\net45\RGB.NET.Groups.dll</HintPath>
</Reference>
<Reference Include="Sanford.Multimedia.Midi, Version=6.4.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Sanford.Multimedia.Midi.6.4.2\lib\net20\Sanford.Multimedia.Midi.dll</HintPath>
</Reference>
@@ -188,10 +155,14 @@
<Compile Include="Events\DeviceEventArgs.cs" />
<Compile Include="Exceptions\ArtemisCoreException.cs" />
<Compile Include="Exceptions\ArtemisPluginException.cs" />
<Compile Include="ProfileElements\Folder.cs" />
<Compile Include="ProfileElements\Interfaces\IProfileElement.cs" />
<Compile Include="ProfileElements\Profile.cs" />
<Compile Include="Ninject\CoreModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\CoreService.cs" />
<Compile Include="Services\DeviceService.cs" />
<Compile Include="Services\RgbService.cs" />
<Compile Include="Services\Interfaces\IRgbService.cs" />
<Compile Include="Services\Interfaces\IArtemisService.cs" />
<Compile Include="Services\Interfaces\ICoreService.cs" />
<Compile Include="Services\Interfaces\IPluginService.cs" />
@@ -207,27 +178,65 @@
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Brushes\RGB.NET.Brushes.csproj">
<Project>{347c5f0f-f490-4dec-9c1c-6e84750d838d}</Project>
<Name>RGB.NET.Brushes</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Core\RGB.NET.Core.csproj">
<Project>{5a4f9a75-75fe-47cd-90e5-914d5b20d232}</Project>
<Name>RGB.NET.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Decorators\RGB.NET.Decorators.csproj">
<Project>{7012c431-244a-453f-b7fd-59e030cdbc44}</Project>
<Name>RGB.NET.Decorators</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.Asus\RGB.NET.Devices.Asus.csproj">
<Project>{4f2f3fbd-a1e4-4968-a2ad-0514959e5e59}</Project>
<Name>RGB.NET.Devices.Asus</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.CoolerMaster\RGB.NET.Devices.CoolerMaster.csproj">
<Project>{85609427-d433-44e2-a249-ce890b66d845}</Project>
<Name>RGB.NET.Devices.CoolerMaster</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.Corsair\RGB.NET.Devices.Corsair.csproj">
<Project>{dda8c4c2-8abf-4fa0-9af9-c47ad0bfe47d}</Project>
<Name>RGB.NET.Devices.Corsair</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.Logitech\RGB.NET.Devices.Logitech.csproj">
<Project>{e7b2f174-fcc6-4fc7-9970-3138b5f4c921}</Project>
<Name>RGB.NET.Devices.Logitech</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.Msi\RGB.NET.Devices.Msi.csproj">
<Project>{4efd77c7-fdb4-4c6b-970c-0ef66d24be09}</Project>
<Name>RGB.NET.Devices.Msi</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.Novation\RGB.NET.Devices.Novation.csproj">
<Project>{db2911f6-404c-4bc8-b35f-232a7450755f}</Project>
<Name>RGB.NET.Devices.Novation</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Devices.Razer\RGB.NET.Devices.Razer.csproj">
<Project>{24ff4acb-d679-4b2d-86d4-50ab6c02d816}</Project>
<Name>RGB.NET.Devices.Razer</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Groups\RGB.NET.Groups.csproj">
<Project>{2a39f859-aad0-4c16-94f8-78057820b376}</Project>
<Name>RGB.NET.Groups</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Input.Corsair\RGB.NET.Input.Corsair.csproj">
<Project>{f905c418-76bb-4ba6-88ab-0793bc2681d3}</Project>
<Name>RGB.NET.Input.Corsair</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\RGB.NET\RGB.NET.Input\RGB.NET.Input.csproj">
<Project>{e60c3c6f-903f-4d80-99d0-7a1e50af5a9d}</Project>
<Name>RGB.NET.Input</Name>
</ProjectReference>
<ProjectReference Include="..\Artemis.Plugins\Artemis.Plugins.csproj">
<Project>{cd23bc5e-57f0-46ce-a007-24d031146219}</Project>
<Name>Artemis.Plugins</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets" Condition="Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Asus.0.0.1.20\build\net45\RGB.NET.Devices.Asus.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets'))" />
<Error Condition="!Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets'))" />
</Target>
<Import Project="..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets" Condition="Exists('..\packages\RGB.NET.Devices.CoolerMaster.0.0.1.20\build\net45\RGB.NET.Devices.CoolerMaster.targets')" />
<Import Project="..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets" Condition="Exists('..\packages\RGB.NET.Devices.Corsair.0.0.1.20\build\net45\RGB.NET.Devices.Corsair.targets')" />
<Import Project="..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets" Condition="Exists('..\packages\RGB.NET.Devices.Logitech.0.0.1.20\build\net45\RGB.NET.Devices.Logitech.targets')" />
<Import Project="..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets" Condition="Exists('..\packages\RGB.NET.Devices.Msi.0.0.1.20\build\net45\RGB.NET.Devices.Msi.targets')" />
<Import Project="..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets" Condition="Exists('..\packages\RGB.NET.Devices.Razer.0.0.1.20\build\net45\RGB.NET.Devices.Razer.targets')" />
</Project>
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using Artemis.Core.ProfileElements.Interfaces;
using RGB.NET.Core;
namespace Artemis.Core.ProfileElements
{
public class Folder : IProfileElement
{
public List<IProfileElement> Children { get; set; }
public void Update()
{
foreach (var profileElement in Children)
profileElement.Update();
}
public void Render(IRGBDevice rgbDevice)
{
foreach (var profileElement in Children)
profileElement.Render(rgbDevice);
}
}
}
@@ -0,0 +1,23 @@
using System.Collections.Generic;
using RGB.NET.Core;
namespace Artemis.Core.ProfileElements.Interfaces
{
public interface IProfileElement
{
/// <summary>
/// The element's children
/// </summary>
List<IProfileElement> Children { get; set; }
/// <summary>
/// Updates the element
/// </summary>
void Update();
/// <summary>
/// Renders the element
/// </summary>
void Render(IRGBDevice rgbDevice);
}
}
@@ -0,0 +1,21 @@
using System.Collections.Generic;
using Artemis.Core.ProfileElements.Interfaces;
using RGB.NET.Core;
namespace Artemis.Core.ProfileElements
{
public class Profile : IProfileElement
{
public List<IProfileElement> Children { get; set; }
public void Update()
{
}
public void Render(IRGBDevice rgbDevice)
{
foreach (var profileElement in Children)
profileElement.Render(rgbDevice);
}
}
}
+27 -6
View File
@@ -1,22 +1,26 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Artemis.Core.Exceptions;
using Artemis.Core.Services.Interfaces;
namespace Artemis.Core.Services
{
public class CoreService : ICoreService
{
private readonly IRgbService _rgbService;
private readonly IPluginService _pluginService;
private readonly IDeviceService _deviceService;
public CoreService(IPluginService pluginService, IDeviceService deviceService)
public CoreService(IPluginService pluginService, IRgbService rgbService)
{
_pluginService = pluginService;
_deviceService = deviceService;
_rgbService = rgbService;
Task.Run(Initialize);
}
public void Dispose()
{
// Dispose services
_pluginService.Dispose();
}
@@ -24,9 +28,26 @@ namespace Artemis.Core.Services
private async Task Initialize()
{
if (IsInitialized)
throw new ArtemisCoreException("Cannot initialize the core as it is already initialized.");
// Initialize the services
await _pluginService.LoadPlugins();
await _deviceService.LoadDevices();
IsInitialized = true;
await _rgbService.LoadDevices();
OnInitialized();
}
#region Events
public event EventHandler Initialized;
private void OnInitialized()
{
IsInitialized = true;
Initialized?.Invoke(this, EventArgs.Empty);
}
#endregion
}
}
@@ -1,9 +1,15 @@
using System;
using Artemis.Core.Events;
namespace Artemis.Core.Services.Interfaces
{
public interface ICoreService: IArtemisService, IDisposable
{
bool IsInitialized { get; set; }
/// <summary>
/// Occurs the core has finished initializing
/// </summary>
event EventHandler Initialized;
}
}
@@ -0,0 +1,35 @@
using System;
using System.Threading.Tasks;
using Artemis.Core.Events;
using RGB.NET.Core;
namespace Artemis.Core.Services.Interfaces
{
public interface IRgbService : IArtemisService
{
bool LoadingDevices { get; }
RGBSurface Surface { get; set; }
Task LoadDevices();
void Dispose();
/// <summary>
/// Occurs when a single device has loaded
/// </summary>
event EventHandler<DeviceEventArgs> DeviceLoaded;
/// <summary>
/// Occurs when a single device has reloaded
/// </summary>
event EventHandler<DeviceEventArgs> DeviceReloaded;
/// <summary>
/// Occurs when loading all devices has started
/// </summary>
event EventHandler StartingLoadingDevices;
/// <summary>
/// Occurs when loading all devices has finished
/// </summary>
event EventHandler FinishedLoadedDevices;
}
}
@@ -32,6 +32,7 @@ namespace Artemis.Core.Services
public bool LoadingPlugins { get; private set; }
public ReadOnlyCollection<PluginInfo> Plugins => _plugins.AsReadOnly();
/// <inheritdoc />
/// <summary>
/// Loads all installed plugins. If plugins already loaded this will reload them all
/// </summary>
@@ -11,21 +11,25 @@ using RGB.NET.Groups;
namespace Artemis.Core.Services
{
public class DeviceService : IDeviceService, IDisposable
public class RgbService : IRgbService, IDisposable
{
public DeviceService()
public RgbService()
{
Surface = RGBSurface.Instance;
LoadingDevices = false;
// Let's throw these for now
Surface.Exception += SurfaceOnException;
Surface.UpdateMode = UpdateMode.Continuous;
}
/// <inheritdoc />
public bool LoadingDevices { get; private set; }
/// <inheritdoc />
public RGBSurface Surface { get; set; }
/// <inheritdoc />
public async Task LoadDevices()
{
OnStartedLoadingDevices();
@@ -33,19 +37,19 @@ namespace Artemis.Core.Services
await Task.Run(() =>
{
// TODO SpoinkyNL 8-1-18: Keep settings into account
// Surface.LoadDevices(AsusDeviceProvider.Instance);
// Surface.LoadDevices(AsusDeviceProvider.Instance);
Surface.LoadDevices(CorsairDeviceProvider.Instance);
Surface.LoadDevices(LogitechDeviceProvider.Instance);
Surface.LoadDevices(CoolerMasterDeviceProvider.Instance);
// Surface.LoadDevices(NovationDeviceProvider.Instance);
// Surface.LoadDevices(NovationDeviceProvider.Instance);
// TODO SpoinkyNL 8-1-18: Load alignment
Surface.AlignDevies();
// Do some testing, why does this work, how does it know I want to target the surface? Check source!
var ledGroup = new RectangleLedGroup(Surface.SurfaceRectangle)
{
Brush = new SolidColorBrush(new Color(255, 0, 0)) {BrushCalculationMode = BrushCalculationMode.Absolute}
Brush = new SolidColorBrush(new Color(255, 0, 0)) { BrushCalculationMode = BrushCalculationMode.Absolute }
};
Surface.UpdateMode = UpdateMode.Continuous;
});
@@ -65,24 +69,9 @@ namespace Artemis.Core.Services
#region Events
/// <summary>
/// Occurs when a single device has loaded
/// </summary>
public event EventHandler<DeviceEventArgs> DeviceLoaded;
/// <summary>
/// Occurs when a single device has reloaded
/// </summary>
public event EventHandler<DeviceEventArgs> DeviceReloaded;
/// <summary>
/// Occurs when loading all devices has started
/// </summary>
public event EventHandler StartedLoadingDevices;
/// <summary>
/// Occurs when loading all devices has finished
/// </summary>
public event EventHandler StartingLoadingDevices;
public event EventHandler FinishedLoadedDevices;
private void OnDeviceLoaded(DeviceEventArgs e)
@@ -98,7 +87,7 @@ namespace Artemis.Core.Services
private void OnStartedLoadingDevices()
{
LoadingDevices = true;
StartedLoadingDevices?.Invoke(this, EventArgs.Empty);
StartingLoadingDevices?.Invoke(this, EventArgs.Empty);
}
private void OnFinishedLoadedDevices()
@@ -109,9 +98,4 @@ namespace Artemis.Core.Services
#endregion
}
public interface IDeviceService : IArtemisService
{
Task LoadDevices();
}
}
-14
View File
@@ -13,20 +13,6 @@
<package id="Ninject" version="3.3.4" targetFramework="net46" />
<package id="Ninject.Extensions.Conventions" version="3.3.0" targetFramework="net46" />
<package id="Ninject.Extensions.Factory" version="3.3.2" targetFramework="net46" />
<package id="RGB.NET" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Brushes" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Core" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Decorators" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.Asus" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.CoolerMaster" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.Corsair" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.Logitech" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.Msi" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.Novation" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Devices.Razer" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Groups" version="0.0.1.20" targetFramework="net46" />
<package id="RGB.NET.Presets" version="0.0.1.20" targetFramework="net46" />
<package id="Sanford.Multimedia.Midi" version="6.4.2" targetFramework="net46" />
<package id="Stylet" version="1.1.21" targetFramework="net46" />
<package id="System.AppContext" version="4.3.0" targetFramework="net46" />