1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 01:42:02 +00:00

UI - Added device layout path to device debugger, this closes #494

This commit is contained in:
Robert 2020-11-30 20:27:56 +01:00
parent 286f475c7b
commit c5e3750172
6 changed files with 263 additions and 191 deletions

View File

@ -23,16 +23,17 @@ namespace Artemis.Core
RgbDevice = rgbDevice; RgbDevice = rgbDevice;
DeviceProvider = deviceProvider; DeviceProvider = deviceProvider;
Surface = surface; Surface = surface;
Rotation = 0;
Scale = 1;
ZIndex = 1;
DeviceEntity = new DeviceEntity(); DeviceEntity = new DeviceEntity();
deviceProvider.DeviceLayoutPaths.TryGetValue(rgbDevice, out string? layoutPath);
LayoutPath = layoutPath;
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>(); InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
_leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly(); _leds = rgbDevice.Select(l => new ArtemisLed(l, this)).ToList().AsReadOnly();
Rotation = 0;
Scale = 1;
ZIndex = 1;
ApplyToEntity(); ApplyToEntity();
CalculateRenderProperties(); CalculateRenderProperties();
} }
@ -44,6 +45,9 @@ namespace Artemis.Core
Surface = surface; Surface = surface;
DeviceEntity = deviceEntity; DeviceEntity = deviceEntity;
deviceProvider.DeviceLayoutPaths.TryGetValue(rgbDevice, out string? layoutPath);
LayoutPath = layoutPath;
InputIdentifiers = new List<ArtemisDeviceInputIdentifier>(); InputIdentifiers = new List<ArtemisDeviceInputIdentifier>();
foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers) foreach (DeviceInputIdentifierEntity identifierEntity in DeviceEntity.InputIdentifiers)
InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier)); InputIdentifiers.Add(new ArtemisDeviceInputIdentifier(identifierEntity.InputProvider, identifierEntity.Identifier));
@ -94,7 +98,7 @@ namespace Artemis.Core
} }
/// <summary> /// <summary>
/// Gets a list of input identifiers associated with this device /// Gets a list of input identifiers associated with this device
/// </summary> /// </summary>
public List<ArtemisDeviceInputIdentifier> InputIdentifiers { get; } public List<ArtemisDeviceInputIdentifier> InputIdentifiers { get; }
@ -163,6 +167,11 @@ namespace Artemis.Core
} }
} }
/// <summary>
/// Gets the path to where the layout of the device was (attempted to be) loaded from
/// </summary>
public string? LayoutPath { get; internal set; }
internal DeviceEntity DeviceEntity { get; } internal DeviceEntity DeviceEntity { get; }
/// <inheritdoc /> /// <inheritdoc />
@ -191,13 +200,11 @@ namespace Artemis.Core
DeviceEntity.InputIdentifiers.Clear(); DeviceEntity.InputIdentifiers.Clear();
foreach (ArtemisDeviceInputIdentifier identifier in InputIdentifiers) foreach (ArtemisDeviceInputIdentifier identifier in InputIdentifiers)
{
DeviceEntity.InputIdentifiers.Add(new DeviceInputIdentifierEntity DeviceEntity.InputIdentifiers.Add(new DeviceInputIdentifierEntity
{ {
InputProvider = identifier.InputProvider, InputProvider = identifier.InputProvider,
Identifier = identifier.Identifier Identifier = identifier.Identifier
}); });
}
} }
internal void ApplyToRgbDevice() internal void ApplyToRgbDevice()

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.IO; using System.IO;
using Ninject; using Ninject;
using RGB.NET.Core; using RGB.NET.Core;
@ -33,6 +34,8 @@ namespace Artemis.Core.DeviceProviders
[Inject] [Inject]
public ILogger? Logger { get; set; } public ILogger? Logger { get; set; }
internal Dictionary<IRGBDevice, string> DeviceLayoutPaths { get; set; } = new Dictionary<IRGBDevice, string>();
/// <inheritdoc /> /// <inheritdoc />
public override void Disable() public override void Disable()
{ {
@ -54,12 +57,16 @@ namespace Artemis.Core.DeviceProviders
else if (e.RelativePath != null) else if (e.RelativePath != null)
e.FinalPath = Path.Combine(Plugin.Directory.FullName, e.RelativePath); e.FinalPath = Path.Combine(Plugin.Directory.FullName, e.RelativePath);
IRGBDeviceInfo deviceInfo = ((IRGBDevice) sender).DeviceInfo; IRGBDevice device = (IRGBDevice) sender;
IRGBDeviceInfo deviceInfo = device.DeviceInfo;
if (e.FileName != null && !File.Exists(e.FinalPath)) if (e.FileName != null && !File.Exists(e.FinalPath))
{ {
Logger?.Information("Couldn't find a layout for device {deviceName}, model {deviceModel} at {filePath}", Logger?.Information("Couldn't find a layout for device {deviceName}, model {deviceModel} at {filePath}",
deviceInfo.DeviceName, deviceInfo.Model, e.FinalPath); deviceInfo.DeviceName, deviceInfo.Model, e.FinalPath);
} }
if (e.FileName != null)
DeviceLayoutPaths[device] = e.FinalPath;
} }
} }
} }

