mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Input - Polished up UI
Input - Added events to service
This commit is contained in:
parent
6ee5cbd09c
commit
f1f0abfec5
@ -23,8 +23,10 @@ namespace Artemis.Core
|
||||
RgbDevice = rgbDevice;
|
||||
DeviceProvider = deviceProvider;
|
||||
Surface = surface;
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
DeviceEntity = new DeviceEntity();
|
||||
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
|
||||
_leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly();
|
||||
|
||||
Rotation = 0;
|
||||
@ -40,8 +42,12 @@ namespace Artemis.Core
|
||||
RgbDevice = rgbDevice;
|
||||
DeviceProvider = deviceProvider;
|
||||
Surface = surface;
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
DeviceEntity = deviceEntity;
|
||||
|
||||
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
|
||||
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
||||
InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier));
|
||||
|
||||
_leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly();
|
||||
}
|
||||
|
||||
@ -183,10 +189,10 @@ namespace Artemis.Core
|
||||
// Other properties are computed
|
||||
DeviceEntity.DeviceIdentifier = RgbDevice.GetDeviceIdentifier();
|
||||
|
||||
DeviceEntity.InputIdentifier.Clear();
|
||||
DeviceEntity.InputIdentifiers.Clear();
|
||||
foreach (ArtemisDeviceInputIdentifier identifier in InputIdentifiers)
|
||||
{
|
||||
DeviceEntity.InputIdentifier.Add(new DeviceInputIdentifierEntity
|
||||
DeviceEntity.InputIdentifiers.Add(new DeviceInputIdentifierEntity
|
||||
{
|
||||
InputProvider = identifier.InputProvider,
|
||||
Identifier = identifier.Identifier
|
||||
@ -205,7 +211,7 @@ namespace Artemis.Core
|
||||
RgbDevice.Location = new Point(DeviceEntity.X, DeviceEntity.Y);
|
||||
|
||||
InputIdentifiers.Clear();
|
||||
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifier)
|
||||
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
|
||||
InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier));
|
||||
|
||||
CalculateRenderProperties();
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
/// <summary>
|
||||
/// Represents a device that provides input to the <see cref="IInputService" />
|
||||
/// </summary>
|
||||
public enum InputFallbackDeviceType
|
||||
public enum InputDeviceType
|
||||
{
|
||||
/// <summary>
|
||||
/// None
|
||||
@ -6,7 +6,7 @@ namespace Artemis.Core.Services
|
||||
/// Specifies the set of modifier keys.
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum KeyboardModifierKeys
|
||||
public enum KeyboardModifierKey
|
||||
{
|
||||
/// <summary>No modifiers are pressed.</summary>
|
||||
None = 0,
|
||||
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for input provider identifier events
|
||||
/// </summary>
|
||||
public class InputProviderIdentifierEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="InputProviderIdentifierEventArgs" /> class
|
||||
/// </summary>
|
||||
/// <param name="identifier">A value that can be used to identify this device</param>
|
||||
/// <param name="deviceType">The type of device this identifier belongs to</param>
|
||||
public InputProviderIdentifierEventArgs(object identifier, InputDeviceType deviceType)
|
||||
{
|
||||
Identifier = identifier;
|
||||
DeviceType = deviceType;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value that can be used to identify this device
|
||||
/// </summary>
|
||||
public object Identifier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of device this identifier belongs to
|
||||
/// </summary>
|
||||
public InputDeviceType DeviceType { get; }
|
||||
}
|
||||
}
|
||||
@ -29,22 +29,22 @@ namespace Artemis.Core.Services
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the X position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// Gets the X position of the mouse cursor in pixels (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Y position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// Gets the Y position of the mouse cursor in pixels (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorY { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the horizontal direction
|
||||
/// Gets the movement delta in the horizontal direction in pixels
|
||||
/// </summary>
|
||||
public int DeltaX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the vertical direction
|
||||
/// Gets the movement delta in the vertical direction in pixels
|
||||
/// </summary>
|
||||
public int DeltaY { get; }
|
||||
}
|
||||
|
||||
@ -5,9 +5,9 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class KeyboardEventArgs : EventArgs
|
||||
public class KeyboardKeyEventArgs : EventArgs
|
||||
{
|
||||
internal KeyboardEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKeys modifiers)
|
||||
internal KeyboardKeyEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKey modifiers)
|
||||
{
|
||||
Device = device;
|
||||
Led = led;
|
||||
@ -33,22 +33,6 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Gets the modifiers that are pressed
|
||||
/// </summary>
|
||||
public KeyboardModifierKeys Modifiers { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class KeyboardKeyUpDownEventArgs : KeyboardEventArgs
|
||||
{
|
||||
internal KeyboardKeyUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKeys modifiers, bool isDown) : base(device, led, key, modifiers)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the key is being pressed down, if <see langword="false"/> the key is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
public KeyboardModifierKey Modifiers { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for keyboard input events
|
||||
/// </summary>
|
||||
public class KeyboardKeyUpDownEventArgs : KeyboardKeyEventArgs
|
||||
{
|
||||
internal KeyboardKeyUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, KeyboardKey key, KeyboardModifierKey modifiers, bool isDown) : base(device, led, key, modifiers)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the key is being pressed down, if <see langword="false"/> the key is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse input events
|
||||
/// </summary>
|
||||
public class MouseButtonEventArgs : EventArgs
|
||||
{
|
||||
internal MouseButtonEventArgs(ArtemisDevice? device, ArtemisLed? led, MouseButton button)
|
||||
{
|
||||
Device = device;
|
||||
Led = led;
|
||||
Button = button;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the LED that corresponds to the pressed key
|
||||
/// </summary>
|
||||
public ArtemisLed? Led { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the button that triggered the event
|
||||
/// </summary>
|
||||
public MouseButton Button { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse input events
|
||||
/// </summary>
|
||||
public class MouseButtonUpDownEventArgs : MouseButtonEventArgs
|
||||
{
|
||||
internal MouseButtonUpDownEventArgs(ArtemisDevice? device, ArtemisLed? led, MouseButton button, bool isDown) : base(device, led, button)
|
||||
{
|
||||
IsDown = isDown;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether the button is being pressed down, if <see langword="false"/> the button is being released
|
||||
/// </summary>
|
||||
public bool IsDown { get; set; }
|
||||
}
|
||||
}
|
||||
51
src/Artemis.Core/Services/Input/Events/MouseMoveEventArgs.cs
Normal file
51
src/Artemis.Core/Services/Input/Events/MouseMoveEventArgs.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse movement events
|
||||
/// </summary>
|
||||
public class MouseMoveEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
internal MouseMoveEventArgs(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
Device = device;
|
||||
CursorX = cursorX;
|
||||
CursorY = cursorY;
|
||||
DeltaX = deltaX;
|
||||
DeltaY = deltaY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the X position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Y position of the mouse cursor (not necessarily tied to the specific device)
|
||||
/// </summary>
|
||||
public int CursorY { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the horizontal direction
|
||||
/// </summary>
|
||||
public int DeltaX { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the movement delta in the vertical direction
|
||||
/// </summary>
|
||||
public int DeltaY { get; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
using System;
|
||||
|
||||
namespace Artemis.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains data for mouse scroll events
|
||||
/// </summary>
|
||||
public class MouseScrollEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
internal MouseScrollEventArgs(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
Device = device;
|
||||
Direction = direction;
|
||||
Delta = delta;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the device that triggered the event
|
||||
/// </summary>
|
||||
public ArtemisDevice? Device { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the direction in which was scrolled
|
||||
/// </summary>
|
||||
public MouseScrollDirection Direction { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scroll delta (can positive or negative)
|
||||
/// </summary>
|
||||
public int Delta { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled up
|
||||
/// </summary>
|
||||
public bool IsScrollingUp => Direction == MouseScrollDirection.Vertical && Delta > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled down
|
||||
/// </summary>
|
||||
public bool IsScrollingDown => Direction == MouseScrollDirection.Vertical && Delta < 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled right
|
||||
/// </summary>
|
||||
public bool IsScrollingRight => Direction == MouseScrollDirection.Horizontal && Delta > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a boolean indicating whether the mouse scrolled left
|
||||
/// </summary>
|
||||
public bool IsScrollingLeft => Direction == MouseScrollDirection.Horizontal && Delta < 0;
|
||||
}
|
||||
}
|
||||
@ -31,51 +31,68 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Occurs when the input provided received a device identifier
|
||||
/// </summary>
|
||||
public event EventHandler<object>? IdentifierReceived;
|
||||
public event EventHandler<InputProviderIdentifierEventArgs>? IdentifierReceived;
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="KeyboardDataReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
protected virtual void OnKeyboardDataReceived(InputProviderKeyboardEventArgs e)
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="key">The key that triggered the event</param>
|
||||
/// <param name="isDown">Whether the key is pressed down</param>
|
||||
protected virtual void OnKeyboardDataReceived(ArtemisDevice? device, KeyboardKey key, bool isDown)
|
||||
{
|
||||
KeyboardDataReceived?.Invoke(this, e);
|
||||
KeyboardDataReceived?.Invoke(this, new InputProviderKeyboardEventArgs(device, key, isDown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseButtonDataReceived" /> event which the <see cref="IInputService" /> listens to as long
|
||||
/// as this provider is registered
|
||||
/// </summary>
|
||||
protected virtual void OnMouseButtonDataReceived(InputProviderMouseButtonEventArgs e)
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="button">The button that triggered the event</param>
|
||||
/// <param name="isDown">Whether the button is pressed down</param>
|
||||
protected virtual void OnMouseButtonDataReceived(ArtemisDevice? device, MouseButton button, bool isDown)
|
||||
{
|
||||
MouseButtonDataReceived?.Invoke(this, e);
|
||||
MouseButtonDataReceived?.Invoke(this, new InputProviderMouseButtonEventArgs(device, button, isDown));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseScrollDataReceived" /> event which the <see cref="IInputService" /> listens to as long
|
||||
/// as this provider is registered
|
||||
/// </summary>
|
||||
protected virtual void OnMouseScrollDataReceived(InputProviderMouseScrollEventArgs e)
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="direction">The direction in which was scrolled</param>
|
||||
/// <param name="delta">The scroll delta (can positive or negative)</param>
|
||||
protected virtual void OnMouseScrollDataReceived(ArtemisDevice? device, MouseScrollDirection direction, int delta)
|
||||
{
|
||||
MouseScrollDataReceived?.Invoke(this, e);
|
||||
MouseScrollDataReceived?.Invoke(this, new InputProviderMouseScrollEventArgs(device, direction, delta));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="MouseMoveDataReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// </summary>
|
||||
protected virtual void OnMouseMoveDataReceived(InputProviderMouseMoveEventArgs e)
|
||||
/// <param name="device">The device that triggered the event</param>
|
||||
/// <param name="cursorX">The X position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="cursorY">The Y position of the mouse cursor (not necessarily tied to the specific device)</param>
|
||||
/// <param name="deltaX">The movement delta in the horizontal direction</param>
|
||||
/// <param name="deltaY">The movement delta in the vertical direction</param>
|
||||
protected virtual void OnMouseMoveDataReceived(ArtemisDevice? device, int cursorX, int cursorY, int deltaX, int deltaY)
|
||||
{
|
||||
MouseMoveDataReceived?.Invoke(this, e);
|
||||
MouseMoveDataReceived?.Invoke(this, new InputProviderMouseMoveEventArgs(device, cursorX, cursorY, deltaX, deltaY));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokes the <see cref="IdentifierReceived" /> event which the <see cref="IInputService" /> listens to as long as
|
||||
/// this provider is registered
|
||||
/// <para>Except for on mouse movement, call this whenever you have an identifier ready for the core to process</para>
|
||||
/// </summary>
|
||||
protected virtual void OnIdentifierReceived(object identifier)
|
||||
/// <param name="identifier">A value that can be used to identify this device</param>
|
||||
/// <param name="deviceType">The type of device this identifier belongs to</param>
|
||||
protected virtual void OnIdentifierReceived(object identifier, InputDeviceType deviceType)
|
||||
{
|
||||
IdentifierReceived?.Invoke(this, identifier);
|
||||
IdentifierReceived?.Invoke(this, new InputProviderIdentifierEventArgs(identifier, deviceType));
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
@ -10,14 +10,13 @@ namespace Artemis.Core.Services
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly ISurfaceService _surfaceService;
|
||||
private readonly List<InputProvider> _inputProviders;
|
||||
|
||||
public InputService(ILogger logger, ISurfaceService surfaceService)
|
||||
{
|
||||
_logger = logger;
|
||||
_surfaceService = surfaceService;
|
||||
_inputProviders = new List<InputProvider>();
|
||||
_keyboardModifier = new Dictionary<ArtemisDevice, KeyboardModifierKeys>();
|
||||
_keyboardModifier = new Dictionary<ArtemisDevice, KeyboardModifierKey>();
|
||||
_deviceCache = new Dictionary<Tuple<InputProvider, object>, ArtemisDevice>();
|
||||
_devices = new List<ArtemisDevice>();
|
||||
|
||||
@ -26,6 +25,21 @@ namespace Artemis.Core.Services
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
while (_inputProviders.Any())
|
||||
RemoveInputProvider(_inputProviders.First());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Providers
|
||||
|
||||
private readonly List<InputProvider> _inputProviders;
|
||||
|
||||
public void AddInputProvider(InputProvider inputProvider)
|
||||
{
|
||||
inputProvider.IdentifierReceived += InputProviderOnIdentifierReceived;
|
||||
@ -49,6 +63,8 @@ namespace Artemis.Core.Services
|
||||
inputProvider.MouseMoveDataReceived -= InputProviderOnMouseMoveDataReceived;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Identification
|
||||
|
||||
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache;
|
||||
@ -59,6 +75,10 @@ namespace Artemis.Core.Services
|
||||
|
||||
public void IdentifyDevice(ArtemisDevice device)
|
||||
{
|
||||
if (device.RgbDevice.DeviceInfo.DeviceType != RGBDeviceType.Keyboard && device.RgbDevice.DeviceInfo.DeviceType != RGBDeviceType.Mouse)
|
||||
throw new ArtemisCoreException($"Cannot initialize input-identification for a device of type {device.RgbDevice.DeviceInfo.DeviceType}. \r\n" +
|
||||
"Only keyboard and mouse is supported.");
|
||||
|
||||
_identifyingDevice = device;
|
||||
_logger.Debug("Start identifying device {device}", device);
|
||||
}
|
||||
@ -73,7 +93,7 @@ namespace Artemis.Core.Services
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
public ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputFallbackDeviceType fallbackType)
|
||||
public ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputDeviceType type)
|
||||
{
|
||||
if (provider == null) throw new ArgumentNullException(nameof(provider));
|
||||
if (identifier == null) throw new ArgumentNullException(nameof(identifier));
|
||||
@ -84,7 +104,7 @@ namespace Artemis.Core.Services
|
||||
return cacheMatch;
|
||||
|
||||
string providerName = provider.GetType().FullName!;
|
||||
ArtemisDevice? match = _devices.FirstOrDefault(m => m.InputIdentifiers.Any(i => Equals(i.InputProvider,providerName) && Equals(i.Identifier, identifier)));
|
||||
ArtemisDevice? match = _devices.FirstOrDefault(m => m.InputIdentifiers.Any(i => Equals(i.InputProvider, providerName) && Equals(i.Identifier, identifier)));
|
||||
|
||||
// If a match was found cache it to speed up the next event and return the match
|
||||
if (match != null)
|
||||
@ -94,9 +114,9 @@ namespace Artemis.Core.Services
|
||||
}
|
||||
|
||||
// If there is no match, apply our fallback type
|
||||
if (fallbackType == InputFallbackDeviceType.None)
|
||||
if (type == InputDeviceType.None)
|
||||
return null;
|
||||
if (fallbackType == InputFallbackDeviceType.Keyboard)
|
||||
if (type == InputDeviceType.Keyboard)
|
||||
{
|
||||
if (_cachedFallbackKeyboard != null)
|
||||
return _cachedFallbackKeyboard;
|
||||
@ -104,7 +124,7 @@ namespace Artemis.Core.Services
|
||||
return _cachedFallbackKeyboard;
|
||||
}
|
||||
|
||||
if (fallbackType == InputFallbackDeviceType.Mouse)
|
||||
if (type == InputDeviceType.Mouse)
|
||||
{
|
||||
if (_cachedFallbackMouse != null)
|
||||
return _cachedFallbackMouse;
|
||||
@ -140,9 +160,12 @@ namespace Artemis.Core.Services
|
||||
BustIdentifierCache();
|
||||
}
|
||||
|
||||
private void InputProviderOnIdentifierReceived(object? sender, object identifier)
|
||||
private void InputProviderOnIdentifierReceived(object? sender, InputProviderIdentifierEventArgs e)
|
||||
{
|
||||
if (_identifyingDevice == null)
|
||||
// Don't match if there is no device or if the device type differs from the event device type
|
||||
if (_identifyingDevice == null ||
|
||||
_identifyingDevice.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard && e.DeviceType == InputDeviceType.Mouse ||
|
||||
_identifyingDevice.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse && e.DeviceType == InputDeviceType.Keyboard)
|
||||
return;
|
||||
if (!(sender is InputProvider inputProvider))
|
||||
return;
|
||||
@ -151,7 +174,7 @@ namespace Artemis.Core.Services
|
||||
|
||||
// Remove existing identification
|
||||
_identifyingDevice.InputIdentifiers.RemoveAll(i => i.InputProvider == providerName);
|
||||
_identifyingDevice.InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(providerName, identifier));
|
||||
_identifyingDevice.InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(providerName, e.Identifier));
|
||||
|
||||
StopIdentify();
|
||||
OnDeviceIdentified();
|
||||
@ -161,12 +184,12 @@ namespace Artemis.Core.Services
|
||||
|
||||
#region Keyboard
|
||||
|
||||
private readonly Dictionary<ArtemisDevice, KeyboardModifierKeys> _keyboardModifier;
|
||||
private KeyboardModifierKeys _globalModifiers;
|
||||
private readonly Dictionary<ArtemisDevice, KeyboardModifierKey> _keyboardModifier;
|
||||
private KeyboardModifierKey _globalModifiers;
|
||||
|
||||
private void InputProviderOnKeyboardDataReceived(object? sender, InputProviderKeyboardEventArgs e)
|
||||
{
|
||||
KeyboardModifierKeys keyboardModifierKeys = UpdateModifierKeys(e.Device, e.Key, e.IsDown);
|
||||
KeyboardModifierKey keyboardModifierKey = UpdateModifierKeys(e.Device, e.Key, e.IsDown);
|
||||
|
||||
// Get the LED - TODO: leverage a lookup
|
||||
bool foundLedId = InputKeyUtilities.KeyboardKeyLedIdMap.TryGetValue(e.Key, out LedId ledId);
|
||||
@ -175,49 +198,49 @@ namespace Artemis.Core.Services
|
||||
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
||||
|
||||
// Create the UpDown event args because it can be used for every event
|
||||
KeyboardKeyUpDownEventArgs eventArgs = new KeyboardKeyUpDownEventArgs(e.Device, led, e.Key, keyboardModifierKeys, e.IsDown);
|
||||
KeyboardKeyUpDownEventArgs eventArgs = new KeyboardKeyUpDownEventArgs(e.Device, led, e.Key, keyboardModifierKey, e.IsDown);
|
||||
OnKeyboardKeyUpDown(eventArgs);
|
||||
if (e.IsDown)
|
||||
OnKeyboardKeyDown(eventArgs);
|
||||
else
|
||||
OnKeyboardKeyUp(eventArgs);
|
||||
|
||||
_logger.Verbose("Keyboard data: LED ID: {ledId}, key: {key}, is down: {isDown}, modifiers: {modifiers}, device: {device} ", ledId, e.Key, e.IsDown, keyboardModifierKeys, e.Device);
|
||||
// _logger.Verbose("Keyboard data: LED ID: {ledId}, key: {key}, is down: {isDown}, modifiers: {modifiers}, device: {device} ", ledId, e.Key, e.IsDown, keyboardModifierKey, e.Device);
|
||||
}
|
||||
|
||||
private KeyboardModifierKeys UpdateModifierKeys(ArtemisDevice? device, KeyboardKey key, in bool isDown)
|
||||
private KeyboardModifierKey UpdateModifierKeys(ArtemisDevice? device, KeyboardKey key, in bool isDown)
|
||||
{
|
||||
KeyboardModifierKeys modifiers = _globalModifiers;
|
||||
KeyboardModifierKey modifiers = _globalModifiers;
|
||||
if (device != null)
|
||||
_keyboardModifier.TryGetValue(device, out modifiers);
|
||||
|
||||
if (key == KeyboardKey.LeftAlt || key == KeyboardKey.RightAlt)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers = modifiers | KeyboardModifierKeys.Alt;
|
||||
modifiers |= KeyboardModifierKey.Alt;
|
||||
else
|
||||
modifiers = modifiers & ~KeyboardModifierKeys.Alt;
|
||||
modifiers &= ~KeyboardModifierKey.Alt;
|
||||
}
|
||||
else if (key == KeyboardKey.LeftCtrl || key == KeyboardKey.RightCtrl)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers = modifiers | KeyboardModifierKeys.Control;
|
||||
modifiers |= KeyboardModifierKey.Control;
|
||||
else
|
||||
modifiers = modifiers & ~KeyboardModifierKeys.Control;
|
||||
modifiers &= ~KeyboardModifierKey.Control;
|
||||
}
|
||||
else if (key == KeyboardKey.LeftShift || key == KeyboardKey.RightShift)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers = modifiers | KeyboardModifierKeys.Shift;
|
||||
modifiers |= KeyboardModifierKey.Shift;
|
||||
else
|
||||
modifiers = modifiers & ~KeyboardModifierKeys.Shift;
|
||||
modifiers &= ~KeyboardModifierKey.Shift;
|
||||
}
|
||||
else if (key == KeyboardKey.LWin || key == KeyboardKey.RWin)
|
||||
{
|
||||
if (isDown)
|
||||
modifiers = modifiers | KeyboardModifierKeys.Windows;
|
||||
modifiers |= KeyboardModifierKey.Windows;
|
||||
else
|
||||
modifiers = modifiers & ~KeyboardModifierKeys.Windows;
|
||||
modifiers &= ~KeyboardModifierKey.Windows;
|
||||
}
|
||||
|
||||
if (device != null)
|
||||
@ -235,16 +258,30 @@ namespace Artemis.Core.Services
|
||||
private void InputProviderOnMouseButtonDataReceived(object? sender, InputProviderMouseButtonEventArgs e)
|
||||
{
|
||||
bool foundLedId = InputKeyUtilities.MouseButtonLedIdMap.TryGetValue(e.Button, out LedId ledId);
|
||||
ArtemisLed? led = null;
|
||||
if (foundLedId && e.Device != null)
|
||||
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
||||
|
||||
// Create the UpDown event args because it can be used for every event
|
||||
MouseButtonUpDownEventArgs eventArgs = new MouseButtonUpDownEventArgs(e.Device, led, e.Button, e.IsDown);
|
||||
OnMouseButtonUpDown(eventArgs);
|
||||
if (e.IsDown)
|
||||
OnMouseButtonDown(eventArgs);
|
||||
else
|
||||
OnMouseButtonUp(eventArgs);
|
||||
|
||||
// _logger.Verbose("Mouse button data: LED ID: {ledId}, button: {button}, is down: {isDown}, device: {device} ", ledId, e.Button, e.IsDown, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnMouseScrollDataReceived(object? sender, InputProviderMouseScrollEventArgs e)
|
||||
{
|
||||
OnMouseScroll(new MouseScrollEventArgs(e.Device, e.Direction, e.Delta));
|
||||
// _logger.Verbose("Mouse scroll data: Direction: {direction}, delta: {delta}, device: {device} ", e.Direction, e.Delta, e.Device);
|
||||
}
|
||||
|
||||
private void InputProviderOnMouseMoveDataReceived(object? sender, InputProviderMouseMoveEventArgs e)
|
||||
{
|
||||
OnMouseMove(new MouseMoveEventArgs(e.Device, e.CursorX, e.CursorY, e.DeltaX, e.DeltaY));
|
||||
// _logger.Verbose("Mouse move data: XY: {X},{Y} - delta XY: {deltaX},{deltaY} - device: {device} ", e.CursorX, e.CursorY, e.DeltaX, e.DeltaY, e.Device);
|
||||
}
|
||||
|
||||
@ -253,8 +290,13 @@ namespace Artemis.Core.Services
|
||||
#region Events
|
||||
|
||||
public event EventHandler<KeyboardKeyUpDownEventArgs>? KeyboardKeyUpDown;
|
||||
public event EventHandler<KeyboardEventArgs>? KeyboardKeyDown;
|
||||
public event EventHandler<KeyboardEventArgs>? KeyboardKeyUp;
|
||||
public event EventHandler<KeyboardKeyEventArgs>? KeyboardKeyDown;
|
||||
public event EventHandler<KeyboardKeyEventArgs>? KeyboardKeyUp;
|
||||
public event EventHandler<MouseButtonUpDownEventArgs>? MouseButtonUpDown;
|
||||
public event EventHandler<MouseButtonEventArgs>? MouseButtonDown;
|
||||
public event EventHandler<MouseButtonEventArgs>? MouseButtonUp;
|
||||
public event EventHandler<MouseScrollEventArgs>? MouseScroll;
|
||||
public event EventHandler<MouseMoveEventArgs>? MouseMove;
|
||||
public event EventHandler? DeviceIdentified;
|
||||
|
||||
protected virtual void OnKeyboardKeyUpDown(KeyboardKeyUpDownEventArgs e)
|
||||
@ -262,32 +304,46 @@ namespace Artemis.Core.Services
|
||||
KeyboardKeyUpDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyDown(KeyboardEventArgs e)
|
||||
protected virtual void OnKeyboardKeyDown(KeyboardKeyEventArgs e)
|
||||
{
|
||||
KeyboardKeyDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnKeyboardKeyUp(KeyboardEventArgs e)
|
||||
protected virtual void OnKeyboardKeyUp(KeyboardKeyEventArgs e)
|
||||
{
|
||||
KeyboardKeyUp?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonUpDown(MouseButtonUpDownEventArgs e)
|
||||
{
|
||||
MouseButtonUpDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonDown(MouseButtonEventArgs e)
|
||||
{
|
||||
MouseButtonDown?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseButtonUp(MouseButtonEventArgs e)
|
||||
{
|
||||
MouseButtonUp?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseScroll(MouseScrollEventArgs e)
|
||||
{
|
||||
MouseScroll?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnMouseMove(MouseMoveEventArgs e)
|
||||
{
|
||||
MouseMove?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnDeviceIdentified()
|
||||
{
|
||||
DeviceIdentified?.Invoke(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Dispose()
|
||||
{
|
||||
while (_inputProviders.Any())
|
||||
RemoveInputProvider(_inputProviders.First());
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@ -22,7 +22,7 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Identifies the provided <paramref name="device" /> by assigning the next received device identification to it
|
||||
/// </summary>
|
||||
/// <param name="device">The device to identify</param>
|
||||
/// <param name="device">The device to identify - Must be a keyboard or mouse</param>
|
||||
void IdentifyDevice(ArtemisDevice device);
|
||||
|
||||
/// <summary>
|
||||
@ -40,12 +40,37 @@ namespace Artemis.Core.Services
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was pressed
|
||||
/// </summary>
|
||||
event EventHandler<KeyboardEventArgs> KeyboardKeyDown;
|
||||
event EventHandler<KeyboardKeyEventArgs> KeyboardKeyDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a key on a keyboard was released
|
||||
/// </summary>
|
||||
event EventHandler<KeyboardEventArgs> KeyboardKeyUp;
|
||||
event EventHandler<KeyboardKeyEventArgs> KeyboardKeyUp;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was pressed or released
|
||||
/// </summary>
|
||||
event EventHandler<MouseButtonUpDownEventArgs> MouseButtonUpDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was pressed
|
||||
/// </summary>
|
||||
event EventHandler<MouseButtonEventArgs> MouseButtonDown;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a button on a mouse was released
|
||||
/// </summary>
|
||||
event EventHandler<MouseButtonEventArgs> MouseButtonUp;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a the scroll wheel of a mouse is turned
|
||||
/// </summary>
|
||||
event EventHandler<MouseScrollEventArgs> MouseScroll;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs whenever a a mouse is moved
|
||||
/// </summary>
|
||||
event EventHandler<MouseMoveEventArgs> MouseMove;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a device has been identified after calling <see cref="IdentifyDevice" />
|
||||
@ -61,9 +86,9 @@ namespace Artemis.Core.Services
|
||||
/// </summary>
|
||||
/// <param name="provider">The input provider to identify the device for</param>
|
||||
/// <param name="identifier">The value to use to identify the device</param>
|
||||
/// <param name="fallbackType">A device type to fall back to if no match is found</param>
|
||||
/// <param name="type">A device type to fall back to if no match is found</param>
|
||||
/// <returns>If found, the Artemis device matching the provider and identifier</returns>
|
||||
ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputFallbackDeviceType fallbackType);
|
||||
ArtemisDevice? GetDeviceByIdentifier(InputProvider provider, object identifier, InputDeviceType type);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the identifier cache
|
||||
|
||||
@ -6,7 +6,7 @@ namespace Artemis.Storage.Entities.Surface
|
||||
{
|
||||
public DeviceEntity()
|
||||
{
|
||||
InputIdentifier = new List<DeviceInputIdentifierEntity>();
|
||||
InputIdentifiers = new List<DeviceInputIdentifierEntity>();
|
||||
}
|
||||
|
||||
public string DeviceIdentifier { get; set; }
|
||||
@ -16,7 +16,7 @@ namespace Artemis.Storage.Entities.Surface
|
||||
public double Scale { get; set; }
|
||||
public int ZIndex { get; set; }
|
||||
|
||||
public List<DeviceInputIdentifierEntity> InputIdentifier { get; set; }
|
||||
public List<DeviceInputIdentifierEntity> InputIdentifiers { get; set; }
|
||||
}
|
||||
|
||||
public class DeviceInputIdentifierEntity
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Artemis.Storage.Entities.Surface;
|
||||
using Artemis.Storage.Repositories.Interfaces;
|
||||
using LiteDB;
|
||||
@ -32,7 +33,7 @@ namespace Artemis.Storage.Repositories
|
||||
|
||||
public List<SurfaceEntity> GetAll()
|
||||
{
|
||||
return _repository.Query<SurfaceEntity>().Include(s => s.DeviceEntities).ToList();
|
||||
return _repository.Query<SurfaceEntity>().Include(s => s.DeviceEntities.Select(de => de.InputIdentifiers)).ToList();
|
||||
}
|
||||
|
||||
public void Save(SurfaceEntity surfaceEntity)
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Windows.Documents;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.DataModelExpansions;
|
||||
using Artemis.UI.Shared.Services;
|
||||
|
||||
@ -22,11 +22,5 @@ namespace Artemis.UI.Shared.Screens.Dialogs
|
||||
if (Session != null && !Session.IsEnded)
|
||||
Session.Close(true);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
if (Session != null && !Session.IsEnded)
|
||||
Session.Close(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -91,15 +91,14 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
|
||||
Session.Close(true);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
public override void Cancel()
|
||||
{
|
||||
// Restore the saved state
|
||||
ColorGradient.Stops.Clear();
|
||||
ColorGradient.Stops.AddRange(_originalStops);
|
||||
ColorGradient.OnColorValuesUpdated();
|
||||
|
||||
if (Session != null && !Session.IsEnded)
|
||||
Session.Close(false);
|
||||
base.Cancel();
|
||||
}
|
||||
|
||||
private void UpdateColorStopViewModels(object? sender, PropertyChangedEventArgs e)
|
||||
|
||||
@ -49,6 +49,15 @@ namespace Artemis.UI.Shared.Services
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If not yet closed, closes the current session passing <see langword="false" />
|
||||
/// </summary>
|
||||
public virtual void Cancel()
|
||||
{
|
||||
if (Session != null && !Session.IsEnded)
|
||||
Session.Close(false);
|
||||
}
|
||||
|
||||
internal void OnDialogOpened(object sender, DialogOpenedEventArgs e)
|
||||
{
|
||||
Session = e.Session;
|
||||
|
||||
@ -81,11 +81,11 @@ namespace Artemis.UI.InputProviders
|
||||
|
||||
// Let the core know there is an identifier so it can store new identifications if applicable
|
||||
if (identifier != null)
|
||||
OnIdentifierReceived(identifier);
|
||||
OnIdentifierReceived(identifier, InputDeviceType.Keyboard);
|
||||
|
||||
ArtemisDevice device = null;
|
||||
if (identifier != null)
|
||||
device = _inputService.GetDeviceByIdentifier(this, identifier, InputFallbackDeviceType.Keyboard);
|
||||
device = _inputService.GetDeviceByIdentifier(this, identifier, InputDeviceType.Keyboard);
|
||||
|
||||
// Duplicate keys with different positions can be identified by the LeftKey flag (even though its set of the key that's physically on the right)
|
||||
if (keyboardData.Keyboard.Flags == RawKeyboardFlags.LeftKey || keyboardData.Keyboard.Flags == (RawKeyboardFlags.LeftKey | RawKeyboardFlags.Up))
|
||||
@ -105,7 +105,7 @@ namespace Artemis.UI.InputProviders
|
||||
keyboardData.Keyboard.Flags != (RawKeyboardFlags.Up | RawKeyboardFlags.LeftKey) &&
|
||||
keyboardData.Keyboard.Flags != (RawKeyboardFlags.Up | RawKeyboardFlags.RightKey);
|
||||
|
||||
OnKeyboardDataReceived(new InputProviderKeyboardEventArgs(device, key, isDown));
|
||||
OnKeyboardDataReceived(device, key, isDown);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -130,7 +130,7 @@ namespace Artemis.UI.InputProviders
|
||||
ArtemisDevice device = null;
|
||||
string identifier = data.Device?.DevicePath;
|
||||
if (identifier != null)
|
||||
device = _inputService.GetDeviceByIdentifier(this, identifier, InputFallbackDeviceType.Mouse);
|
||||
device = _inputService.GetDeviceByIdentifier(this, identifier, InputDeviceType.Mouse);
|
||||
|
||||
// Debug.WriteLine($"Buttons: {data.Mouse.Buttons}, Data: {data.Mouse.ButtonData}, Flags: {data.Mouse.Flags}, XY: {data.Mouse.LastX},{data.Mouse.LastY}");
|
||||
|
||||
@ -138,7 +138,7 @@ namespace Artemis.UI.InputProviders
|
||||
if (mouseData.Mouse.Buttons == RawMouseButtonFlags.None)
|
||||
{
|
||||
Win32Point cursorPosition = GetCursorPosition();
|
||||
OnMouseMoveDataReceived(new InputProviderMouseMoveEventArgs(device, cursorPosition.X, cursorPosition.Y, _mouseDeltaX, _mouseDeltaY));
|
||||
OnMouseMoveDataReceived(device, cursorPosition.X, cursorPosition.Y, _mouseDeltaX, _mouseDeltaY);
|
||||
_mouseDeltaX = 0;
|
||||
_mouseDeltaY = 0;
|
||||
_lastMouseUpdate = DateTime.Now;
|
||||
@ -147,15 +147,15 @@ namespace Artemis.UI.InputProviders
|
||||
|
||||
// Now we know its not movement, let the core know there is an identifier so it can store new identifications if applicable
|
||||
if (identifier != null)
|
||||
OnIdentifierReceived(identifier);
|
||||
OnIdentifierReceived(identifier, InputDeviceType.Mouse);
|
||||
|
||||
// Scrolling
|
||||
if (mouseData.Mouse.ButtonData != 0)
|
||||
{
|
||||
if (mouseData.Mouse.Buttons == RawMouseButtonFlags.MouseWheel)
|
||||
OnMouseScrollDataReceived(new InputProviderMouseScrollEventArgs(device, MouseScrollDirection.Vertical, mouseData.Mouse.ButtonData));
|
||||
OnMouseScrollDataReceived(device, MouseScrollDirection.Vertical, mouseData.Mouse.ButtonData);
|
||||
else if (mouseData.Mouse.Buttons == RawMouseButtonFlags.MouseHorizontalWheel)
|
||||
OnMouseScrollDataReceived(new InputProviderMouseScrollEventArgs(device, MouseScrollDirection.Horizontal, mouseData.Mouse.ButtonData));
|
||||
OnMouseScrollDataReceived(device, MouseScrollDirection.Horizontal, mouseData.Mouse.ButtonData);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -178,7 +178,7 @@ namespace Artemis.UI.InputProviders
|
||||
else if (DetermineMouseButton(mouseData, RawMouseButtonFlags.Button5Down, RawMouseButtonFlags.Button5Up, ref isDown))
|
||||
button = MouseButton.Button5;
|
||||
|
||||
OnMouseButtonDataReceived(new InputProviderMouseButtonEventArgs(device, button, isDown));
|
||||
OnMouseButtonDataReceived(device, button, isDown);
|
||||
}
|
||||
|
||||
private bool DetermineMouseButton(RawInputMouseData data, RawMouseButtonFlags downButton, RawMouseButtonFlags upButton, ref bool isDown)
|
||||
|
||||
@ -28,11 +28,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
|
||||
Session.Close(ProfileName);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProfileCreateViewModelValidator : AbstractValidator<ProfileCreateViewModel>
|
||||
|
||||
@ -30,10 +30,5 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
|
||||
Session.Close();
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -37,10 +37,5 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
_mainMessageQueue.Enqueue("Profile imported.");
|
||||
Session.Close(descriptor);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,11 +32,6 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
|
||||
|
||||
Session.Close(ElementName);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class ProfileElementRenameViewModelValidator : AbstractValidator<RenameViewModel>
|
||||
|
||||
@ -19,6 +19,7 @@ using Artemis.UI.Shared.Services;
|
||||
using GongSolutions.Wpf.DragDrop;
|
||||
using Stylet;
|
||||
using static Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree.TreeGroupViewModel.LayerPropertyGroupType;
|
||||
using MouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
||||
{
|
||||
|
||||
@ -38,11 +38,6 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Dialogs
|
||||
Segment.UpdateLength(TimelineSegmentDialogViewModelValidator.CreateTime(InputValue));
|
||||
Session.Close();
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public class TimelineSegmentDialogViewModelValidator : AbstractValidator<TimelineSegmentDialogViewModel>
|
||||
|
||||
@ -12,6 +12,7 @@ using Artemis.UI.Screens.ProfileEditor.Visualization.Tools;
|
||||
using Artemis.UI.Screens.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Stylet;
|
||||
using MouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Visualization
|
||||
{
|
||||
|
||||
@ -8,6 +8,7 @@ using Artemis.Core.LayerBrushes;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Properties;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using MouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
|
||||
{
|
||||
|
||||
@ -17,6 +17,7 @@ using Artemis.UI.Utilities;
|
||||
using MaterialDesignExtensions.Controls;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Stylet;
|
||||
using MouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs;
|
||||
|
||||
namespace Artemis.UI.Screens
|
||||
{
|
||||
|
||||
@ -54,8 +54,31 @@
|
||||
</CheckBox>
|
||||
<materialDesign:PopupBox Style="{StaticResource MaterialDesignToolPopupBox}" Padding="2 0 2 0">
|
||||
<StackPanel>
|
||||
<Button Content="Show device debugger" Command="{s:Action ShowDeviceDebugger}" />
|
||||
<Button Content="Open plugin directory" Command="{s:Action OpenPluginDirectory}" />
|
||||
<Button Command="{s:Action ShowDeviceDebugger}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="Tools" Margin="0 0 10 0 " VerticalAlignment="Center"/>
|
||||
<TextBlock VerticalAlignment="Center">Show device debugger</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Command="{s:Action OpenPluginDirectory}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="FolderOpen" Margin="0 0 10 0 " VerticalAlignment="Center"/>
|
||||
<TextBlock VerticalAlignment="Center">Open plugin directory</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Separator/>
|
||||
<Button Command="{s:Action DetectInput}" ToolTip="Teach Artemis which keypresses and/or button presses belong to this device">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="GestureDoubleTap" Margin="0 0 10 0 " VerticalAlignment="Center"/>
|
||||
<TextBlock VerticalAlignment="Center">Identify input</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Command="{s:Action ViewProperties}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<materialDesign:PackIcon Kind="Gear" Margin="0 0 10 0 " VerticalAlignment="Center"/>
|
||||
<TextBlock VerticalAlignment="Center">View surface properties</TextBlock>
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</materialDesign:PopupBox>
|
||||
</StackPanel>
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Ninject.Factories;
|
||||
using Artemis.UI.Screens.SurfaceEditor.Dialogs;
|
||||
using Artemis.UI.Screens.SurfaceEditor.Visualization;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Humanizer;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
||||
@ -12,18 +17,24 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
||||
public class DeviceSettingsViewModel : PropertyChangedBase
|
||||
{
|
||||
private readonly IDeviceDebugVmFactory _deviceDebugVmFactory;
|
||||
private readonly ISurfaceService _surfaceService;
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly IDialogService _dialogService;
|
||||
private readonly IWindowManager _windowManager;
|
||||
private bool _isDeviceEnabled;
|
||||
|
||||
public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService,
|
||||
IWindowManager windowManager, IDeviceDebugVmFactory deviceDebugVmFactory)
|
||||
public DeviceSettingsViewModel(ArtemisDevice device,
|
||||
IDeviceService deviceService,
|
||||
IDialogService dialogService,
|
||||
IWindowManager windowManager,
|
||||
IDeviceDebugVmFactory deviceDebugVmFactory,
|
||||
ISurfaceService surfaceService)
|
||||
{
|
||||
_deviceService = deviceService;
|
||||
_dialogService = dialogService;
|
||||
_windowManager = windowManager;
|
||||
_deviceDebugVmFactory = deviceDebugVmFactory;
|
||||
_surfaceService = surfaceService;
|
||||
Device = device;
|
||||
|
||||
Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize();
|
||||
@ -40,6 +51,9 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
||||
public string Name { get; }
|
||||
public string Manufacturer { get; }
|
||||
|
||||
public bool CanDetectInput => Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard ||
|
||||
Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse;
|
||||
|
||||
public bool IsDeviceEnabled
|
||||
{
|
||||
get => _isDeviceEnabled;
|
||||
@ -67,5 +81,25 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
|
||||
_dialogService.ShowExceptionDialog("Welp, we couldn't open the device's plugin folder for you", e);
|
||||
}
|
||||
}
|
||||
|
||||
public async Task DetectInput()
|
||||
{
|
||||
object madeChanges = await _dialogService.ShowDialog<SurfaceDeviceDetectInputViewModel>(
|
||||
new Dictionary<string, object> { { "device", Device } }
|
||||
);
|
||||
|
||||
if ((bool)madeChanges)
|
||||
_surfaceService.UpdateSurfaceConfiguration(_surfaceService.ActiveSurface, true);
|
||||
}
|
||||
|
||||
public async Task ViewProperties()
|
||||
{
|
||||
object madeChanges = await _dialogService.ShowDialog<SurfaceDeviceConfigViewModel>(
|
||||
new Dictionary<string, object> {{"device", Device}}
|
||||
);
|
||||
|
||||
if ((bool) madeChanges)
|
||||
_surfaceService.UpdateSurfaceConfiguration(_surfaceService.ActiveSurface, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@ using Humanizer;
|
||||
using MaterialDesignExtensions.Controls;
|
||||
using Stylet;
|
||||
using MouseButton = System.Windows.Input.MouseButton;
|
||||
using MouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs;
|
||||
|
||||
namespace Artemis.UI.Screens.Splash
|
||||
{
|
||||
|
||||
@ -27,10 +27,5 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
||||
|
||||
Session.Close(SurfaceName);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.SurfaceEditor.Visualization;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Stylet;
|
||||
|
||||
@ -15,20 +15,21 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
||||
private int _x;
|
||||
private int _y;
|
||||
|
||||
public SurfaceDeviceConfigViewModel(SurfaceDeviceViewModel surfaceDeviceViewModel, ICoreService coreService, IModelValidator<SurfaceDeviceConfigViewModel> validator)
|
||||
: base(validator)
|
||||
public SurfaceDeviceConfigViewModel(ArtemisDevice device, ICoreService coreService, IModelValidator<SurfaceDeviceConfigViewModel> validator) : base(validator)
|
||||
{
|
||||
_coreService = coreService;
|
||||
SurfaceDeviceViewModel = surfaceDeviceViewModel;
|
||||
Title = $"{SurfaceDeviceViewModel.Device.RgbDevice.DeviceInfo.DeviceName} - Properties";
|
||||
|
||||
X = (int) SurfaceDeviceViewModel.Device.X;
|
||||
Y = (int) SurfaceDeviceViewModel.Device.Y;
|
||||
Scale = SurfaceDeviceViewModel.Device.Scale;
|
||||
Rotation = (int) SurfaceDeviceViewModel.Device.Rotation;
|
||||
Device = device;
|
||||
Title = $"{Device.RgbDevice.DeviceInfo.DeviceName} - Properties";
|
||||
|
||||
X = (int) Device.X;
|
||||
Y = (int) Device.Y;
|
||||
Scale = Device.Scale;
|
||||
Rotation = (int) Device.Rotation;
|
||||
}
|
||||
|
||||
public SurfaceDeviceViewModel SurfaceDeviceViewModel { get; }
|
||||
public ArtemisDevice Device { get; }
|
||||
|
||||
|
||||
public string Title
|
||||
{
|
||||
@ -69,19 +70,14 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
||||
_coreService.ModuleRenderingDisabled = true;
|
||||
await Task.Delay(100);
|
||||
|
||||
SurfaceDeviceViewModel.Device.X = X;
|
||||
SurfaceDeviceViewModel.Device.Y = Y;
|
||||
SurfaceDeviceViewModel.Device.Scale = Scale;
|
||||
SurfaceDeviceViewModel.Device.Rotation = Rotation;
|
||||
Device.X = X;
|
||||
Device.Y = Y;
|
||||
Device.Scale = Scale;
|
||||
Device.Rotation = Rotation;
|
||||
|
||||
_coreService.ModuleRenderingDisabled = false;
|
||||
|
||||
Session.Close(true);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session.Close(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17,13 +17,39 @@
|
||||
that is currently showing a <Bold Foreground="Yellow">yellow</Bold> color.
|
||||
</TextBlock>
|
||||
|
||||
<materialDesign:PackIcon Kind="GestureDoubleTap" Width="300" Height="340" HorizontalAlignment="Center" />
|
||||
<materialDesign:PackIcon Kind="Keyboard"
|
||||
Width="300"
|
||||
Height="340"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding IsMouse, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}" />
|
||||
<materialDesign:PackIcon Kind="Mouse"
|
||||
Width="250"
|
||||
Height="340"
|
||||
HorizontalAlignment="Center"
|
||||
Visibility="{Binding IsMouse, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}" />
|
||||
|
||||
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
|
||||
This will teach Artemis to associate button/key presses with this specific device.
|
||||
</TextBlock>
|
||||
|
||||
<Button HorizontalAlignment="Right" Style="{StaticResource MaterialDesignFlatButton}" IsCancel="True" Margin="0 8 8 0" Command="{s:Action Cancel}">
|
||||
<Button HorizontalAlignment="Right"
|
||||
Style="{StaticResource MaterialDesignFlatButton}"
|
||||
IsCancel="True"
|
||||
Command="{s:Action Cancel}"
|
||||
Visibility="{Binding IsMouse, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
||||
<Button.CommandParameter>
|
||||
<system:Boolean xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
False
|
||||
</system:Boolean>
|
||||
</Button.CommandParameter>
|
||||
PRESS ESC TO CANCEL
|
||||
</Button>
|
||||
|
||||
<Button HorizontalAlignment="Right"
|
||||
Style="{StaticResource MaterialDesignFlatButton}"
|
||||
IsCancel="True"
|
||||
Command="{s:Action Cancel}"
|
||||
Visibility="{Binding IsMouse, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
|
||||
<Button.CommandParameter>
|
||||
<system:Boolean xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||
False
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.SurfaceEditor.Visualization;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using RGB.NET.Brushes;
|
||||
@ -13,36 +13,31 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
||||
public class SurfaceDeviceDetectInputViewModel : DialogViewModelBase
|
||||
{
|
||||
private readonly IInputService _inputService;
|
||||
private readonly ListLedGroup _ledGroup;
|
||||
private readonly ISnackbarMessageQueue _mainMessageQueue;
|
||||
private string _title;
|
||||
private ListLedGroup _ledGroup;
|
||||
|
||||
public SurfaceDeviceDetectInputViewModel(SurfaceDeviceViewModel surfaceDeviceViewModel, IInputService inputService, ISnackbarMessageQueue mainMessageQueue)
|
||||
public SurfaceDeviceDetectInputViewModel(ArtemisDevice device, IInputService inputService, ISnackbarMessageQueue mainMessageQueue)
|
||||
{
|
||||
SurfaceDeviceViewModel = surfaceDeviceViewModel;
|
||||
Title = $"{SurfaceDeviceViewModel.Device.RgbDevice.DeviceInfo.DeviceName} - Detect input";
|
||||
Device = device;
|
||||
Title = $"{Device.RgbDevice.DeviceInfo.DeviceName} - Detect input";
|
||||
IsMouse = Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse;
|
||||
|
||||
_inputService = inputService;
|
||||
_mainMessageQueue = mainMessageQueue;
|
||||
_inputService.IdentifyDevice(Device);
|
||||
_inputService.DeviceIdentified += InputServiceOnDeviceIdentified;
|
||||
|
||||
// Create a LED group way at the top
|
||||
_ledGroup = new ListLedGroup(SurfaceDeviceViewModel.Device.Leds.Select(l => l.RgbLed))
|
||||
_ledGroup = new ListLedGroup(Device.Leds.Select(l => l.RgbLed))
|
||||
{
|
||||
Brush = new SolidColorBrush(new Color(255, 255, 0)),
|
||||
ZIndex = 999
|
||||
};
|
||||
|
||||
|
||||
_inputService = inputService;
|
||||
_mainMessageQueue = mainMessageQueue;
|
||||
_inputService.IdentifyDevice(surfaceDeviceViewModel.Device);
|
||||
_inputService.DeviceIdentified += InputServiceOnDeviceIdentified;
|
||||
}
|
||||
|
||||
public SurfaceDeviceViewModel SurfaceDeviceViewModel { get; }
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
set => SetAndNotify(ref _title, value);
|
||||
}
|
||||
public ArtemisDevice Device { get; }
|
||||
public string Title { get; }
|
||||
public bool IsMouse { get; }
|
||||
|
||||
public override void OnDialogClosed(object sender, DialogClosingEventArgs e)
|
||||
{
|
||||
@ -51,15 +46,10 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
|
||||
_ledGroup.Detach();
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Session?.Close(false);
|
||||
}
|
||||
|
||||
private void InputServiceOnDeviceIdentified(object sender, EventArgs e)
|
||||
{
|
||||
Session?.Close(true);
|
||||
_mainMessageQueue.Enqueue("Device identified.");
|
||||
_mainMessageQueue.Enqueue($"{Device.RgbDevice.DeviceInfo.DeviceName} identified 😁");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -144,9 +144,11 @@
|
||||
</MenuItem.Icon>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<!-- Stylet can't disable it for us here, do it ourselves -->
|
||||
<MenuItem Header="Identify input"
|
||||
Command="{s:Action DetectInput}"
|
||||
CommandParameter="{Binding}"
|
||||
IsEnabled="{Binding CanDetectInput}"
|
||||
ToolTip="Teach Artemis which keypresses and/or button presses belong to this device">
|
||||
<MenuItem.Icon>
|
||||
<materialDesign:PackIcon Kind="GestureDoubleTap" />
|
||||
|
||||
@ -16,6 +16,7 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Stylet;
|
||||
using MouseButton = System.Windows.Input.MouseButton;
|
||||
using MouseButtonEventArgs = System.Windows.Input.MouseButtonEventArgs;
|
||||
|
||||
namespace Artemis.UI.Screens.SurfaceEditor
|
||||
{
|
||||
@ -286,10 +287,9 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
||||
|
||||
public async Task ViewProperties(SurfaceDeviceViewModel surfaceDeviceViewModel)
|
||||
{
|
||||
object madeChanges = await _dialogService.ShowDialog<SurfaceDeviceConfigViewModel>(new Dictionary<string, object>
|
||||
{
|
||||
{"surfaceDeviceViewModel", surfaceDeviceViewModel}
|
||||
});
|
||||
object madeChanges = await _dialogService.ShowDialog<SurfaceDeviceConfigViewModel>(
|
||||
new Dictionary<string, object> {{"device", surfaceDeviceViewModel.Device}}
|
||||
);
|
||||
|
||||
if ((bool) madeChanges)
|
||||
_surfaceService.UpdateSurfaceConfiguration(SelectedSurface, true);
|
||||
@ -297,12 +297,11 @@ namespace Artemis.UI.Screens.SurfaceEditor
|
||||
|
||||
public async Task DetectInput(SurfaceDeviceViewModel surfaceDeviceViewModel)
|
||||
{
|
||||
object madeChanges = await _dialogService.ShowDialog<SurfaceDeviceDetectInputViewModel>(new Dictionary<string, object>
|
||||
{
|
||||
{"surfaceDeviceViewModel", surfaceDeviceViewModel}
|
||||
});
|
||||
object madeChanges = await _dialogService.ShowDialog<SurfaceDeviceDetectInputViewModel>(
|
||||
new Dictionary<string, object> {{"device", surfaceDeviceViewModel.Device}}
|
||||
);
|
||||
|
||||
if ((bool)madeChanges)
|
||||
if ((bool) madeChanges)
|
||||
_surfaceService.UpdateSurfaceConfiguration(SelectedSurface, true);
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,9 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Artemis.Core;
|
||||
using RGB.NET.Core;
|
||||
using Stylet;
|
||||
using Point = System.Windows.Point;
|
||||
|
||||
namespace Artemis.UI.Screens.SurfaceEditor.Visualization
|
||||
{
|
||||
@ -45,6 +47,9 @@ namespace Artemis.UI.Screens.SurfaceEditor.Visualization
|
||||
? new Rect()
|
||||
: new Rect(Device.X, Device.Y, Device.RgbDevice.DeviceRectangle.Size.Width, Device.RgbDevice.DeviceRectangle.Size.Height);
|
||||
|
||||
public bool CanDetectInput => Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard ||
|
||||
Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Mouse;
|
||||
|
||||
public void StartMouseDrag(Point mouseStartPosition)
|
||||
{
|
||||
_dragOffsetX = Device.X - mouseStartPosition.X;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user