mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-01-01 10:13:30 +00:00
Device properties - UI polish (the shiny kind)
Conditions - Open existing condition path on click
This commit is contained in:
parent
d5d1211649
commit
98b9770250
@ -239,6 +239,7 @@ namespace Artemis.Core.Services
|
|||||||
public void ApplyDeviceLayout(ArtemisDevice device, ArtemisLayout layout, bool createMissingLeds, bool removeExessiveLeds)
|
public void ApplyDeviceLayout(ArtemisDevice device, ArtemisLayout layout, bool createMissingLeds, bool removeExessiveLeds)
|
||||||
{
|
{
|
||||||
device.ApplyLayout(layout, createMissingLeds, removeExessiveLeds);
|
device.ApplyLayout(layout, createMissingLeds, removeExessiveLeds);
|
||||||
|
UpdateLedGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArtemisDevice? GetDevice(IRGBDevice rgbDevice)
|
public ArtemisDevice? GetDevice(IRGBDevice rgbDevice)
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace Artemis.UI.Shared
|
|||||||
byte g = Led.RgbLed.Color.GetG();
|
byte g = Led.RgbLed.Color.GetG();
|
||||||
byte b = Led.RgbLed.Color.GetB();
|
byte b = Led.RgbLed.Color.GetB();
|
||||||
|
|
||||||
_renderColor.A = (byte)(isDimmed ? 100 : 255);
|
_renderColor.A = (byte) (isDimmed ? 100 : 255);
|
||||||
_renderColor.A = isDimmed ? Dimmed : NonDimmed;
|
_renderColor.A = isDimmed ? Dimmed : NonDimmed;
|
||||||
_renderColor.R = r;
|
_renderColor.R = r;
|
||||||
_renderColor.G = g;
|
_renderColor.G = g;
|
||||||
@ -135,6 +135,8 @@ namespace Artemis.UI.Shared
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
double width = Led.RgbLed.Size.Width - deflateAmount;
|
||||||
|
double height = Led.RgbLed.Size.Height - deflateAmount;
|
||||||
// DisplayGeometry = Geometry.Parse(Led.RgbLed.ShapeData);
|
// DisplayGeometry = Geometry.Parse(Led.RgbLed.ShapeData);
|
||||||
DisplayGeometry = Geometry.Combine(
|
DisplayGeometry = Geometry.Combine(
|
||||||
Geometry.Empty,
|
Geometry.Empty,
|
||||||
@ -144,11 +146,27 @@ namespace Artemis.UI.Shared
|
|||||||
{
|
{
|
||||||
Children = new TransformCollection
|
Children = new TransformCollection
|
||||||
{
|
{
|
||||||
new ScaleTransform(Led.RgbLed.Size.Width - deflateAmount, Led.RgbLed.Size.Height - deflateAmount),
|
new ScaleTransform(width, height),
|
||||||
new TranslateTransform(deflateAmount / 2, deflateAmount / 2)
|
new TranslateTransform(deflateAmount / 2, deflateAmount / 2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (DisplayGeometry.Bounds.Width > width)
|
||||||
|
{
|
||||||
|
DisplayGeometry = Geometry.Combine(Geometry.Empty, DisplayGeometry, GeometryCombineMode.Union, new TransformGroup
|
||||||
|
{
|
||||||
|
Children = new TransformCollection {new ScaleTransform(width / DisplayGeometry.Bounds.Width, 1)}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DisplayGeometry.Bounds.Height > height)
|
||||||
|
{
|
||||||
|
DisplayGeometry = Geometry.Combine(Geometry.Empty, DisplayGeometry, GeometryCombineMode.Union, new TransformGroup
|
||||||
|
{
|
||||||
|
Children = new TransformCollection {new ScaleTransform(1, height / DisplayGeometry.Bounds.Height)}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
@ -139,7 +140,11 @@ namespace Artemis.UI.Shared.Input
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!SetAndNotify(ref _isDataModelViewModelOpen, value)) return;
|
if (!SetAndNotify(ref _isDataModelViewModelOpen, value)) return;
|
||||||
if (value) UpdateDataModelVisualization();
|
if (value)
|
||||||
|
{
|
||||||
|
UpdateDataModelVisualization();
|
||||||
|
OpenSelectedValue(DataModelViewModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,6 +308,21 @@ namespace Artemis.UI.Shared.Input
|
|||||||
extraDataModelViewModel.Update(_dataModelUIService, new DataModelUpdateConfiguration(LoadEventChildren));
|
extraDataModelViewModel.Update(_dataModelUIService, new DataModelUpdateConfiguration(LoadEventChildren));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OpenSelectedValue(DataModelVisualizationViewModel dataModelPropertiesViewModel)
|
||||||
|
{
|
||||||
|
if (DataModelPath == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (dataModelPropertiesViewModel.Children.Any(c => c.DataModelPath != null && DataModelPath.Path.StartsWith(c.DataModelPath.Path)))
|
||||||
|
{
|
||||||
|
dataModelPropertiesViewModel.IsVisualizationExpanded = true;
|
||||||
|
foreach (DataModelVisualizationViewModel dataModelVisualizationViewModel in dataModelPropertiesViewModel.Children)
|
||||||
|
{
|
||||||
|
OpenSelectedValue(dataModelVisualizationViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Events
|
#region Events
|
||||||
|
|||||||
@ -24,110 +24,124 @@
|
|||||||
<mde:MaterialWindow.InputBindings>
|
<mde:MaterialWindow.InputBindings>
|
||||||
<KeyBinding Command="{s:Action ClearSelection}" Key="Escape" />
|
<KeyBinding Command="{s:Action ClearSelection}" Key="Escape" />
|
||||||
</mde:MaterialWindow.InputBindings>
|
</mde:MaterialWindow.InputBindings>
|
||||||
<DockPanel>
|
|
||||||
<mde:AppBar Type="Dense"
|
|
||||||
Title="{Binding Device.RgbDevice.DeviceInfo.Model}"
|
|
||||||
ShowShadow="True"
|
|
||||||
DockPanel.Dock="Top"
|
|
||||||
Margin="-18 0 0 0">
|
|
||||||
<mde:AppBar.AppIcon>
|
|
||||||
<materialDesign:PackIcon Kind="HammerWrench" Width="20" Height="28" />
|
|
||||||
</mde:AppBar.AppIcon>
|
|
||||||
|
|
||||||
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
<materialDesign:DialogHost IsTabStop="False"
|
||||||
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Identify" Command="{s:Action IdentifyDevice}">
|
Focusable="False"
|
||||||
<materialDesign:PackIcon Kind="AlarmLight" />
|
Identifier="DeviceDialog"
|
||||||
</Button>
|
DialogTheme="Inherit"
|
||||||
<materialDesign:PopupBox PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
|
SnackbarMessageQueue="{Binding DeviceMessageQueue}">
|
||||||
<StackPanel>
|
<DockPanel>
|
||||||
<Button Command="{s:Action OpenPluginDirectory}">
|
<mde:AppBar Type="Dense"
|
||||||
<StackPanel Orientation="Horizontal">
|
Title="{Binding Device.RgbDevice.DeviceInfo.Model}"
|
||||||
<materialDesign:PackIcon Kind="Plugin" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
ShowShadow="True"
|
||||||
<TextBlock VerticalAlignment="Center">Open plugin directory</TextBlock>
|
DockPanel.Dock="Top"
|
||||||
</StackPanel>
|
Margin="-18 0 0 0">
|
||||||
</Button>
|
<mde:AppBar.AppIcon>
|
||||||
<Button Command="{s:Action OpenImageDirectory}">
|
<materialDesign:PackIcon Kind="HammerWrench" Width="20" Height="28" />
|
||||||
<StackPanel Orientation="Horizontal">
|
</mde:AppBar.AppIcon>
|
||||||
<materialDesign:PackIcon Kind="Image" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
|
||||||
<TextBlock VerticalAlignment="Center">Open layout image directory</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</Button>
|
|
||||||
<Separator />
|
|
||||||
<Button Command="{s:Action ReloadLayout}">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<materialDesign:PackIcon Kind="Reload" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
|
||||||
<TextBlock VerticalAlignment="Center">Reload layout</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</Button>
|
|
||||||
<Button Command="{s:Action ExportLayout}">
|
|
||||||
<StackPanel Orientation="Horizontal">
|
|
||||||
<materialDesign:PackIcon Kind="Xml" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
|
||||||
<TextBlock VerticalAlignment="Center">Export layout</TextBlock>
|
|
||||||
</StackPanel>
|
|
||||||
</Button>
|
|
||||||
</StackPanel>
|
|
||||||
</materialDesign:PopupBox>
|
|
||||||
</StackPanel>
|
|
||||||
</mde:AppBar>
|
|
||||||
|
|
||||||
<Grid>
|
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
|
||||||
<Grid.ColumnDefinitions>
|
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Identify" Command="{s:Action IdentifyDevice}">
|
||||||
<ColumnDefinition Width="*" />
|
<materialDesign:PackIcon Kind="AlarmLight" />
|
||||||
<ColumnDefinition Width="0" />
|
</Button>
|
||||||
<ColumnDefinition Width="*" />
|
<materialDesign:PopupBox PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
|
||||||
</Grid.ColumnDefinitions>
|
<StackPanel>
|
||||||
|
<Button Command="{s:Action OpenPluginDirectory}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="Plugin" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
|
<TextBlock VerticalAlignment="Center">Open plugin directory</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Command="{s:Action OpenImageDirectory}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="Image" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
|
<TextBlock VerticalAlignment="Center">Open layout image directory</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Separator />
|
||||||
|
<Button Command="{s:Action ReloadLayout}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="Reload" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
|
<TextBlock VerticalAlignment="Center">Reload layout</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Command="{s:Action ExportLayout}">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<materialDesign:PackIcon Kind="Xml" Margin="0 0 10 0 " VerticalAlignment="Center" />
|
||||||
|
<TextBlock VerticalAlignment="Center">Export layout</TextBlock>
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</materialDesign:PopupBox>
|
||||||
|
</StackPanel>
|
||||||
|
</mde:AppBar>
|
||||||
|
|
||||||
<Grid Name="DeviceDisplayGrid" Grid.Column="0">
|
<Grid>
|
||||||
<Grid.Background>
|
<Grid.ColumnDefinitions>
|
||||||
<VisualBrush TileMode="Tile" Stretch="Uniform" Viewport="0 0 25 25" ViewportUnits="Absolute">
|
<ColumnDefinition Width="*" />
|
||||||
<VisualBrush.Visual>
|
<ColumnDefinition Width="0" />
|
||||||
<Grid Width="20" Height="20">
|
<ColumnDefinition Width="*" />
|
||||||
<Grid.RowDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition />
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Rectangle Grid.Row="0" Grid.Column="0" Fill="Black" Opacity="0.15" />
|
|
||||||
<Rectangle Grid.Row="0" Grid.Column="1" />
|
|
||||||
<Rectangle Grid.Row="1" Grid.Column="0" />
|
|
||||||
<Rectangle Grid.Row="1" Grid.Column="1" Fill="Black" Opacity="0.15" />
|
|
||||||
</Grid>
|
|
||||||
</VisualBrush.Visual>
|
|
||||||
</VisualBrush>
|
|
||||||
</Grid.Background>
|
|
||||||
|
|
||||||
<shared:DeviceVisualizer Device="{Binding Device}"
|
<Grid Name="DeviceDisplayGrid" Grid.Column="0">
|
||||||
HighlightedLeds="{Binding SelectedLeds}"
|
<Grid.Background>
|
||||||
HorizontalAlignment="Center"
|
<VisualBrush TileMode="Tile" Stretch="Uniform" Viewport="0 0 25 25" ViewportUnits="Absolute">
|
||||||
VerticalAlignment="Center"
|
<VisualBrush.Visual>
|
||||||
ShowColors="True"
|
<Grid Width="20" Height="20">
|
||||||
Margin="0 0 100 0" />
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Rectangle Grid.Row="0" Grid.Column="0" Fill="Black" Opacity="0.15" />
|
||||||
|
<Rectangle Grid.Row="0" Grid.Column="1" />
|
||||||
|
<Rectangle Grid.Row="1" Grid.Column="0" />
|
||||||
|
<Rectangle Grid.Row="1" Grid.Column="1" Fill="Black" Opacity="0.15" />
|
||||||
|
</Grid>
|
||||||
|
</VisualBrush.Visual>
|
||||||
|
</VisualBrush>
|
||||||
|
</Grid.Background>
|
||||||
|
|
||||||
|
<shared:DeviceVisualizer Device="{Binding Device}"
|
||||||
|
HighlightedLeds="{Binding SelectedLeds}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
ShowColors="True"
|
||||||
|
Margin="0 0 100 0" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<GridSplitter Grid.Column="1" Width="15" Margin="-15 0 0 0" Background="Transparent" HorizontalAlignment="Stretch" Panel.ZIndex="3" />
|
||||||
|
|
||||||
|
<materialDesign:Card Grid.Column="2"
|
||||||
|
materialDesign:ShadowAssist.ShadowDepth="Depth3"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}">
|
||||||
|
<Grid>
|
||||||
|
<TabControl
|
||||||
|
Style="{StaticResource MaterialDesignTabControl}"
|
||||||
|
ItemsSource="{Binding Items}"
|
||||||
|
SelectedItem="{Binding ActiveItem}"
|
||||||
|
DisplayMemberPath="DisplayName">
|
||||||
|
<TabControl.ContentTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ContentControl s:View.Model="{Binding IsAsync=True}"
|
||||||
|
VerticalContentAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
IsTabStop="False"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</TabControl.ContentTemplate>
|
||||||
|
</TabControl>
|
||||||
|
<materialDesign:Snackbar x:Name="DeviceSnackbar"
|
||||||
|
MessageQueue="{Binding DeviceMessageQueue}"
|
||||||
|
materialDesign:SnackbarMessage.InlineActionButtonMaxHeight="80"
|
||||||
|
materialDesign:SnackbarMessage.ContentMaxHeight="200" />
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</materialDesign:Card>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</DockPanel>
|
||||||
<GridSplitter Grid.Column="1" Width="15" Margin="-15 0 0 0" Background="Transparent" HorizontalAlignment="Stretch" Panel.ZIndex="3" />
|
</materialDesign:DialogHost>
|
||||||
|
|
||||||
<materialDesign:Card Grid.Column="2"
|
|
||||||
materialDesign:ShadowAssist.ShadowDepth="Depth3"
|
|
||||||
Background="{DynamicResource MaterialDesignPaper}">
|
|
||||||
<TabControl
|
|
||||||
Style="{StaticResource MaterialDesignTabControl}"
|
|
||||||
ItemsSource="{Binding Items}"
|
|
||||||
SelectedItem="{Binding ActiveItem}"
|
|
||||||
DisplayMemberPath="DisplayName">
|
|
||||||
<TabControl.ContentTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<ContentControl s:View.Model="{Binding IsAsync=True}"
|
|
||||||
VerticalContentAlignment="Stretch"
|
|
||||||
HorizontalContentAlignment="Stretch"
|
|
||||||
IsTabStop="False"
|
|
||||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
|
|
||||||
</DataTemplate>
|
|
||||||
</TabControl.ContentTemplate>
|
|
||||||
</TabControl>
|
|
||||||
</materialDesign:Card>
|
|
||||||
</Grid>
|
|
||||||
</DockPanel>
|
|
||||||
</mde:MaterialWindow>
|
</mde:MaterialWindow>
|
||||||
@ -9,6 +9,7 @@ using Artemis.Core.Services;
|
|||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.Shared;
|
using Artemis.UI.Screens.Shared;
|
||||||
using Artemis.UI.Shared.Services;
|
using Artemis.UI.Shared.Services;
|
||||||
|
using MaterialDesignThemes.Wpf;
|
||||||
using Ookii.Dialogs.Wpf;
|
using Ookii.Dialogs.Wpf;
|
||||||
using RGB.NET.Layout;
|
using RGB.NET.Layout;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
@ -21,6 +22,7 @@ namespace Artemis.UI.Screens.Settings.Device
|
|||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IRgbService _rgbService;
|
private readonly IRgbService _rgbService;
|
||||||
private ArtemisLed _selectedLed;
|
private ArtemisLed _selectedLed;
|
||||||
|
private SnackbarMessageQueue _deviceMessageQueue;
|
||||||
|
|
||||||
public DeviceDialogViewModel(ArtemisDevice device, IDeviceService deviceService, IRgbService rgbService, IDialogService dialogService, IDeviceDebugVmFactory factory)
|
public DeviceDialogViewModel(ArtemisDevice device, IDeviceService deviceService, IRgbService rgbService, IDialogService dialogService, IDeviceDebugVmFactory factory)
|
||||||
{
|
{
|
||||||
@ -38,9 +40,28 @@ namespace Artemis.UI.Screens.Settings.Device
|
|||||||
DisplayName = $"{device.RgbDevice.DeviceInfo.Model} | Artemis";
|
DisplayName = $"{device.RgbDevice.DeviceInfo.Model} | Artemis";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialActivate()
|
||||||
|
{
|
||||||
|
DeviceMessageQueue = new SnackbarMessageQueue(TimeSpan.FromSeconds(5));
|
||||||
|
Device.DeviceUpdated += DeviceOnDeviceUpdated;
|
||||||
|
base.OnInitialActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnClose()
|
||||||
|
{
|
||||||
|
Device.DeviceUpdated -= DeviceOnDeviceUpdated;
|
||||||
|
base.OnClose();
|
||||||
|
}
|
||||||
|
|
||||||
public ArtemisDevice Device { get; }
|
public ArtemisDevice Device { get; }
|
||||||
public PanZoomViewModel PanZoomViewModel { get; }
|
public PanZoomViewModel PanZoomViewModel { get; }
|
||||||
|
|
||||||
|
public SnackbarMessageQueue DeviceMessageQueue
|
||||||
|
{
|
||||||
|
get => _deviceMessageQueue;
|
||||||
|
set => SetAndNotify(ref _deviceMessageQueue, value);
|
||||||
|
}
|
||||||
|
|
||||||
public ArtemisLed SelectedLed
|
public ArtemisLed SelectedLed
|
||||||
{
|
{
|
||||||
get => _selectedLed;
|
get => _selectedLed;
|
||||||
@ -50,7 +71,10 @@ namespace Artemis.UI.Screens.Settings.Device
|
|||||||
NotifyOfPropertyChange(nameof(SelectedLeds));
|
NotifyOfPropertyChange(nameof(SelectedLeds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<ArtemisLed> SelectedLeds => SelectedLed != null ? new List<ArtemisLed> { SelectedLed } : null;
|
|
||||||
|
public bool CanExportLayout => Device.Layout?.IsValid ?? false;
|
||||||
|
|
||||||
|
public List<ArtemisLed> SelectedLeds => SelectedLed != null ? new List<ArtemisLed> {SelectedLed} : null;
|
||||||
|
|
||||||
public bool CanOpenImageDirectory => Device.Layout?.Image != null;
|
public bool CanOpenImageDirectory => Device.Layout?.Image != null;
|
||||||
|
|
||||||
@ -165,5 +189,14 @@ namespace Artemis.UI.Screens.Settings.Device
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// ReSharper restore UnusedMember.Global
|
// ReSharper restore UnusedMember.Global
|
||||||
|
|
||||||
|
#region Event handlers
|
||||||
|
|
||||||
|
private void DeviceOnDeviceUpdated(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
NotifyOfPropertyChange(nameof(CanExportLayout));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,15 +91,21 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Layout file path</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Default layout file path</TextBlock>
|
||||||
<Button Grid.Column="1" Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Copy path to clipboard" Width="24" Height="24">
|
<Button Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
ToolTip="Copy path to clipboard"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
Command="{s:Action CopyToClipboard}"
|
||||||
|
CommandParameter="{Binding DefaultLayoutPath}">
|
||||||
<materialDesign:PackIcon Kind="ContentCopy" Width="18" Height="18" />
|
<materialDesign:PackIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}"
|
<TextBlock Style="{StaticResource MaterialDesignTextBlock}"
|
||||||
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
|
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
Text="{Binding Device.Layout.FilePath}" />
|
Text="{Binding DefaultLayoutPath}" />
|
||||||
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="0 5" />
|
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="0 5" />
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
@ -108,14 +114,19 @@
|
|||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Image file path</TextBlock>
|
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Image file path</TextBlock>
|
||||||
<Button Grid.Column="1" Style="{StaticResource MaterialDesignIconForegroundButton}" ToolTip="Copy path to clipboard" Width="24" Height="24">
|
<Button Grid.Column="1" Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
ToolTip="Copy path to clipboard"
|
||||||
|
Width="24"
|
||||||
|
Height="24"
|
||||||
|
Command="{s:Action CopyToClipboard}"
|
||||||
|
CommandParameter="{Binding Device.Layout.Image.LocalPath}">
|
||||||
<materialDesign:PackIcon Kind="ContentCopy" Width="18" Height="18" />
|
<materialDesign:PackIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||||
</Button>
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignTextBlock}"
|
<TextBlock Style="{StaticResource MaterialDesignTextBlock}"
|
||||||
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
|
Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}"
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
Text="{Binding Device.Layout.Image}" />
|
Text="{Binding Device.Layout.Image.LocalPath}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -1,4 +1,5 @@
|
|||||||
using Artemis.Core;
|
using System.Windows;
|
||||||
|
using Artemis.Core;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
@ -6,6 +7,8 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
{
|
{
|
||||||
public class DeviceInfoTabViewModel : Screen
|
public class DeviceInfoTabViewModel : Screen
|
||||||
{
|
{
|
||||||
|
private string _defaultLayoutPath;
|
||||||
|
|
||||||
public DeviceInfoTabViewModel(ArtemisDevice device)
|
public DeviceInfoTabViewModel(ArtemisDevice device)
|
||||||
{
|
{
|
||||||
Device = device;
|
Device = device;
|
||||||
@ -14,5 +17,23 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
|
|
||||||
public bool IsKeyboard => Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard;
|
public bool IsKeyboard => Device.RgbDevice.DeviceInfo.DeviceType == RGBDeviceType.Keyboard;
|
||||||
public ArtemisDevice Device { get; }
|
public ArtemisDevice Device { get; }
|
||||||
|
|
||||||
|
public string DefaultLayoutPath
|
||||||
|
{
|
||||||
|
get => _defaultLayoutPath;
|
||||||
|
set => SetAndNotify(ref _defaultLayoutPath, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CopyToClipboard(string content)
|
||||||
|
{
|
||||||
|
Clipboard.SetText(content);
|
||||||
|
((DeviceDialogViewModel) Parent).DeviceMessageQueue.Enqueue("Copied path to clipboard.");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnInitialActivate()
|
||||||
|
{
|
||||||
|
DefaultLayoutPath = Device.DeviceProvider.LoadLayout(Device).FilePath;
|
||||||
|
base.OnInitialActivate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -174,20 +174,31 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:HintAssist.Hint>
|
</materialDesign:HintAssist.Hint>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
<Button Style="{StaticResource MaterialDesignRaisedButton}" Margin="0 8 8 0" Command="{s:Action SelectPhysicalLayout}">
|
|
||||||
SELECT PHYSICAL LAYOUT (PLACEHOLDER)
|
|
||||||
</Button>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<!-- Buttons -->
|
<!-- Buttons -->
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
<Grid Grid.Row="1" >
|
||||||
<Button Style="{StaticResource MaterialDesignOutlinedButton}" IsCancel="True" Margin="0 8 8 0" Command="{s:Action Reset}">
|
<Grid.ColumnDefinitions>
|
||||||
RESET
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Grid.Column="0"
|
||||||
|
Style="{StaticResource MaterialDesignOutlinedButton}"
|
||||||
|
Margin="0 8 8 0"
|
||||||
|
Command="{s:Action SelectPhysicalLayout}"
|
||||||
|
ToolTip="Restart device setup, allowing you to select a new physical and logical layout">
|
||||||
|
RESTART SETUP
|
||||||
</Button>
|
</Button>
|
||||||
<Button Style="{StaticResource MaterialDesignRaisedButton}" IsDefault="True" Margin="0 8 8 0" Command="{s:Action Apply}">
|
|
||||||
APPLY
|
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
</Button>
|
<Button Style="{StaticResource MaterialDesignOutlinedButton}" IsCancel="True" Margin="0 8 8 0" Command="{s:Action Reset}">
|
||||||
</StackPanel>
|
RESET
|
||||||
|
</Button>
|
||||||
|
<Button Style="{StaticResource MaterialDesignRaisedButton}" IsDefault="True" Margin="0 8 8 0" Command="{s:Action Apply}">
|
||||||
|
APPLY
|
||||||
|
</Button>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -15,7 +15,6 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
public class DevicePropertiesTabViewModel : Screen
|
public class DevicePropertiesTabViewModel : Screen
|
||||||
{
|
{
|
||||||
private readonly ICoreService _coreService;
|
private readonly ICoreService _coreService;
|
||||||
private readonly IMessageService _messageService;
|
|
||||||
private readonly IDialogService _dialogService;
|
private readonly IDialogService _dialogService;
|
||||||
private readonly IRgbService _rgbService;
|
private readonly IRgbService _rgbService;
|
||||||
private float _blueScale;
|
private float _blueScale;
|
||||||
@ -34,13 +33,11 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
public DevicePropertiesTabViewModel(ArtemisDevice device,
|
public DevicePropertiesTabViewModel(ArtemisDevice device,
|
||||||
ICoreService coreService,
|
ICoreService coreService,
|
||||||
IRgbService rgbService,
|
IRgbService rgbService,
|
||||||
IMessageService messageService,
|
|
||||||
IDialogService dialogService,
|
IDialogService dialogService,
|
||||||
IModelValidator<DevicePropertiesTabViewModel> validator) : base(validator)
|
IModelValidator<DevicePropertiesTabViewModel> validator) : base(validator)
|
||||||
{
|
{
|
||||||
_coreService = coreService;
|
_coreService = coreService;
|
||||||
_rgbService = rgbService;
|
_rgbService = rgbService;
|
||||||
_messageService = messageService;
|
|
||||||
_dialogService = dialogService;
|
_dialogService = dialogService;
|
||||||
|
|
||||||
Device = device;
|
Device = device;
|
||||||
@ -115,7 +112,7 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
if (e.OriginalSource is Button)
|
if (e.OriginalSource is Button)
|
||||||
{
|
{
|
||||||
Device.CustomLayoutPath = null;
|
Device.CustomLayoutPath = null;
|
||||||
_messageService.ShowMessage("Cleared imported layout");
|
((DeviceDialogViewModel) Parent).DeviceMessageQueue.Enqueue("Cleared imported layout.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,13 +123,13 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
if (result == true)
|
if (result == true)
|
||||||
{
|
{
|
||||||
Device.CustomLayoutPath = dialog.FileName;
|
Device.CustomLayoutPath = dialog.FileName;
|
||||||
_messageService.ShowMessage($"Imported layout from {dialog.FileName}");
|
((DeviceDialogViewModel) Parent).DeviceMessageQueue.Enqueue($"Imported layout from {dialog.FileName}.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SelectPhysicalLayout()
|
public async Task SelectPhysicalLayout()
|
||||||
{
|
{
|
||||||
await _dialogService.ShowDialog<DeviceLayoutDialogViewModel>(new Dictionary<string, object> {{"device", Device}});
|
await _dialogService.ShowDialogAt<DeviceLayoutDialogViewModel>("DeviceDialog", new Dictionary<string, object> {{"device", Device}});
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Apply()
|
public async Task Apply()
|
||||||
@ -151,6 +148,7 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
Device.RedScale = RedScale / 100f;
|
Device.RedScale = RedScale / 100f;
|
||||||
Device.GreenScale = GreenScale / 100f;
|
Device.GreenScale = GreenScale / 100f;
|
||||||
Device.BlueScale = BlueScale / 100f;
|
Device.BlueScale = BlueScale / 100f;
|
||||||
|
_rgbService.SaveDevice(Device);
|
||||||
|
|
||||||
_coreService.ModuleRenderingDisabled = false;
|
_coreService.ModuleRenderingDisabled = false;
|
||||||
}
|
}
|
||||||
@ -195,7 +193,8 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
|
|||||||
|
|
||||||
private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.PropertyName == nameof(Device.CustomLayoutPath)) _rgbService.ApplyBestDeviceLayout(Device);
|
if (e.PropertyName == nameof(Device.CustomLayoutPath))
|
||||||
|
_rgbService.ApplyBestDeviceLayout(Device);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnFrameRendering(object sender, FrameRenderingEventArgs e)
|
private void OnFrameRendering(object sender, FrameRenderingEventArgs e)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user