View File

@ -297,7 +297,8 @@ namespace Artemis.Core.Services
throw new ArtemisPluginException( throw new ArtemisPluginException(
plugin, plugin,
"Failed to initialize the plugin assembly", "Failed to initialize the plugin assembly",
new AggregateException(e.LoaderExceptions.Where(le => le != null).ToArray()) // ReSharper disable once RedundantEnumerableCastCall - Casting from nullable to non-nullable here
new AggregateException(e.LoaderExceptions.Where(le => le != null).Cast<Exception>().ToArray())
); );
} }

View File

@ -6,6 +6,7 @@ using Artemis.Core;
using Artemis.Core.Services; using Artemis.Core.Services;
using Linearstar.Windows.RawInput; using Linearstar.Windows.RawInput;
using Linearstar.Windows.RawInput.Native; using Linearstar.Windows.RawInput.Native;
using Serilog;
using MouseButton = Artemis.Core.Services.MouseButton; using MouseButton = Artemis.Core.Services.MouseButton;
namespace Artemis.UI.InputProviders namespace Artemis.UI.InputProviders
@ -14,12 +15,14 @@ namespace Artemis.UI.InputProviders
{ {
private const int WM_INPUT = 0x00FF; private const int WM_INPUT = 0x00FF;
private readonly ILogger _logger;
private readonly IInputService _inputService; private readonly IInputService _inputService;
private DateTime _lastMouseUpdate; private DateTime _lastMouseUpdate;
private SpongeWindow _sponge; private SpongeWindow _sponge;
public NativeWindowInputProvider(IInputService inputService) public NativeWindowInputProvider(ILogger logger, IInputService inputService)
{ {
_logger = logger;
_inputService = inputService; _inputService = inputService;
_sponge = new SpongeWindow(); _sponge = new SpongeWindow();
@ -85,7 +88,16 @@ namespace Artemis.UI.InputProviders
ArtemisDevice device = null; ArtemisDevice device = null;
if (identifier != null) if (identifier != null)
device = _inputService.GetDeviceByIdentifier(this, identifier, InputDeviceType.Keyboard); {
try
{
device = _inputService.GetDeviceByIdentifier(this, identifier, InputDeviceType.Keyboard);
}
catch (Exception e)
{
_logger.Warning(e, "Failed to retrieve input device by its identifier");
}
}
// 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) // 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)) if (keyboardData.Keyboard.Flags == RawKeyboardFlags.LeftKey || keyboardData.Keyboard.Flags == (RawKeyboardFlags.LeftKey | RawKeyboardFlags.Up))
@ -130,7 +142,16 @@ namespace Artemis.UI.InputProviders
ArtemisDevice device = null; ArtemisDevice device = null;
string identifier = data.Device?.DevicePath; string identifier = data.Device?.DevicePath;
if (identifier != null) if (identifier != null)
device = _inputService.GetDeviceByIdentifier(this, identifier, InputDeviceType.Mouse); {
try
{
device = _inputService.GetDeviceByIdentifier(this, identifier, InputDeviceType.Keyboard);
}
catch (Exception e)
{
_logger.Warning(e, "Failed to retrieve input device by its identifier");
}
}
// Debug.WriteLine($"Buttons: {data.Mouse.Buttons}, Data: {data.Mouse.ButtonData}, Flags: {data.Mouse.Flags}, XY: {data.Mouse.LastX},{data.Mouse.LastY}"); // Debug.WriteLine($"Buttons: {data.Mouse.Buttons}, Data: {data.Mouse.ButtonData}, Flags: {data.Mouse.Flags}, XY: {data.Mouse.LastX},{data.Mouse.LastY}");

View File

@ -47,212 +47,244 @@
</StackPanel> </StackPanel>
</mde:AppBar> </mde:AppBar>
<Grid Margin="10, 10, 10, 10"> <ScrollViewer>
<Grid.RowDefinitions> <Grid Margin="15">
<RowDefinition Height="Auto" /> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> <RowDefinition Height="*" />
<TextBlock TextWrapping="Wrap"> </Grid.RowDefinitions>
<TextBlock TextWrapping="Wrap" Margin="0 0 00 10">
In this window you can view detailed information of the device. In this window you can view detailed information of the device.
Please note that having this window open can have a performance impact on your system. Please note that having this window open can have a performance impact on your system.
</TextBlock> </TextBlock>
<shared:DeviceVisualizer Grid.Row="1" Device="{Binding Device}" HighlightedLeds="{Binding SelectedLeds}" HorizontalAlignment="Center" MaxHeight="500" ShowColors="True" /> <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" Grid.Row="1" Padding="15">
<shared:DeviceVisualizer Device="{Binding Device}"
HighlightedLeds="{Binding SelectedLeds}"
HorizontalAlignment="Center"
MaxHeight="400"
ShowColors="True"/>
</materialDesign:Card>
<Expander Grid.Row="2" Width="800" VerticalAlignment="Center" Header="Device properties"> <Expander Grid.Row="2" VerticalAlignment="Center" Header="Device properties" Margin="0 15">
<StackPanel Orientation="Horizontal"> <Grid>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" Margin="0,0,5,0" Width="395"> <Grid.ColumnDefinitions>
<StackPanel Margin="15" HorizontalAlignment="Stretch"> <ColumnDefinition />
<Grid> <ColumnDefinition />
<Grid.RowDefinitions> </Grid.ColumnDefinitions>
<RowDefinition /> <materialDesign:Card Grid.Column="0" materialDesign:ShadowAssist.ShadowDepth="Depth1" Margin="0,0,5,0">
<RowDefinition /> <StackPanel Margin="15" HorizontalAlignment="Stretch">
</Grid.RowDefinitions> <Grid>
<Grid.ColumnDefinitions> <Grid.RowDefinitions>
<ColumnDefinition Width="*" /> <RowDefinition />
</Grid.ColumnDefinitions> <RowDefinition />
<StackPanel Grid.Column="0"> </Grid.RowDefinitions>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Device name</TextBlock> <Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Device name</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.DeviceInfo.DeviceName}" /> Text="{Binding Device.RgbDevice.DeviceInfo.DeviceName}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Manufacturer</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Manufacturer</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.DeviceInfo.Manufacturer}" /> Text="{Binding Device.RgbDevice.DeviceInfo.Manufacturer}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Lighting support</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Lighting support</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.DeviceInfo.Lighting}" /> Text="{Binding Device.RgbDevice.DeviceInfo.Lighting}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Device type</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Device type</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.DeviceInfo.DeviceType}" /> Text="{Binding Device.RgbDevice.DeviceInfo.DeviceType}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Device image</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Device image</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBox Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap"
TextWrapping="Wrap" Text="{Binding Device.RgbDevice.DeviceInfo.Image, Mode=OneWay}"
Text="{Binding Device.RgbDevice.DeviceInfo.Image}" /> IsReadOnly="True" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</StackPanel> </StackPanel>
</materialDesign:Card> </materialDesign:Card>
<materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" Margin="0,0,5,0" Width="395"> <materialDesign:Card Grid.Column="1" materialDesign:ShadowAssist.ShadowDepth="Depth1" Margin="5,0,0,0" >
<StackPanel Margin="15" HorizontalAlignment="Stretch"> <StackPanel Margin="15" HorizontalAlignment="Stretch">
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Size (1px = 1mm)</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Size (1px = 1mm)</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.Size}" /> Text="{Binding Device.RgbDevice.Size}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Location (1px = 1mm)</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Location (1px = 1mm)</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.Location}" /> Text="{Binding Device.RgbDevice.Location}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Rotation (degrees)</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Rotation (degrees)</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.Rotation.Degrees}" /> Text="{Binding Device.RgbDevice.Rotation.Degrees}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackPanel Grid.Column="0"> <StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Syncback supported</TextBlock> <TextBlock Style="{StaticResource MaterialDesignTextBlock}">Syncback supported</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" <TextBlock Style="{StaticResource MaterialDesignTextBlock}"
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap" TextWrapping="Wrap"
Text="{Binding Device.RgbDevice.DeviceInfo.SupportsSyncBack}" /> Text="{Binding Device.RgbDevice.DeviceInfo.SupportsSyncBack}" />
</StackPanel> </StackPanel>
</Grid> </Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" /> <Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
</StackPanel>
</materialDesign:Card> <Grid>
</StackPanel> <Grid.RowDefinitions>
</Expander> <RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Layout file path</TextBlock>
<TextBox Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
TextWrapping="Wrap"
Text="{Binding Device.LayoutPath, Mode=OneWay}"
IsReadOnly="True" />
</StackPanel>
</Grid>
</StackPanel>
</materialDesign:Card>
</Grid>
</Expander>
<materialDesign:Card Grid.Row="3" materialDesign:ShadowAssist.ShadowDepth="Depth1" Padding="15" MaxHeight="413">
<DataGrid ItemsSource="{Binding Device.Leds}"
d:DataContext="{d:DesignInstance Type=core:ArtemisLed}"
CanUserSortColumns="True"
IsReadOnly="True"
CanUserAddRows="False"
AutoGenerateColumns="False"
materialDesign:DataGridAssist.CellPadding="13 8 8 8"
materialDesign:DataGridAssist.ColumnHeaderPadding="8"
SelectedItem="{Binding SelectedLed}"
CanUserResizeRows="False"
>
<DataGrid.Columns>
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Id}" Header="LED ID" Width="Auto" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Color}" Header="Color (ARGB)" Width="Auto" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Image}" Header="Image path" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Shape}" Header="Shape" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Size}" Header="Size" Width="Auto" />
</DataGrid.Columns>
</DataGrid>
</materialDesign:Card>
</Grid>
</ScrollViewer>
<DataGrid Grid.Row="3"
Margin="0 8 0 0"
ItemsSource="{Binding Device.Leds}"
d:DataContext="{d:DesignInstance Type=core:ArtemisLed}"
CanUserSortColumns="True"
IsReadOnly="True"
CanUserAddRows="False"
AutoGenerateColumns="False"
materialDesign:DataGridAssist.CellPadding="13 8 8 8"
materialDesign:DataGridAssist.ColumnHeaderPadding="8"
SelectedItem="{Binding SelectedLed}"
CanUserResizeRows="False">
<DataGrid.Columns>
<materialDesign:DataGridTextColumn Binding="{Binding LedIndex}" Header="#" Width="Auto" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Id}" Header="LED ID" Width="Auto" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Color}" Header="Color (ARGB)" Width="Auto" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Image}" Header="Image path" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Shape}" Header="Shape" />
<materialDesign:DataGridTextColumn Binding="{Binding RgbLed.Size}" Header="Size" Width="Auto" />
</DataGrid.Columns>
</DataGrid>
</Grid>
</DockPanel> </DockPanel>
</mde:MaterialWindow> </mde:MaterialWindow>

