mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 17:53:32 +00:00
Implemented mouse and headset layers
This commit is contained in:
parent
3a18ce4a5a
commit
9a560d780d
@ -279,6 +279,7 @@
|
|||||||
<Compile Include="ArtemisBootstrapper.cs" />
|
<Compile Include="ArtemisBootstrapper.cs" />
|
||||||
<Compile Include="DAL\ProfileProvider.cs" />
|
<Compile Include="DAL\ProfileProvider.cs" />
|
||||||
<Compile Include="DeviceProviders\Corsair\CorsairMice.cs" />
|
<Compile Include="DeviceProviders\Corsair\CorsairMice.cs" />
|
||||||
|
<Compile Include="DeviceProviders\Corsair\CorsiarHeadsets.cs" />
|
||||||
<Compile Include="DeviceProviders\DeviceProvider.cs" />
|
<Compile Include="DeviceProviders\DeviceProvider.cs" />
|
||||||
<Compile Include="Events\ActiveKeyboardChanged.cs" />
|
<Compile Include="Events\ActiveKeyboardChanged.cs" />
|
||||||
<Compile Include="Events\ToggleEnabled.cs" />
|
<Compile Include="Events\ToggleEnabled.cs" />
|
||||||
@ -296,7 +297,7 @@
|
|||||||
<Compile Include="DeviceProviders\Razer\BlackWidow.cs" />
|
<Compile Include="DeviceProviders\Razer\BlackWidow.cs" />
|
||||||
<Compile Include="DeviceProviders\Razer\Utilities\RazerUtilities.cs" />
|
<Compile Include="DeviceProviders\Razer\Utilities\RazerUtilities.cs" />
|
||||||
<Compile Include="Managers\EffectManager.cs" />
|
<Compile Include="Managers\EffectManager.cs" />
|
||||||
<Compile Include="Managers\KeyboardManager.cs" />
|
<Compile Include="Managers\DeviceManager.cs" />
|
||||||
<Compile Include="Managers\LoopManager.cs" />
|
<Compile Include="Managers\LoopManager.cs" />
|
||||||
<Compile Include="Managers\MainManager.cs" />
|
<Compile Include="Managers\MainManager.cs" />
|
||||||
<Compile Include="Managers\ProfileManager.cs" />
|
<Compile Include="Managers\ProfileManager.cs" />
|
||||||
@ -309,6 +310,7 @@
|
|||||||
<Compile Include="Models\Profiles\LayerModel.cs" />
|
<Compile Include="Models\Profiles\LayerModel.cs" />
|
||||||
<Compile Include="Models\Profiles\ProfileModel.cs" />
|
<Compile Include="Models\Profiles\ProfileModel.cs" />
|
||||||
<Compile Include="Models\Profiles\Properties\DynamicPropertiesModel.cs" />
|
<Compile Include="Models\Profiles\Properties\DynamicPropertiesModel.cs" />
|
||||||
|
<Compile Include="Models\Profiles\Properties\HeadsetPropertiesModel.cs" />
|
||||||
<Compile Include="Models\Profiles\Properties\KeyboardPropertiesModel.cs" />
|
<Compile Include="Models\Profiles\Properties\KeyboardPropertiesModel.cs" />
|
||||||
<Compile Include="Models\Profiles\Properties\LayerPropertiesModel.cs" />
|
<Compile Include="Models\Profiles\Properties\LayerPropertiesModel.cs" />
|
||||||
<Compile Include="Models\Profiles\Properties\GenericPropertiesModel.cs" />
|
<Compile Include="Models\Profiles\Properties\GenericPropertiesModel.cs" />
|
||||||
@ -461,6 +463,7 @@
|
|||||||
<Compile Include="ViewModels\LayerEditor\LayerDynamicPropertiesViewModel.cs" />
|
<Compile Include="ViewModels\LayerEditor\LayerDynamicPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\LayerEditor\LayerEditorViewModel.cs" />
|
<Compile Include="ViewModels\LayerEditor\LayerEditorViewModel.cs" />
|
||||||
<Compile Include="ViewModels\LayerEditor\LayerPropertiesViewModel.cs" />
|
<Compile Include="ViewModels\LayerEditor\LayerPropertiesViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\LayerEditor\HeadsetPropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\LayerEditor\MousePropertiesViewModel.cs" />
|
<Compile Include="ViewModels\LayerEditor\MousePropertiesViewModel.cs" />
|
||||||
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
<Compile Include="ViewModels\OverlaysViewModel.cs" />
|
||||||
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
<Compile Include="Modules\Overlays\VolumeDisplay\VolumeDisplayViewModel.cs" />
|
||||||
@ -498,6 +501,9 @@
|
|||||||
<Compile Include="Modules\Games\Witcher3\Witcher3View.xaml.cs">
|
<Compile Include="Modules\Games\Witcher3\Witcher3View.xaml.cs">
|
||||||
<DependentUpon>Witcher3View.xaml</DependentUpon>
|
<DependentUpon>Witcher3View.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\LayerEditor\HeadsetPropertiesView.xaml.cs">
|
||||||
|
<DependentUpon>HeadsetPropertiesView.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\LayerEditor\KeyboardPropertiesView.xaml.cs">
|
<Compile Include="Views\LayerEditor\KeyboardPropertiesView.xaml.cs">
|
||||||
<DependentUpon>KeyboardPropertiesView.xaml</DependentUpon>
|
<DependentUpon>KeyboardPropertiesView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -680,6 +686,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\LayerEditor\HeadsetPropertiesView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\LayerEditor\KeyboardPropertiesView.xaml">
|
<Page Include="Views\LayerEditor\KeyboardPropertiesView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@ -1,36 +1,56 @@
|
|||||||
using System.Threading;
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Artemis.Utilities;
|
||||||
using CUE.NET;
|
using CUE.NET;
|
||||||
using CUE.NET.Devices.Generic.Enums;
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
using CUE.NET.Devices.Mouse;
|
|
||||||
using CUE.NET.Exceptions;
|
using CUE.NET.Exceptions;
|
||||||
|
|
||||||
namespace Artemis.DeviceProviders.Corsair
|
namespace Artemis.DeviceProviders.Corsair
|
||||||
{
|
{
|
||||||
internal class CorsairMice : DeviceProvider
|
internal class CorsairMice : DeviceProvider
|
||||||
{
|
{
|
||||||
private readonly CorsairRGB _corsairRgb;
|
public CorsairMice()
|
||||||
private CorsairMouse _mouse;
|
|
||||||
|
|
||||||
public CorsairMice(CorsairRGB corsairRgb)
|
|
||||||
{
|
{
|
||||||
_corsairRgb = corsairRgb;
|
Type = DeviceType.Mouse;
|
||||||
UpdateCanUse();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateCanUse()
|
public override bool TryEnable()
|
||||||
{
|
{
|
||||||
if (!CanInitializeSdk())
|
CanUse = CanInitializeSdk();
|
||||||
{
|
return CanUse;
|
||||||
CanUse = false;
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
if (CueSDK.ProtocolDetails != null)
|
||||||
|
CueSDK.Reinitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateDevice(Brush brush)
|
||||||
|
{
|
||||||
|
if (!CanUse || brush == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var leds = CueSDK.MouseSDK.Leds.Count();
|
||||||
|
var rect = new Rect(new Size(leds*5, leds*5));
|
||||||
|
var img = brush.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
var visual = new DrawingVisual();
|
||||||
|
using (var c = visual.RenderOpen())
|
||||||
|
c.DrawRectangle(brush, null, rect);
|
||||||
|
return ImageUtilities.DrawinVisualToBitmap(visual, rect);
|
||||||
|
});
|
||||||
|
|
||||||
|
var ledIndex = 0;
|
||||||
|
// Color each LED according to one of the pixels
|
||||||
|
foreach (var corsairLed in CueSDK.MouseSDK.Leds)
|
||||||
|
{
|
||||||
|
corsairLed.Color = img.GetPixel(ledIndex*5, ledIndex*5);
|
||||||
|
ledIndex++;
|
||||||
}
|
}
|
||||||
|
CueSDK.MouseSDK.Update(true);
|
||||||
if (CueSDK.ProtocolDetails == null)
|
|
||||||
CueSDK.Initialize(true);
|
|
||||||
|
|
||||||
_mouse = CueSDK.MouseSDK;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CanInitializeSdk()
|
private static bool CanInitializeSdk()
|
||||||
@ -43,15 +63,17 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
{
|
{
|
||||||
if (CueSDK.ProtocolDetails == null)
|
if (CueSDK.ProtocolDetails == null)
|
||||||
CueSDK.Initialize();
|
CueSDK.Initialize();
|
||||||
|
else
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
catch (CUEException e)
|
catch (CUEException e)
|
||||||
{
|
{
|
||||||
if (e.Error == CorsairError.ServerNotFound)
|
if (e.Error != CorsairError.ServerNotFound)
|
||||||
{
|
return true;
|
||||||
tries++;
|
|
||||||
Thread.Sleep(1000);
|
tries++;
|
||||||
continue;
|
Thread.Sleep(1000);
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
catch (WrapperException)
|
catch (WrapperException)
|
||||||
{
|
{
|
||||||
@ -64,11 +86,5 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateDevice(Brush brush)
|
|
||||||
{
|
|
||||||
if (!CanUse)
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,45 +61,39 @@ namespace Artemis.DeviceProviders.Corsair
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
try
|
if (CueSDK.ProtocolDetails == null)
|
||||||
{
|
CueSDK.Initialize(true);
|
||||||
if (CueSDK.ProtocolDetails == null)
|
|
||||||
CueSDK.Initialize(true);
|
|
||||||
}
|
|
||||||
catch (WrapperException)
|
|
||||||
{
|
|
||||||
/*CUE is already initialized*/
|
|
||||||
}
|
|
||||||
_keyboard = CueSDK.KeyboardSDK;
|
_keyboard = CueSDK.KeyboardSDK;
|
||||||
if (_keyboard.DeviceInfo.Model == "K95 RGB")
|
switch (_keyboard.DeviceInfo.Model)
|
||||||
{
|
{
|
||||||
Height = 7;
|
case "K95 RGB":
|
||||||
Width = 25;
|
Height = 7;
|
||||||
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k95);
|
Width = 25;
|
||||||
}
|
PreviewSettings = new PreviewSettings(626, 175, new Thickness(0, -15, 0, 0), Resources.k95);
|
||||||
else if (_keyboard.DeviceInfo.Model == "K70 RGB")
|
break;
|
||||||
{
|
case "K70 RGB":
|
||||||
Height = 7;
|
Height = 7;
|
||||||
Width = 21;
|
Width = 21;
|
||||||
PreviewSettings = new PreviewSettings(626, 195, new Thickness(0, -25, 0, 0), Resources.k70);
|
PreviewSettings = new PreviewSettings(626, 195, new Thickness(0, -25, 0, 0), Resources.k70);
|
||||||
}
|
break;
|
||||||
else if (_keyboard.DeviceInfo.Model == "K65 RGB")
|
case "K65 RGB":
|
||||||
{
|
Height = 7;
|
||||||
Height = 7;
|
Width = 18;
|
||||||
Width = 18;
|
PreviewSettings = new PreviewSettings(610, 240, new Thickness(0, -30, 0, 0), Resources.k65);
|
||||||
PreviewSettings = new PreviewSettings(610, 240, new Thickness(0, -30, 0, 0), Resources.k65);
|
break;
|
||||||
}
|
case "STRAFE RGB":
|
||||||
else if (_keyboard.DeviceInfo.Model == "STRAFE RGB")
|
Height = 6;
|
||||||
{
|
Width = 22;
|
||||||
Height = 6;
|
PreviewSettings = new PreviewSettings(620, 215, new Thickness(0, -15, 0, 0), Resources.strafe);
|
||||||
Width = 22;
|
break;
|
||||||
PreviewSettings = new PreviewSettings(620, 215, new Thickness(0, -15, 0, 0), Resources.strafe);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
{
|
{
|
||||||
CueSDK.Reinitialize();
|
if (CueSDK.ProtocolDetails != null)
|
||||||
|
CueSDK.Reinitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
90
Artemis/Artemis/DeviceProviders/Corsair/CorsiarHeadsets.cs
Normal file
90
Artemis/Artemis/DeviceProviders/Corsair/CorsiarHeadsets.cs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
using CUE.NET;
|
||||||
|
using CUE.NET.Devices.Generic.Enums;
|
||||||
|
using CUE.NET.Exceptions;
|
||||||
|
|
||||||
|
namespace Artemis.DeviceProviders.Corsair
|
||||||
|
{
|
||||||
|
internal class CorsairHeadsets : DeviceProvider
|
||||||
|
{
|
||||||
|
public CorsairHeadsets()
|
||||||
|
{
|
||||||
|
Type = DeviceType.Headset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool TryEnable()
|
||||||
|
{
|
||||||
|
CanUse = CanInitializeSdk();
|
||||||
|
return CanUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Disable()
|
||||||
|
{
|
||||||
|
if (CueSDK.ProtocolDetails != null)
|
||||||
|
CueSDK.Reinitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void UpdateDevice(Brush brush)
|
||||||
|
{
|
||||||
|
if (!CanUse || brush == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var leds = CueSDK.HeadsetSDK.Leds.Count();
|
||||||
|
var rect = new Rect(new Size(leds * 5, leds * 5));
|
||||||
|
var img = brush.Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
var visual = new DrawingVisual();
|
||||||
|
using (var c = visual.RenderOpen())
|
||||||
|
c.DrawRectangle(brush, null, rect);
|
||||||
|
return ImageUtilities.DrawinVisualToBitmap(visual, rect);
|
||||||
|
});
|
||||||
|
|
||||||
|
var ledIndex = 0;
|
||||||
|
// Color each LED according to one of the pixels
|
||||||
|
foreach (var corsairLed in CueSDK.HeadsetSDK.Leds)
|
||||||
|
{
|
||||||
|
corsairLed.Color = img.GetPixel(ledIndex * 5, ledIndex * 5);
|
||||||
|
ledIndex++;
|
||||||
|
}
|
||||||
|
CueSDK.HeadsetSDK.Update(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static bool CanInitializeSdk()
|
||||||
|
{
|
||||||
|
// Try for about 10 seconds, in case CUE isn't started yet
|
||||||
|
var tries = 0;
|
||||||
|
while (tries < 9)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (CueSDK.ProtocolDetails == null)
|
||||||
|
CueSDK.Initialize();
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
catch (CUEException e)
|
||||||
|
{
|
||||||
|
if (e.Error != CorsairError.ServerNotFound)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
tries++;
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
catch (WrapperException)
|
||||||
|
{
|
||||||
|
CueSDK.Reinitialize();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -19,6 +19,16 @@ namespace Artemis.DeviceProviders
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="brush"></param>
|
/// <param name="brush"></param>
|
||||||
public abstract void UpdateDevice(Brush brush);
|
public abstract void UpdateDevice(Brush brush);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tries to enable the device and updates CanUse accordingly
|
||||||
|
/// </summary>
|
||||||
|
public abstract bool TryEnable();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables the device
|
||||||
|
/// </summary>
|
||||||
|
public abstract void Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DeviceType
|
public enum DeviceType
|
||||||
|
|||||||
@ -22,8 +22,6 @@ namespace Artemis.DeviceProviders
|
|||||||
|
|
||||||
public abstract bool CanEnable();
|
public abstract bool CanEnable();
|
||||||
public abstract void Enable();
|
public abstract void Enable();
|
||||||
// TODO: This should be done in a background thread with a callback mechanism as it causes UI lag
|
|
||||||
public abstract void Disable();
|
|
||||||
public abstract void DrawBitmap(Bitmap bitmap);
|
public abstract void DrawBitmap(Bitmap bitmap);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -44,6 +42,11 @@ namespace Artemis.DeviceProviders
|
|||||||
{
|
{
|
||||||
throw new NotImplementedException("KeyboardProvider doesn't implement UpdateDevice, use DrawBitmap instead.");
|
throw new NotImplementedException("KeyboardProvider doesn't implement UpdateDevice, use DrawBitmap instead.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool TryEnable()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException("KeyboardProvider doesn't implement TryEnable, use CanEnable instead.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct PreviewSettings
|
public struct PreviewSettings
|
||||||
|
|||||||
@ -36,10 +36,15 @@ namespace Artemis.InjectionModules
|
|||||||
// Overlays
|
// Overlays
|
||||||
Bind<OverlayViewModel>().To<VolumeDisplayViewModel>().InSingletonScope();
|
Bind<OverlayViewModel>().To<VolumeDisplayViewModel>().InSingletonScope();
|
||||||
|
|
||||||
// Keyboard Providers
|
// Device Providers
|
||||||
Bind<KeyboardProvider>().To<CorsairRGB>().InSingletonScope();
|
// Keyboards
|
||||||
Bind<KeyboardProvider>().To<Orion>().InSingletonScope();
|
Bind<DeviceProvider>().To<CorsairRGB>().InSingletonScope();
|
||||||
Bind<KeyboardProvider>().To<BlackWidow>().InSingletonScope();
|
Bind<DeviceProvider>().To<Orion>().InSingletonScope();
|
||||||
|
Bind<DeviceProvider>().To<BlackWidow>().InSingletonScope();
|
||||||
|
// Mice
|
||||||
|
Bind<DeviceProvider>().To<CorsairMice>().InSingletonScope();
|
||||||
|
// Headsets
|
||||||
|
Bind<DeviceProvider>().To<CorsairHeadsets>().InSingletonScope();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@ namespace Artemis.InjectionModules
|
|||||||
public override void Load()
|
public override void Load()
|
||||||
{
|
{
|
||||||
Bind<MainManager>().ToSelf().InSingletonScope();
|
Bind<MainManager>().ToSelf().InSingletonScope();
|
||||||
Bind<KeyboardManager>().ToSelf().InSingletonScope();
|
Bind<DeviceManager>().ToSelf().InSingletonScope();
|
||||||
Bind<EffectManager>().ToSelf().InSingletonScope();
|
Bind<EffectManager>().ToSelf().InSingletonScope();
|
||||||
Bind<ProfileManager>().ToSelf().InSingletonScope();
|
Bind<ProfileManager>().ToSelf().InSingletonScope();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,22 +14,30 @@ namespace Artemis.Managers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages the keyboard providers
|
/// Manages the keyboard providers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class KeyboardManager
|
public class DeviceManager
|
||||||
{
|
{
|
||||||
private readonly IEventAggregator _events;
|
private readonly IEventAggregator _events;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
public KeyboardManager(IEventAggregator events, ILogger logger, List<KeyboardProvider> keyboardProviders)
|
public DeviceManager(IEventAggregator events, ILogger logger, List<DeviceProvider> deviceProviders)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logger.Info("Intializing KeyboardManager");
|
_logger.Info("Intializing DeviceManager");
|
||||||
|
|
||||||
_events = events;
|
_events = events;
|
||||||
KeyboardProviders = keyboardProviders;
|
|
||||||
|
|
||||||
_logger.Info("Intialized KeyboardManager");
|
KeyboardProviders = deviceProviders.Where(d => d.Type == DeviceType.Keyboard)
|
||||||
|
.Cast<KeyboardProvider>().ToList();
|
||||||
|
MiceProviders = deviceProviders.Where(d => d.Type == DeviceType.Mouse).ToList();
|
||||||
|
HeadsetProviders = deviceProviders.Where(d => d.Type == DeviceType.Headset).ToList();
|
||||||
|
|
||||||
|
_logger.Info("Intialized DeviceManager");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<DeviceProvider> HeadsetProviders { get; set; }
|
||||||
|
|
||||||
|
public List<DeviceProvider> MiceProviders { get; set; }
|
||||||
|
|
||||||
[Inject]
|
[Inject]
|
||||||
public MetroDialogService DialogService { get; set; }
|
public MetroDialogService DialogService { get; set; }
|
||||||
|
|
||||||
@ -104,12 +112,22 @@ namespace Artemis.Managers
|
|||||||
General.Default.LastKeyboard = ActiveKeyboard.Name;
|
General.Default.LastKeyboard = ActiveKeyboard.Name;
|
||||||
General.Default.Save();
|
General.Default.Save();
|
||||||
|
|
||||||
|
EnableUsableDevices();
|
||||||
|
|
||||||
ChangingKeyboard = false;
|
ChangingKeyboard = false;
|
||||||
_events.PublishOnUIThread(new ActiveKeyboardChanged(oldKeyboard, ActiveKeyboard));
|
_events.PublishOnUIThread(new ActiveKeyboardChanged(oldKeyboard, ActiveKeyboard));
|
||||||
_logger.Debug("Enabled keyboard: {0}", keyboardProvider.Name);
|
_logger.Debug("Enabled keyboard: {0}", keyboardProvider.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void EnableUsableDevices()
|
||||||
|
{
|
||||||
|
foreach (var mouseProvider in MiceProviders)
|
||||||
|
mouseProvider.TryEnable();
|
||||||
|
foreach (var headsetProvider in HeadsetProviders)
|
||||||
|
headsetProvider.TryEnable();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Releases the active keyboard
|
/// Releases the active keyboard
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -16,17 +16,17 @@ namespace Artemis.Managers
|
|||||||
public class EffectManager
|
public class EffectManager
|
||||||
{
|
{
|
||||||
private readonly IEventAggregator _events;
|
private readonly IEventAggregator _events;
|
||||||
private readonly KeyboardManager _keyboardManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private EffectModel _activeEffect;
|
private EffectModel _activeEffect;
|
||||||
|
|
||||||
public EffectManager(ILogger logger, IEventAggregator events, KeyboardManager keyboardManager)
|
public EffectManager(ILogger logger, IEventAggregator events, DeviceManager deviceManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logger.Info("Intializing EffectManager");
|
_logger.Info("Intializing EffectManager");
|
||||||
|
|
||||||
_events = events;
|
_events = events;
|
||||||
_keyboardManager = keyboardManager;
|
_deviceManager = deviceManager;
|
||||||
|
|
||||||
EffectModels = new List<EffectModel>();
|
EffectModels = new List<EffectModel>();
|
||||||
|
|
||||||
@ -90,10 +90,10 @@ namespace Artemis.Managers
|
|||||||
if (effectModel is OverlayModel)
|
if (effectModel is OverlayModel)
|
||||||
throw new ArgumentException("Can't set an Overlay effect as the active effect");
|
throw new ArgumentException("Can't set an Overlay effect as the active effect");
|
||||||
|
|
||||||
if (_keyboardManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
_keyboardManager.EnableLastKeyboard();
|
_deviceManager.EnableLastKeyboard();
|
||||||
// If still null, no last keyboard, so stop.
|
// If still null, no last keyboard, so stop.
|
||||||
if (_keyboardManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
_logger.Debug("Cancelling effect change, no LastKeyboard");
|
_logger.Debug("Cancelling effect change, no LastKeyboard");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using Artemis.Events;
|
using Artemis.Events;
|
||||||
using Caliburn.Micro;
|
using Caliburn.Micro;
|
||||||
@ -14,17 +15,17 @@ namespace Artemis.Managers
|
|||||||
{
|
{
|
||||||
private readonly EffectManager _effectManager;
|
private readonly EffectManager _effectManager;
|
||||||
private readonly IEventAggregator _events;
|
private readonly IEventAggregator _events;
|
||||||
private readonly KeyboardManager _keyboardManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly Timer _loopTimer;
|
private readonly Timer _loopTimer;
|
||||||
|
|
||||||
public LoopManager(ILogger logger, IEventAggregator events, EffectManager effectManager,
|
public LoopManager(ILogger logger, IEventAggregator events, EffectManager effectManager,
|
||||||
KeyboardManager keyboardManager)
|
DeviceManager deviceManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_events = events;
|
_events = events;
|
||||||
_effectManager = effectManager;
|
_effectManager = effectManager;
|
||||||
_keyboardManager = keyboardManager;
|
_deviceManager = deviceManager;
|
||||||
|
|
||||||
_loopTimer = new Timer(40);
|
_loopTimer = new Timer(40);
|
||||||
_loopTimer.Elapsed += Render;
|
_loopTimer.Elapsed += Render;
|
||||||
@ -49,10 +50,10 @@ namespace Artemis.Managers
|
|||||||
|
|
||||||
_logger.Debug("Starting LoopManager");
|
_logger.Debug("Starting LoopManager");
|
||||||
|
|
||||||
if (_keyboardManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
_keyboardManager.EnableLastKeyboard();
|
_deviceManager.EnableLastKeyboard();
|
||||||
// If still null, no last keyboard, so stop.
|
// If still null, no last keyboard, so stop.
|
||||||
if (_keyboardManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
_logger.Debug("Cancel LoopManager start, no keyboard");
|
_logger.Debug("Cancel LoopManager start, no keyboard");
|
||||||
return;
|
return;
|
||||||
@ -80,7 +81,7 @@ namespace Artemis.Managers
|
|||||||
_logger.Debug("Stopping LoopManager");
|
_logger.Debug("Stopping LoopManager");
|
||||||
Running = false;
|
Running = false;
|
||||||
|
|
||||||
_keyboardManager.ReleaseActiveKeyboard();
|
_deviceManager.ReleaseActiveKeyboard();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Render(object sender, ElapsedEventArgs e)
|
private void Render(object sender, ElapsedEventArgs e)
|
||||||
@ -97,18 +98,18 @@ namespace Artemis.Managers
|
|||||||
}
|
}
|
||||||
var renderEffect = _effectManager.ActiveEffect;
|
var renderEffect = _effectManager.ActiveEffect;
|
||||||
|
|
||||||
if (_keyboardManager.ChangingKeyboard)
|
if (_deviceManager.ChangingKeyboard)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Stop if no active keyboard
|
// Stop if no active keyboard
|
||||||
if (_keyboardManager.ActiveKeyboard == null)
|
if (_deviceManager.ActiveKeyboard == null)
|
||||||
{
|
{
|
||||||
_logger.Debug("No active keyboard, stopping");
|
_logger.Debug("No active keyboard, stopping");
|
||||||
Stop();
|
Stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (_keyboardManager.ActiveKeyboard)
|
lock (_deviceManager.ActiveKeyboard)
|
||||||
{
|
{
|
||||||
// Skip frame if effect is still initializing
|
// Skip frame if effect is still initializing
|
||||||
if (renderEffect.Initialized == false)
|
if (renderEffect.Initialized == false)
|
||||||
@ -146,7 +147,12 @@ namespace Artemis.Managers
|
|||||||
bitmap = fixedBmp;
|
bitmap = fixedBmp;
|
||||||
|
|
||||||
// If it exists, send bitmap to the device
|
// If it exists, send bitmap to the device
|
||||||
_keyboardManager.ActiveKeyboard?.DrawBitmap(bitmap);
|
_deviceManager.ActiveKeyboard?.DrawBitmap(bitmap);
|
||||||
|
|
||||||
|
foreach (var mouse in _deviceManager.MiceProviders.Where(m => m.CanUse))
|
||||||
|
mouse.UpdateDevice(renderEffect.GenerateMouseBrush());
|
||||||
|
foreach (var headset in _deviceManager.HeadsetProviders.Where(h => h.CanUse))
|
||||||
|
headset.UpdateDevice(renderEffect.GenerateHeadsetBrush());
|
||||||
|
|
||||||
// debugging TODO: Disable when window isn't shown (in Debug VM, or get rid of it, w/e)
|
// debugging TODO: Disable when window isn't shown (in Debug VM, or get rid of it, w/e)
|
||||||
_events.PublishOnUIThread(new ChangeBitmap(bitmap));
|
_events.PublishOnUIThread(new ChangeBitmap(bitmap));
|
||||||
|
|||||||
@ -27,11 +27,11 @@ namespace Artemis.Managers
|
|||||||
private readonly Timer _processTimer;
|
private readonly Timer _processTimer;
|
||||||
|
|
||||||
public MainManager(IEventAggregator events, ILogger logger, LoopManager loopManager,
|
public MainManager(IEventAggregator events, ILogger logger, LoopManager loopManager,
|
||||||
KeyboardManager keyboardManager, EffectManager effectManager, ProfileManager profileManager)
|
DeviceManager deviceManager, EffectManager effectManager, ProfileManager profileManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
LoopManager = loopManager;
|
LoopManager = loopManager;
|
||||||
KeyboardManager = keyboardManager;
|
DeviceManager = deviceManager;
|
||||||
EffectManager = effectManager;
|
EffectManager = effectManager;
|
||||||
ProfileManager = profileManager;
|
ProfileManager = profileManager;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ namespace Artemis.Managers
|
|||||||
public Lazy<ShellViewModel> ShellViewModel { get; set; }
|
public Lazy<ShellViewModel> ShellViewModel { get; set; }
|
||||||
|
|
||||||
public LoopManager LoopManager { get; }
|
public LoopManager LoopManager { get; }
|
||||||
public KeyboardManager KeyboardManager { get; set; }
|
public DeviceManager DeviceManager { get; set; }
|
||||||
public EffectManager EffectManager { get; set; }
|
public EffectManager EffectManager { get; set; }
|
||||||
public ProfileManager ProfileManager { get; set; }
|
public ProfileManager ProfileManager { get; set; }
|
||||||
|
|
||||||
|
|||||||
@ -11,16 +11,16 @@ namespace Artemis.Managers
|
|||||||
public class ProfileManager
|
public class ProfileManager
|
||||||
{
|
{
|
||||||
private readonly EffectManager _effectManager;
|
private readonly EffectManager _effectManager;
|
||||||
private readonly KeyboardManager _keyboardManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
private readonly LoopManager _loopManager;
|
private readonly LoopManager _loopManager;
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private EffectModel _prePreviewEffect;
|
private EffectModel _prePreviewEffect;
|
||||||
|
|
||||||
public ProfileManager(ILogger logger, EffectManager effectManager, KeyboardManager keyboardManager, LoopManager loopManager)
|
public ProfileManager(ILogger logger, EffectManager effectManager, DeviceManager deviceManager, LoopManager loopManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_effectManager = effectManager;
|
_effectManager = effectManager;
|
||||||
_keyboardManager = keyboardManager;
|
_deviceManager = deviceManager;
|
||||||
_loopManager = loopManager;
|
_loopManager = loopManager;
|
||||||
|
|
||||||
GameViewModels = new List<GameViewModel>();
|
GameViewModels = new List<GameViewModel>();
|
||||||
@ -41,7 +41,7 @@ namespace Artemis.Managers
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void SetupProfilePreview(object sender, ElapsedEventArgs e)
|
private void SetupProfilePreview(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_keyboardManager.ChangingKeyboard || ProfilePreviewModel == null)
|
if (_deviceManager.ChangingKeyboard || ProfilePreviewModel == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive);
|
var activePreview = GameViewModels.FirstOrDefault(vm => vm.IsActive);
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Models
|
namespace Artemis.Models
|
||||||
{
|
{
|
||||||
@ -27,5 +28,8 @@ namespace Artemis.Models
|
|||||||
|
|
||||||
// Called after every update
|
// Called after every update
|
||||||
public abstract Bitmap GenerateBitmap();
|
public abstract Bitmap GenerateBitmap();
|
||||||
|
|
||||||
|
public abstract Brush GenerateMouseBrush();
|
||||||
|
public abstract Brush GenerateHeadsetBrush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -65,21 +65,59 @@ namespace Artemis.Models.Profiles
|
|||||||
(KeyboardPropertiesModel) appliedProperties);
|
(KeyboardPropertiesModel) appliedProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Folders are drawn recursively
|
switch (LayerType)
|
||||||
if (LayerType == LayerType.Folder)
|
|
||||||
{
|
{
|
||||||
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
// Folders are drawn recursively
|
||||||
layerModel.Draw<T>(dataModel, c, preview, updateAnimations);
|
case LayerType.Folder:
|
||||||
|
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
||||||
|
layerModel.Draw<T>(dataModel, c, preview, updateAnimations);
|
||||||
|
break;
|
||||||
|
case LayerType.Keyboard:
|
||||||
|
Drawer.Draw(c, (KeyboardPropertiesModel) Properties, (KeyboardPropertiesModel) appliedProperties);
|
||||||
|
break;
|
||||||
|
case LayerType.KeyboardGif:
|
||||||
|
GifImage = Drawer.DrawGif(c, (KeyboardPropertiesModel) appliedProperties, GifImage);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
// All other types are handles by the Drawer helper
|
}
|
||||||
else if (LayerType == LayerType.Keyboard)
|
|
||||||
Drawer.Draw(c, (KeyboardPropertiesModel) Properties, (KeyboardPropertiesModel) appliedProperties);
|
public Brush GenerateBrush<T>(LayerType type, IGameDataModel dataModel, bool preview, bool updateAnimations)
|
||||||
else if (LayerType == LayerType.KeyboardGif)
|
{
|
||||||
GifImage = Drawer.DrawGif(c, (KeyboardPropertiesModel) appliedProperties, GifImage);
|
if (!Enabled)
|
||||||
else if (LayerType == LayerType.Mouse)
|
return null;
|
||||||
Drawer.UpdateMouse(appliedProperties);
|
if (LayerType != LayerType.Folder && LayerType != type)
|
||||||
else if (LayerType == LayerType.Headset)
|
return null;
|
||||||
Drawer.UpdateHeadset(appliedProperties);
|
|
||||||
|
// Preview simply shows the properties as they are. When not previewing they are applied
|
||||||
|
LayerPropertiesModel appliedProperties;
|
||||||
|
if (!preview)
|
||||||
|
{
|
||||||
|
if (!ConditionsMet<T>(dataModel))
|
||||||
|
return null; // Don't return the brush when not previewing and the conditions arent met
|
||||||
|
appliedProperties = Properties.Brush.Dispatcher.Invoke(() => Properties.GetAppliedProperties(dataModel));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
appliedProperties = Properties.Brush.Dispatcher.Invoke(() => GeneralHelpers.Clone(Properties));
|
||||||
|
|
||||||
|
// TODO: Animations
|
||||||
|
// Update animations on layer types that support them
|
||||||
|
//if (LayerType != LayerType.Folder && updateAnimations)
|
||||||
|
//{
|
||||||
|
// AnimationUpdater.UpdateAnimation((KeyboardPropertiesModel)Properties,
|
||||||
|
// (KeyboardPropertiesModel)appliedProperties);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (LayerType != LayerType.Folder)
|
||||||
|
return appliedProperties.Brush;
|
||||||
|
|
||||||
|
Brush res = null;
|
||||||
|
foreach (var layerModel in Children.OrderByDescending(l => l.Order))
|
||||||
|
{
|
||||||
|
var brush = layerModel.GenerateBrush<T>(type, dataModel, preview, updateAnimations);
|
||||||
|
if (brush != null)
|
||||||
|
res = brush;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetupProperties()
|
public void SetupProperties()
|
||||||
@ -99,9 +137,15 @@ namespace Artemis.Models.Profiles
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (LayerType == LayerType.Mouse && !(Properties is MousePropertiesModel))
|
else if (LayerType == LayerType.Mouse && !(Properties is MousePropertiesModel))
|
||||||
Properties = new MousePropertiesModel();
|
Properties = new MousePropertiesModel
|
||||||
else if (!(Properties is GenericPropertiesModel))
|
{
|
||||||
Properties = new GenericPropertiesModel();
|
Brush = new SolidColorBrush(ColorHelpers.GetRandomRainbowMediaColor())
|
||||||
|
};
|
||||||
|
else if (LayerType == LayerType.Headset && !(Properties is HeadsetPropertiesModel))
|
||||||
|
Properties = new HeadsetPropertiesModel
|
||||||
|
{
|
||||||
|
Brush = new SolidColorBrush(ColorHelpers.GetRandomRainbowMediaColor())
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reorder(LayerModel selectedLayer, bool moveUp)
|
public void Reorder(LayerModel selectedLayer, bool moveUp)
|
||||||
@ -131,7 +175,7 @@ namespace Artemis.Models.Profiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the layer meets the requirements to be drawn
|
/// Returns whether the layer meets the requirements to be drawn
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public bool MustDraw()
|
public bool MustDraw()
|
||||||
|
|||||||
@ -7,6 +7,7 @@ using Artemis.Models.Interfaces;
|
|||||||
using Artemis.Models.Profiles.Properties;
|
using Artemis.Models.Profiles.Properties;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.ParentChild;
|
using Artemis.Utilities.ParentChild;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
using Color = System.Windows.Media.Color;
|
using Color = System.Windows.Media.Color;
|
||||||
|
|
||||||
namespace Artemis.Models.Profiles
|
namespace Artemis.Models.Profiles
|
||||||
@ -113,7 +114,7 @@ namespace Artemis.Models.Profiles
|
|||||||
public Bitmap GenerateBitmap<T>(Rect keyboardRect, IGameDataModel gameDataModel, bool preview, bool updateAnimations)
|
public Bitmap GenerateBitmap<T>(Rect keyboardRect, IGameDataModel gameDataModel, bool preview, bool updateAnimations)
|
||||||
{
|
{
|
||||||
Bitmap bitmap = null;
|
Bitmap bitmap = null;
|
||||||
DrawingVisual.Dispatcher.Invoke(delegate
|
DrawingVisual.Dispatcher.Invoke(() =>
|
||||||
{
|
{
|
||||||
var visual = new DrawingVisual();
|
var visual = new DrawingVisual();
|
||||||
using (var c = visual.RenderOpen())
|
using (var c = visual.RenderOpen())
|
||||||
@ -134,5 +135,19 @@ namespace Artemis.Models.Profiles
|
|||||||
});
|
});
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Brush GenerateBrush<T>(IGameDataModel gameDataModel, LayerType type, bool preview, bool updateAnimations)
|
||||||
|
{
|
||||||
|
Brush result = null;
|
||||||
|
// Draw the layers
|
||||||
|
foreach (var layerModel in Layers.OrderByDescending(l => l.Order))
|
||||||
|
{
|
||||||
|
var generated = layerModel.GenerateBrush<T>(type, gameDataModel, preview, updateAnimations);
|
||||||
|
if (generated != null)
|
||||||
|
result = generated;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
|
||||||
|
namespace Artemis.Models.Profiles.Properties
|
||||||
|
{
|
||||||
|
public class HeadsetPropertiesModel : LayerPropertiesModel
|
||||||
|
{
|
||||||
|
public override LayerPropertiesModel GetAppliedProperties(IGameDataModel dataModel)
|
||||||
|
{
|
||||||
|
// TODO: Apply any properties, if applicable to headsets in the first place.
|
||||||
|
return GeneralHelpers.Clone(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,6 +11,8 @@ namespace Artemis.Models.Profiles.Properties
|
|||||||
[XmlInclude(typeof(MatrixTransform))]
|
[XmlInclude(typeof(MatrixTransform))]
|
||||||
[XmlInclude(typeof(KeyboardPropertiesModel))]
|
[XmlInclude(typeof(KeyboardPropertiesModel))]
|
||||||
[XmlInclude(typeof(MousePropertiesModel))]
|
[XmlInclude(typeof(MousePropertiesModel))]
|
||||||
|
[XmlInclude(typeof(HeadsetPropertiesModel))]
|
||||||
|
[XmlInclude(typeof(GenericPropertiesModel))]
|
||||||
public abstract class LayerPropertiesModel
|
public abstract class LayerPropertiesModel
|
||||||
{
|
{
|
||||||
protected LayerPropertiesModel()
|
protected LayerPropertiesModel()
|
||||||
|
|||||||
@ -9,6 +9,7 @@ using Artemis.Models;
|
|||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Kaliko.ImageLibrary;
|
using Kaliko.ImageLibrary;
|
||||||
using Kaliko.ImageLibrary.Filters;
|
using Kaliko.ImageLibrary.Filters;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AmbientLightning
|
namespace Artemis.Modules.Effects.AmbientLightning
|
||||||
{
|
{
|
||||||
@ -49,9 +50,9 @@ namespace Artemis.Modules.Effects.AmbientLightning
|
|||||||
|
|
||||||
_colors = new List<Color>();
|
_colors = new List<Color>();
|
||||||
_screenCapturer = new ScreenCapture();
|
_screenCapturer = new ScreenCapture();
|
||||||
_topRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
_topRect = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||||
LinearGradientMode.Horizontal) {Height = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale/2};
|
LinearGradientMode.Horizontal) {Height = MainManager.DeviceManager.ActiveKeyboard.Height*Scale/2};
|
||||||
_botRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
_botRect = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||||
LinearGradientMode.Horizontal);
|
LinearGradientMode.Horizontal);
|
||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
@ -102,8 +103,8 @@ namespace Artemis.Modules.Effects.AmbientLightning
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Put the resulting colors in 6 rectangles, their size differs per keyboard
|
// Put the resulting colors in 6 rectangles, their size differs per keyboard
|
||||||
var rectWidth = MainManager.KeyboardManager.ActiveKeyboard.Width/3*Scale;
|
var rectWidth = MainManager.DeviceManager.ActiveKeyboard.Width/3*Scale;
|
||||||
var rectHeight = MainManager.KeyboardManager.ActiveKeyboard.Height/2*Scale;
|
var rectHeight = MainManager.DeviceManager.ActiveKeyboard.Height/2*Scale;
|
||||||
for (var row = 0; row < 2; row++)
|
for (var row = 0; row < 2; row++)
|
||||||
{
|
{
|
||||||
for (var column = 0; column < 3; column++)
|
for (var column = 0; column < 3; column++)
|
||||||
@ -116,7 +117,7 @@ namespace Artemis.Modules.Effects.AmbientLightning
|
|||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
var i = 0;
|
var i = 0;
|
||||||
@ -134,5 +135,15 @@ namespace Artemis.Modules.Effects.AmbientLightning
|
|||||||
ms.Position = 0;
|
ms.Position = 0;
|
||||||
return new Bitmap(ms);
|
return new Bitmap(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -10,6 +10,7 @@ using Artemis.Utilities;
|
|||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using NAudio.CoreAudioApi;
|
using NAudio.CoreAudioApi;
|
||||||
using NAudio.Wave;
|
using NAudio.Wave;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.AudioVisualizer
|
namespace Artemis.Modules.Effects.AudioVisualizer
|
||||||
{
|
{
|
||||||
@ -57,7 +58,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
public override void Enable()
|
public override void Enable()
|
||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
Lines = MainManager.KeyboardManager.ActiveKeyboard.Width;
|
Lines = MainManager.DeviceManager.ActiveKeyboard.Width;
|
||||||
|
|
||||||
// TODO: Device selection
|
// TODO: Device selection
|
||||||
SelectedDeviceId = new MMDeviceEnumerator()
|
SelectedDeviceId = new MMDeviceEnumerator()
|
||||||
@ -69,7 +70,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
for (var i = 0; i < Lines; i++)
|
for (var i = 0; i < Lines; i++)
|
||||||
{
|
{
|
||||||
SoundRectangles.Add(new KeyboardRectangle(
|
SoundRectangles.Add(new KeyboardRectangle(
|
||||||
MainManager.KeyboardManager.ActiveKeyboard,
|
MainManager.DeviceManager.ActiveKeyboard,
|
||||||
0, 0, new List<Color>
|
0, 0, new List<Color>
|
||||||
{
|
{
|
||||||
ColorHelpers.ToDrawingColor(Settings.TopColor),
|
ColorHelpers.ToDrawingColor(Settings.TopColor),
|
||||||
@ -121,7 +122,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
// Apply Sensitivity setting
|
// Apply Sensitivity setting
|
||||||
height = height*_sensitivity;
|
height = height*_sensitivity;
|
||||||
var keyboardHeight =
|
var keyboardHeight =
|
||||||
(int) Math.Round(MainManager.KeyboardManager.ActiveKeyboard.Height/100.00*height*Scale);
|
(int) Math.Round(MainManager.DeviceManager.ActiveKeyboard.Height/100.00*height*Scale);
|
||||||
if (keyboardHeight > SoundRectangles[i].Height)
|
if (keyboardHeight > SoundRectangles[i].Height)
|
||||||
SoundRectangles[i].Height = keyboardHeight;
|
SoundRectangles[i].Height = keyboardHeight;
|
||||||
else
|
else
|
||||||
@ -131,7 +132,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
SoundRectangles[i].Width = Scale;
|
SoundRectangles[i].Width = Scale;
|
||||||
|
|
||||||
if (_fromBottom)
|
if (_fromBottom)
|
||||||
SoundRectangles[i].Y = MainManager.KeyboardManager.ActiveKeyboard.Height*Scale -
|
SoundRectangles[i].Y = MainManager.DeviceManager.ActiveKeyboard.Height*Scale -
|
||||||
SoundRectangles[i].Height;
|
SoundRectangles[i].Height;
|
||||||
}
|
}
|
||||||
_generating = false;
|
_generating = false;
|
||||||
@ -145,7 +146,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
// Lock the _spectrumData array while busy with it
|
// Lock the _spectrumData array while busy with it
|
||||||
_generating = true;
|
_generating = true;
|
||||||
|
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
foreach (var soundRectangle in SoundRectangles)
|
foreach (var soundRectangle in SoundRectangles)
|
||||||
@ -156,6 +157,18 @@ namespace Artemis.Modules.Effects.AudioVisualizer
|
|||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Brush according to avg volume
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Brush according to avg volume left/right
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void OnDataAvailable(object sender, WaveInEventArgs e)
|
private void OnDataAvailable(object sender, WaveInEventArgs e)
|
||||||
{
|
{
|
||||||
var buffer = e.Buffer;
|
var buffer = e.Buffer;
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using System.Drawing.Drawing2D;
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.Debug
|
namespace Artemis.Modules.Effects.Debug
|
||||||
{
|
{
|
||||||
@ -33,7 +34,7 @@ namespace Artemis.Modules.Effects.Debug
|
|||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
KeyboardRectangle = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||||
{
|
{
|
||||||
Color.FromArgb(0, 226, 190),
|
Color.FromArgb(0, 226, 190),
|
||||||
Color.FromArgb(0, 208, 255)
|
Color.FromArgb(0, 208, 255)
|
||||||
@ -63,5 +64,15 @@ namespace Artemis.Modules.Effects.Debug
|
|||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@ using Artemis.Managers;
|
|||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
using Artemis.Models.Profiles;
|
using Artemis.Models.Profiles;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.ProfilePreview
|
namespace Artemis.Modules.Effects.ProfilePreview
|
||||||
{
|
{
|
||||||
@ -35,13 +36,15 @@ namespace Artemis.Modules.Effects.ProfilePreview
|
|||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(4);
|
var bitmap = MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(4);
|
||||||
|
|
||||||
if (SelectedProfile == null)
|
if (SelectedProfile == null)
|
||||||
return bitmap;
|
return bitmap;
|
||||||
|
|
||||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(4);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(4);
|
||||||
var image = SelectedProfile.GenerateBitmap<ProfilePreviewDataModel>(keyboardRect, _previewDataModel, true, true);
|
var image = SelectedProfile.GenerateBitmap<ProfilePreviewDataModel>(keyboardRect, _previewDataModel, true, true);
|
||||||
|
if (image == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
// Draw on top of everything else
|
// Draw on top of everything else
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
@ -49,6 +52,16 @@ namespace Artemis.Modules.Effects.ProfilePreview
|
|||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return SelectedProfile?.GenerateBrush<ProfilePreviewDataModel>(_previewDataModel, LayerType.Mouse, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return SelectedProfile?.GenerateBrush<ProfilePreviewDataModel>(_previewDataModel, LayerType.Headset, true, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProfilePreviewDataModel : IGameDataModel
|
public class ProfilePreviewDataModel : IGameDataModel
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using Artemis.DeviceProviders.Logitech.Utilities;
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Effects.TypeWave
|
namespace Artemis.Modules.Effects.TypeWave
|
||||||
{
|
{
|
||||||
@ -96,7 +97,7 @@ namespace Artemis.Modules.Effects.TypeWave
|
|||||||
if (_waves.Count == 0)
|
if (_waves.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
@ -113,7 +114,7 @@ namespace Artemis.Modules.Effects.TypeWave
|
|||||||
_waves[i].Size, _waves[i].Size);
|
_waves[i].Size, _waves[i].Size);
|
||||||
|
|
||||||
Color fillColor;
|
Color fillColor;
|
||||||
if (MainManager.KeyboardManager.ActiveKeyboard is CorsairRGB)
|
if (MainManager.DeviceManager.ActiveKeyboard is CorsairRGB)
|
||||||
fillColor = Color.Black;
|
fillColor = Color.Black;
|
||||||
else
|
else
|
||||||
fillColor = Color.Transparent;
|
fillColor = Color.Transparent;
|
||||||
@ -134,6 +135,16 @@ namespace Artemis.Modules.Effects.TypeWave
|
|||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Wave
|
public class Wave
|
||||||
|
|||||||
@ -2,9 +2,11 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Models.Profiles;
|
||||||
using Artemis.Utilities.GameState;
|
using Artemis.Utilities.GameState;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Ninject.Extensions.Logging;
|
using Ninject.Extensions.Logging;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.CounterStrike
|
namespace Artemis.Modules.Games.CounterStrike
|
||||||
{
|
{
|
||||||
@ -47,10 +49,20 @@ namespace Artemis.Modules.Games.CounterStrike
|
|||||||
if (Profile == null || GameDataModel == null)
|
if (Profile == null || GameDataModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
return Profile.GenerateBitmap<CounterStrikeDataModel>(keyboardRect, GameDataModel, false, true);
|
return Profile.GenerateBitmap<CounterStrikeDataModel>(keyboardRect, GameDataModel, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<CounterStrikeDataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<CounterStrikeDataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
||||||
{
|
{
|
||||||
var jsonString = e.Json.ToString();
|
var jsonString = e.Json.ToString();
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Models.Profiles;
|
||||||
using Artemis.Utilities.GameState;
|
using Artemis.Utilities.GameState;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Dota2
|
namespace Artemis.Modules.Games.Dota2
|
||||||
{
|
{
|
||||||
@ -61,10 +63,19 @@ namespace Artemis.Modules.Games.Dota2
|
|||||||
if (Profile == null || GameDataModel == null)
|
if (Profile == null || GameDataModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
return Profile.GenerateBitmap<Dota2DataModel>(keyboardRect, GameDataModel, false, true);
|
return Profile.GenerateBitmap<Dota2DataModel>(keyboardRect, GameDataModel, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<Dota2DataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<Dota2DataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
public void HandleGameData(object sender, GameDataReceivedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,10 +3,12 @@ using System.Drawing;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Models.Profiles;
|
||||||
using Artemis.Settings;
|
using Artemis.Settings;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Memory;
|
using Artemis.Utilities.Memory;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.RocketLeague
|
namespace Artemis.Modules.Games.RocketLeague
|
||||||
{
|
{
|
||||||
@ -72,8 +74,18 @@ namespace Artemis.Modules.Games.RocketLeague
|
|||||||
if (Profile == null || GameDataModel == null)
|
if (Profile == null || GameDataModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
return Profile.GenerateBitmap<RocketLeagueDataModel>(keyboardRect, GameDataModel, false, true);
|
return Profile.GenerateBitmap<RocketLeagueDataModel>(keyboardRect, GameDataModel, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<RocketLeagueDataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<RocketLeagueDataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3,10 +3,12 @@ using System.Drawing;
|
|||||||
using System.Drawing.Drawing2D;
|
using System.Drawing.Drawing2D;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Models.Profiles;
|
||||||
using Artemis.Modules.Effects.TypeWave;
|
using Artemis.Modules.Effects.TypeWave;
|
||||||
using Artemis.Utilities;
|
using Artemis.Utilities;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
using Artemis.Utilities.LogitechDll;
|
using Artemis.Utilities.LogitechDll;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.TheDivision
|
namespace Artemis.Modules.Games.TheDivision
|
||||||
{
|
{
|
||||||
@ -46,7 +48,7 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
_ammoWave = new Wave(new Point(30, 14), 0, Color.Transparent);
|
_ammoWave = new Wave(new Point(30, 14), 0, Color.Transparent);
|
||||||
_hpRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 3*Scale, 0*Scale,
|
_hpRect = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 3*Scale, 0*Scale,
|
||||||
new List<Color>(),
|
new List<Color>(),
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
@ -56,7 +58,7 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
ContainedBrush = false
|
ContainedBrush = false
|
||||||
};
|
};
|
||||||
|
|
||||||
_p2 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 1*Scale,
|
_p2 = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0*Scale, 1*Scale,
|
||||||
new List<Color>(),
|
new List<Color>(),
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
@ -65,7 +67,7 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
Rotate = true,
|
Rotate = true,
|
||||||
ContainedBrush = false
|
ContainedBrush = false
|
||||||
};
|
};
|
||||||
_p3 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 3*Scale,
|
_p3 = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0*Scale, 3*Scale,
|
||||||
new List<Color>(),
|
new List<Color>(),
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
@ -74,7 +76,7 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
Rotate = true,
|
Rotate = true,
|
||||||
ContainedBrush = false
|
ContainedBrush = false
|
||||||
};
|
};
|
||||||
_p4 = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0*Scale, 5*Scale,
|
_p4 = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0*Scale, 5*Scale,
|
||||||
new List<Color>(),
|
new List<Color>(),
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
@ -204,7 +206,7 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
var bitmap = MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
var bitmap = MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(Scale);
|
||||||
using (var g = Graphics.FromImage(bitmap))
|
using (var g = Graphics.FromImage(bitmap))
|
||||||
{
|
{
|
||||||
g.Clear(Color.Transparent);
|
g.Clear(Color.Transparent);
|
||||||
@ -239,5 +241,15 @@ namespace Artemis.Modules.Games.TheDivision
|
|||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<TheDivisionDataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<TheDivisionDataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,7 +7,9 @@ using System.IO;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
|
using Artemis.Models.Profiles;
|
||||||
using Artemis.Utilities.Keyboard;
|
using Artemis.Utilities.Keyboard;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Games.Witcher3
|
namespace Artemis.Modules.Games.Witcher3
|
||||||
{
|
{
|
||||||
@ -45,7 +47,7 @@ namespace Artemis.Modules.Games.Witcher3
|
|||||||
{
|
{
|
||||||
Initialized = false;
|
Initialized = false;
|
||||||
|
|
||||||
_signRect = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
_signRect = new KeyboardRectangle(MainManager.DeviceManager.ActiveKeyboard, 0, 0, new List<Color>(),
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
Rotate = true,
|
Rotate = true,
|
||||||
@ -109,8 +111,18 @@ namespace Artemis.Modules.Games.Witcher3
|
|||||||
if (Profile == null || GameDataModel == null)
|
if (Profile == null || GameDataModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
var keyboardRect = MainManager.KeyboardManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
var keyboardRect = MainManager.DeviceManager.ActiveKeyboard.KeyboardRectangle(Scale);
|
||||||
return Profile.GenerateBitmap<TheWitcherDataModel>(keyboardRect, GameDataModel, false, true);
|
return Profile.GenerateBitmap<TheWitcherDataModel>(keyboardRect, GameDataModel, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<TheWitcherDataModel>(GameDataModel, LayerType.Mouse, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return Profile.GenerateBrush<TheWitcherDataModel>(GameDataModel, LayerType.Headset, false, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,11 +9,11 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
{
|
{
|
||||||
public class VolumeBar
|
public class VolumeBar
|
||||||
{
|
{
|
||||||
private readonly KeyboardManager _keyboardManager;
|
private readonly DeviceManager _deviceManager;
|
||||||
|
|
||||||
public VolumeBar(KeyboardManager keyboardManager, VolumeDisplaySettings settings)
|
public VolumeBar(DeviceManager deviceManager, VolumeDisplaySettings settings)
|
||||||
{
|
{
|
||||||
_keyboardManager = keyboardManager;
|
_deviceManager = deviceManager;
|
||||||
Settings = settings;
|
Settings = settings;
|
||||||
Transparancy = 255;
|
Transparancy = 255;
|
||||||
Scale = 4;
|
Scale = 4;
|
||||||
@ -30,14 +30,14 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
|
|
||||||
public void Draw(Graphics g)
|
public void Draw(Graphics g)
|
||||||
{
|
{
|
||||||
var volumeRect = new KeyboardRectangle(_keyboardManager.ActiveKeyboard, 0, 0, new List<Color>
|
var volumeRect = new KeyboardRectangle(_deviceManager.ActiveKeyboard, 0, 0, new List<Color>
|
||||||
{
|
{
|
||||||
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
ColorHelpers.ToDrawingColor(Settings.MainColor),
|
||||||
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
ColorHelpers.ToDrawingColor(Settings.SecondaryColor)
|
||||||
},
|
},
|
||||||
LinearGradientMode.Horizontal)
|
LinearGradientMode.Horizontal)
|
||||||
{
|
{
|
||||||
Width = (int) (_keyboardManager.ActiveKeyboard.Width*Scale/100.00*Volume),
|
Width = (int) (_deviceManager.ActiveKeyboard.Width*Scale/100.00*Volume),
|
||||||
ContainedBrush = false
|
ContainedBrush = false
|
||||||
};
|
};
|
||||||
volumeRect.Draw(g);
|
volumeRect.Draw(g);
|
||||||
|
|||||||
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
|||||||
using Artemis.Managers;
|
using Artemis.Managers;
|
||||||
using Artemis.Models;
|
using Artemis.Models;
|
||||||
using NAudio.CoreAudioApi;
|
using NAudio.CoreAudioApi;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
|
||||||
namespace Artemis.Modules.Overlays.VolumeDisplay
|
namespace Artemis.Modules.Overlays.VolumeDisplay
|
||||||
{
|
{
|
||||||
@ -15,7 +16,7 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
Name = "VolumeDisplay";
|
Name = "VolumeDisplay";
|
||||||
Enabled = Settings.Enabled;
|
Enabled = Settings.Enabled;
|
||||||
|
|
||||||
VolumeDisplay = new VolumeBar(MainManager.KeyboardManager, settings);
|
VolumeDisplay = new VolumeBar(MainManager.DeviceManager, settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VolumeBar VolumeDisplay { get; set; }
|
public VolumeBar VolumeDisplay { get; set; }
|
||||||
@ -63,7 +64,19 @@ namespace Artemis.Modules.Overlays.VolumeDisplay
|
|||||||
|
|
||||||
public override Bitmap GenerateBitmap()
|
public override Bitmap GenerateBitmap()
|
||||||
{
|
{
|
||||||
return GenerateBitmap(MainManager.KeyboardManager.ActiveKeyboard.KeyboardBitmap(4));
|
return GenerateBitmap(MainManager.DeviceManager.ActiveKeyboard.KeyboardBitmap(4));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Color according to volume
|
||||||
|
public override Brush GenerateMouseBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Color according to volume
|
||||||
|
public override Brush GenerateHeadsetBrush()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Bitmap GenerateBitmap(Bitmap bitmap)
|
public override Bitmap GenerateBitmap(Bitmap bitmap)
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using Brush = System.Windows.Media.Brush;
|
||||||
|
using Color = System.Drawing.Color;
|
||||||
|
|
||||||
namespace Artemis.Utilities
|
namespace Artemis.Utilities
|
||||||
{
|
{
|
||||||
|
|||||||
@ -81,6 +81,7 @@ namespace Artemis.Utilities.Layers
|
|||||||
c.PushClip(new RectangleGeometry(clip));
|
c.PushClip(new RectangleGeometry(clip));
|
||||||
c.DrawRectangle(brush, null, slide1);
|
c.DrawRectangle(brush, null, slide1);
|
||||||
c.DrawRectangle(brush, null, slide2);
|
c.DrawRectangle(brush, null, slide2);
|
||||||
|
c.Pop();
|
||||||
}
|
}
|
||||||
c.Pop();
|
c.Pop();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,7 +49,7 @@ namespace Artemis.ViewModels.Flyouts
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
var collection =
|
var collection =
|
||||||
new BindableCollection<string>(MainManager.KeyboardManager.KeyboardProviders.Select(k => k.Name));
|
new BindableCollection<string>(MainManager.DeviceManager.KeyboardProviders.Select(k => k.Name));
|
||||||
collection.Insert(0, "None");
|
collection.Insert(0, "None");
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
@ -111,15 +111,15 @@ namespace Artemis.ViewModels.Flyouts
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_logger.Debug("Handling SelectedKeyboard change in UI");
|
_logger.Debug("Handling SelectedKeyboard change in UI");
|
||||||
var keyboard = MainManager.KeyboardManager.KeyboardProviders
|
var keyboard = MainManager.DeviceManager.KeyboardProviders
|
||||||
.FirstOrDefault(k => k.Name == SelectedKeyboardProvider);
|
.FirstOrDefault(k => k.Name == SelectedKeyboardProvider);
|
||||||
if (keyboard != null)
|
if (keyboard != null)
|
||||||
{
|
{
|
||||||
MainManager.KeyboardManager.EnableKeyboard(keyboard);
|
MainManager.DeviceManager.EnableKeyboard(keyboard);
|
||||||
MainManager.LoopManager.Start();
|
MainManager.LoopManager.Start();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
MainManager.KeyboardManager.ReleaseActiveKeyboard(true);
|
MainManager.DeviceManager.ReleaseActiveKeyboard(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleEnabled()
|
public void ToggleEnabled()
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
using Artemis.Models.Interfaces;
|
||||||
|
using Artemis.Models.Profiles.Properties;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
|
||||||
|
namespace Artemis.ViewModels.LayerEditor
|
||||||
|
{
|
||||||
|
public class HeadsetPropertiesViewModel : LayerPropertiesViewModel
|
||||||
|
{
|
||||||
|
private LayerPropertiesModel _proposedProperties;
|
||||||
|
|
||||||
|
public HeadsetPropertiesViewModel(IGameDataModel gameDataModel, LayerPropertiesModel properties)
|
||||||
|
: base(gameDataModel)
|
||||||
|
{
|
||||||
|
ProposedProperties = GeneralHelpers.Clone(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerPropertiesModel ProposedProperties
|
||||||
|
{
|
||||||
|
get { return _proposedProperties; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _proposedProperties)) return;
|
||||||
|
_proposedProperties = value;
|
||||||
|
NotifyOfPropertyChange(() => ProposedProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override LayerPropertiesModel GetAppliedProperties()
|
||||||
|
{
|
||||||
|
return GeneralHelpers.Clone(ProposedProperties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,7 +25,6 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
_gameDataModel = gameDataModel;
|
_gameDataModel = gameDataModel;
|
||||||
|
|
||||||
Layer = layer;
|
Layer = layer;
|
||||||
|
|
||||||
if (Layer.Properties == null)
|
if (Layer.Properties == null)
|
||||||
Layer.SetupProperties();
|
Layer.SetupProperties();
|
||||||
|
|
||||||
@ -108,7 +107,7 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
public void PreSelect()
|
public void PreSelect()
|
||||||
{
|
{
|
||||||
LayerType = Layer.LayerType;
|
LayerType = Layer.LayerType;
|
||||||
GeneralHelpers.CopyProperties(ProposedProperties, Layer.Properties);
|
ProposedProperties = GeneralHelpers.Clone(Layer.Properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PropertiesViewModelHandler(object sender, PropertyChangedEventArgs e)
|
private void PropertiesViewModelHandler(object sender, PropertyChangedEventArgs e)
|
||||||
@ -138,7 +137,9 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (LayerType == LayerType.Mouse && !(LayerPropertiesViewModel is MousePropertiesViewModel))
|
else if (LayerType == LayerType.Mouse && !(LayerPropertiesViewModel is MousePropertiesViewModel))
|
||||||
LayerPropertiesViewModel = new MousePropertiesViewModel(_gameDataModel);
|
LayerPropertiesViewModel = new MousePropertiesViewModel(_gameDataModel, Layer.Properties);
|
||||||
|
else if (LayerType == LayerType.Headset && !(LayerPropertiesViewModel is HeadsetPropertiesViewModel))
|
||||||
|
LayerPropertiesViewModel = new HeadsetPropertiesViewModel(_gameDataModel, Layer.Properties);
|
||||||
|
|
||||||
NotifyOfPropertyChange(() => LayerPropertiesViewModel);
|
NotifyOfPropertyChange(() => LayerPropertiesViewModel);
|
||||||
}
|
}
|
||||||
@ -146,13 +147,15 @@ namespace Artemis.ViewModels.LayerEditor
|
|||||||
public void AddCondition()
|
public void AddCondition()
|
||||||
{
|
{
|
||||||
var condition = new LayerConditionModel();
|
var condition = new LayerConditionModel();
|
||||||
Layer.Properties.Conditions.Add(condition);
|
|
||||||
LayerConditionVms.Add(new LayerConditionViewModel(this, condition, DataModelProps));
|
LayerConditionVms.Add(new LayerConditionViewModel(this, condition, DataModelProps));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Apply()
|
public void Apply()
|
||||||
{
|
{
|
||||||
Layer.Properties = LayerPropertiesViewModel.GetAppliedProperties();
|
Layer.Properties = LayerPropertiesViewModel.GetAppliedProperties();
|
||||||
|
Layer.Properties.Conditions.Clear();
|
||||||
|
foreach (var conditionViewModel in LayerConditionVms)
|
||||||
|
Layer.Properties.Conditions.Add(conditionViewModel.LayerConditionModel);
|
||||||
|
|
||||||
if (Layer.LayerType != LayerType.KeyboardGif)
|
if (Layer.LayerType != LayerType.KeyboardGif)
|
||||||
return; // Don't bother checking for a GIF path unless the type is GIF
|
return; // Don't bother checking for a GIF path unless the type is GIF
|
||||||
|
|||||||
@ -1,17 +1,33 @@
|
|||||||
using Artemis.Models.Interfaces;
|
using Artemis.Models.Interfaces;
|
||||||
using Artemis.Models.Profiles.Properties;
|
using Artemis.Models.Profiles.Properties;
|
||||||
|
using Artemis.Utilities;
|
||||||
|
|
||||||
namespace Artemis.ViewModels.LayerEditor
|
namespace Artemis.ViewModels.LayerEditor
|
||||||
{
|
{
|
||||||
public class MousePropertiesViewModel : LayerPropertiesViewModel
|
public class MousePropertiesViewModel : LayerPropertiesViewModel
|
||||||
{
|
{
|
||||||
public MousePropertiesViewModel(IGameDataModel gameDataModel) : base(gameDataModel)
|
private LayerPropertiesModel _proposedProperties;
|
||||||
|
|
||||||
|
public MousePropertiesViewModel(IGameDataModel gameDataModel, LayerPropertiesModel properties)
|
||||||
|
: base(gameDataModel)
|
||||||
{
|
{
|
||||||
|
ProposedProperties = GeneralHelpers.Clone(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LayerPropertiesModel ProposedProperties
|
||||||
|
{
|
||||||
|
get { return _proposedProperties; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (Equals(value, _proposedProperties)) return;
|
||||||
|
_proposedProperties = value;
|
||||||
|
NotifyOfPropertyChange(() => ProposedProperties);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override LayerPropertiesModel GetAppliedProperties()
|
public override LayerPropertiesModel GetAppliedProperties()
|
||||||
{
|
{
|
||||||
return null;
|
return GeneralHelpers.Clone(ProposedProperties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ namespace Artemis.ViewModels
|
|||||||
|
|
||||||
Profiles = new BindableCollection<ProfileModel>();
|
Profiles = new BindableCollection<ProfileModel>();
|
||||||
Layers = new BindableCollection<LayerModel>();
|
Layers = new BindableCollection<LayerModel>();
|
||||||
ActiveKeyboard = _mainManager.KeyboardManager.ActiveKeyboard;
|
ActiveKeyboard = _mainManager.DeviceManager.ActiveKeyboard;
|
||||||
|
|
||||||
events.Subscribe(this);
|
events.Subscribe(this);
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ namespace Artemis.ViewModels
|
|||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
public void Handle(ActiveKeyboardChanged message)
|
public void Handle(ActiveKeyboardChanged message)
|
||||||
{
|
{
|
||||||
ActiveKeyboard = _mainManager.KeyboardManager.ActiveKeyboard;
|
ActiveKeyboard = _mainManager.DeviceManager.ActiveKeyboard;
|
||||||
NotifyOfPropertyChange(() => KeyboardImage);
|
NotifyOfPropertyChange(() => KeyboardImage);
|
||||||
NotifyOfPropertyChange(() => PreviewSettings);
|
NotifyOfPropertyChange(() => PreviewSettings);
|
||||||
LoadProfiles();
|
LoadProfiles();
|
||||||
@ -412,7 +412,7 @@ namespace Artemis.ViewModels
|
|||||||
|
|
||||||
private void InvokeUpdateKeyboardPreview(object sender, ElapsedEventArgs e)
|
private void InvokeUpdateKeyboardPreview(object sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke(UpdateKeyboardPreview, DispatcherPriority.ContextIdle);
|
Application.Current.Dispatcher.InvokeAsync(UpdateKeyboardPreview, DispatcherPriority.ContextIdle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
34
Artemis/Artemis/Views/LayerEditor/HeadsetPropertiesView.xaml
Normal file
34
Artemis/Artemis/Views/LayerEditor/HeadsetPropertiesView.xaml
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<UserControl x:Class="Artemis.Views.LayerEditor.HeadsetPropertiesView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- Colors -->
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||||
|
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||||
|
VerticalAlignment="Top" Height="18" Width="130" />
|
||||||
|
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||||
|
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||||
|
<ncore:ColorBox Brush="{Binding Path=ProposedProperties.Brush, Mode=TwoWay}" Height="24" Width="134" />
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||||
|
Foreground="{DynamicResource HighlightBrush}"
|
||||||
|
Text="Note: If your headset has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
||||||
|
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Artemis.Views.LayerEditor
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for HeadsetPropertiesView.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class HeadsetPropertiesView : UserControl
|
||||||
|
{
|
||||||
|
public HeadsetPropertiesView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -9,8 +9,6 @@
|
|||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Artemis | Edit Layer" Height="750" Width="630"
|
Title="Artemis | Edit Layer" Height="750" Width="630"
|
||||||
xmlns:profileEnumerations="clr-namespace:Artemis.Models.Profiles"
|
xmlns:profileEnumerations="clr-namespace:Artemis.Models.Profiles"
|
||||||
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
|
||||||
xmlns:properties="clr-namespace:Artemis.Models.Profiles.Properties"
|
|
||||||
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../../Resources/bow.png"
|
GlowBrush="{DynamicResource AccentColorBrush}" Icon="../../Resources/bow.png"
|
||||||
ResizeMode="NoResize">
|
ResizeMode="NoResize">
|
||||||
<controls:MetroWindow.Resources>
|
<controls:MetroWindow.Resources>
|
||||||
|
|||||||
@ -3,10 +3,32 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Artemis.Views.LayerEditor"
|
xmlns:ncore="http://schemas.ncore.com/wpf/xaml/colorbox"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock>NYI</TextBlock>
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<!-- Colors -->
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Orientation="Horizontal" x:Name="ShowBrush">
|
||||||
|
<TextBlock Margin="10,13,10,0" FontSize="13.333" Text="Color(s):"
|
||||||
|
VerticalAlignment="Top" Height="18" Width="130" />
|
||||||
|
<Border Margin="10" BorderBrush="{StaticResource ControlBorderBrush}"
|
||||||
|
BorderThickness="1" SnapsToDevicePixels="True" ToolTip="Click to edit">
|
||||||
|
<ncore:ColorBox Brush="{Binding Path=ProposedProperties.Brush, Mode=TwoWay}" Height="24" Width="134" />
|
||||||
|
</Border>
|
||||||
|
</StackPanel>
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="4" Margin="10,2,10,10" FontSize="13.333"
|
||||||
|
Foreground="{DynamicResource HighlightBrush}"
|
||||||
|
Text="Note: If your mouse has multiple controllable LEDs you can create a gradient. Artemis will take the colors in the gradient and assign them to the LEDs"
|
||||||
|
VerticalAlignment="Top" Height="Auto" TextWrapping="Wrap" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@ -85,8 +85,7 @@
|
|||||||
<MenuItem Header="Properties" cal:Message.Attach="LayerEditor($datacontext)" />
|
<MenuItem Header="Properties" cal:Message.Attach="LayerEditor($datacontext)" />
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</StackPanel.ContextMenu>
|
</StackPanel.ContextMenu>
|
||||||
<CheckBox VerticalAlignment="Center" ToolTip="Layer enabled" IsChecked="{Binding Enabled}"
|
<CheckBox VerticalAlignment="Center" ToolTip="Layer enabled" IsChecked="{Binding Enabled}" />
|
||||||
cal:Message.Attach="ToggleEnabled($datacontext)" />
|
|
||||||
<Image Height="18" Width="18" Source="{Binding LayerImage}" />
|
<Image Height="18" Width="18" Source="{Binding LayerImage}" />
|
||||||
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" VerticalAlignment="Center" />
|
<TextBlock Margin="5,0,0,0" Text="{Binding Name}" VerticalAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user