View File

@ -8,11 +8,13 @@ using Artemis.UI.Ninject;
using Artemis.UI.PropertyInput; using Artemis.UI.PropertyInput;
using Artemis.UI.Services.Interfaces; using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using Serilog;
namespace Artemis.UI.Services namespace Artemis.UI.Services
{ {
public class RegistrationService : IRegistrationService public class RegistrationService : IRegistrationService
{ {
private readonly ILogger _logger;
private readonly IDataModelUIService _dataModelUIService; private readonly IDataModelUIService _dataModelUIService;
private readonly IProfileEditorService _profileEditorService; private readonly IProfileEditorService _profileEditorService;
private readonly IPluginManagementService _pluginManagementService; private readonly IPluginManagementService _pluginManagementService;
@ -22,12 +24,14 @@ namespace Artemis.UI.Services
private bool _registeredBuiltInDataModelInputs; private bool _registeredBuiltInDataModelInputs;
private bool _registeredBuiltInPropertyEditors; private bool _registeredBuiltInPropertyEditors;
public RegistrationService(IDataModelUIService dataModelUIService, public RegistrationService(ILogger logger,
IDataModelUIService dataModelUIService,
IProfileEditorService profileEditorService, IProfileEditorService profileEditorService,
IPluginManagementService pluginManagementService, IPluginManagementService pluginManagementService,
ISurfaceService surfaceService, ISurfaceService surfaceService,
IInputService inputService) IInputService inputService)
{ {
_logger = logger;
_dataModelUIService = dataModelUIService; _dataModelUIService = dataModelUIService;
_profileEditorService = profileEditorService; _profileEditorService = profileEditorService;
_pluginManagementService = pluginManagementService; _pluginManagementService = pluginManagementService;
@ -85,7 +89,7 @@ namespace Artemis.UI.Services
public void RegisterInputProvider() public void RegisterInputProvider()
{ {
_inputService.AddInputProvider(new NativeWindowInputProvider(_inputService)); _inputService.AddInputProvider(new NativeWindowInputProvider(_logger, _inputService));
} }
private void PluginServiceOnPluginEnabling(object sender, PluginEventArgs e) private void PluginServiceOnPluginEnabling(object sender, PluginEventArgs e)