mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Device properties - Added info tab
This commit is contained in:
parent
ef46577255
commit
bf8bef8a20
@ -0,0 +1,8 @@
|
|||||||
|
using Artemis.Core.Services;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Avalonia.Providers
|
||||||
|
{
|
||||||
|
public class AvaloniaInputProvider : InputProvider
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Artemis.Core;
|
using Artemis.Core;
|
||||||
using Artemis.UI.Avalonia.Shared;
|
using Artemis.UI.Avalonia.Shared;
|
||||||
|
using Artemis.UI.Avalonia.Shared.Services.Interfaces;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|
||||||
@ -8,8 +9,12 @@ namespace Artemis.UI.Avalonia.Screens.Device.Tabs.ViewModels
|
|||||||
{
|
{
|
||||||
public class DeviceInfoTabViewModel : ActivatableViewModelBase
|
public class DeviceInfoTabViewModel : ActivatableViewModelBase
|
||||||
{
|
{
|
||||||
public DeviceInfoTabViewModel(ArtemisDevice device)
|
private readonly INotificationService _notificationService;
|
||||||
|
|
||||||
|
public DeviceInfoTabViewModel(ArtemisDevice device, INotificationService notificationService)
|
||||||
{
|
{
|
||||||
|
_notificationService = notificationService;
|
||||||
|
|
||||||
Device = device;
|
Device = device;
|
||||||
DisplayName = "Info";
|
DisplayName = "Info";
|
||||||
|
|
||||||
@ -24,7 +29,7 @@ namespace Artemis.UI.Avalonia.Screens.Device.Tabs.ViewModels
|
|||||||
public async Task CopyToClipboard(string content)
|
public async Task CopyToClipboard(string content)
|
||||||
{
|
{
|
||||||
await Application.Current.Clipboard.SetTextAsync(content);
|
await Application.Current.Clipboard.SetTextAsync(content);
|
||||||
// ((DeviceDialogViewModel) Parent).DeviceMessageQueue.Enqueue("Copied path to clipboard.");
|
_notificationService.CreateNotification().WithMessage("Copied path to clipboard.").Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,7 +2,84 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="Artemis.UI.Avalonia.Screens.Device.Tabs.Views.DeviceInfoTabView">
|
x:Class="Artemis.UI.Avalonia.Screens.Device.Tabs.Views.DeviceInfoTabView">
|
||||||
Welcome to Avalonia!
|
<Grid RowDefinitions="Auto,*" ColumnDefinitions="*,*">
|
||||||
</UserControl>
|
<!-- First row -->
|
||||||
|
<Border Classes="card" Grid.Column="0" Grid.Row="0" Margin="5">
|
||||||
|
<StackPanel HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
||||||
|
<TextBlock FontWeight="Bold">Device name</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.DeviceInfo.DeviceName}" />
|
||||||
|
<Separator Classes="card-separator" />
|
||||||
|
|
||||||
|
<TextBlock FontWeight="Bold">Manufacturer</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.DeviceInfo.Manufacturer}" />
|
||||||
|
<Separator Classes="card-separator" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock FontWeight="Bold">Device type</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.DeviceType}" />
|
||||||
|
<Separator Classes="card-separator" IsVisible="{Binding IsKeyboard}" />
|
||||||
|
|
||||||
|
<StackPanel IsVisible="{Binding IsKeyboard}">
|
||||||
|
<TextBlock FontWeight="Bold">Physical layout</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.PhysicalLayout}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border Classes="card" Grid.Row="0" Grid.Column="1" Margin="5">
|
||||||
|
<StackPanel VerticalAlignment="Top">
|
||||||
|
<TextBlock FontWeight="Bold">Size (1px = 1mm)</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.Size}" />
|
||||||
|
<Separator Classes="card-separator" />
|
||||||
|
|
||||||
|
<TextBlock FontWeight="Bold">Location (1px = 1mm)</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.Location}" />
|
||||||
|
<Separator Classes="card-separator" />
|
||||||
|
|
||||||
|
<TextBlock FontWeight="Bold">Rotation (degrees)</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.RgbDevice.Rotation.Degrees}" />
|
||||||
|
<Separator Classes="card-separator" IsVisible="{Binding IsKeyboard}" />
|
||||||
|
|
||||||
|
<StackPanel IsVisible="{Binding IsKeyboard}">
|
||||||
|
<TextBlock FontWeight="Bold">Logical layout</TextBlock>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.LogicalLayout}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Second row -->
|
||||||
|
<Border Classes="card" Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" Margin="5">
|
||||||
|
<StackPanel>
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<TextBlock FontWeight="Bold">Default layout file path</TextBlock>
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Classes="icon-button"
|
||||||
|
ToolTip.Tip="Copy path to clipboard"
|
||||||
|
Command="{Binding CopyToClipboard}"
|
||||||
|
CommandParameter="{Binding DefaultLayoutPath}">
|
||||||
|
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock
|
||||||
|
TextWrapping="Wrap"
|
||||||
|
Text="{Binding DefaultLayoutPath}" />
|
||||||
|
<Separator Classes="card-separator" />
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="*,Auto">
|
||||||
|
<TextBlock FontWeight="Bold">Image file path</TextBlock>
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Classes="icon-button"
|
||||||
|
ToolTip.Tip="Copy path to clipboard"
|
||||||
|
Command="{Binding CopyToClipboard}"
|
||||||
|
CommandParameter="{Binding Device.Layout.Image.LocalPath}">
|
||||||
|
<avalonia:MaterialIcon Kind="ContentCopy" Width="18" Height="18" />
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
<TextBlock TextWrapping="Wrap" Text="{Binding Device.Layout.Image.LocalPath}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
using Artemis.Core.Services;
|
using Artemis.Core.Services;
|
||||||
using Artemis.UI.Avalonia.Ninject.Factories;
|
using Artemis.UI.Avalonia.Ninject.Factories;
|
||||||
|
using Artemis.UI.Avalonia.Services.Interfaces;
|
||||||
using Artemis.UI.Avalonia.Shared;
|
using Artemis.UI.Avalonia.Shared;
|
||||||
using ReactiveUI;
|
using ReactiveUI;
|
||||||
|
|
||||||
@ -9,13 +10,15 @@ namespace Artemis.UI.Avalonia.Screens.Root.ViewModels
|
|||||||
{
|
{
|
||||||
private readonly ICoreService _coreService;
|
private readonly ICoreService _coreService;
|
||||||
|
|
||||||
public RootViewModel(ICoreService coreService, ISidebarVmFactory sidebarVmFactory)
|
public RootViewModel(ICoreService coreService, IRegistrationService registrationService, ISidebarVmFactory sidebarVmFactory)
|
||||||
{
|
{
|
||||||
Router = new RoutingState();
|
Router = new RoutingState();
|
||||||
SidebarViewModel = sidebarVmFactory.SidebarViewModel(this);
|
SidebarViewModel = sidebarVmFactory.SidebarViewModel(this);
|
||||||
|
|
||||||
_coreService = coreService;
|
_coreService = coreService;
|
||||||
_coreService.Initialize();
|
_coreService.Initialize();
|
||||||
|
|
||||||
|
registrationService.RegisterProviders();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SidebarViewModel SidebarViewModel { get; }
|
public SidebarViewModel SidebarViewModel { get; }
|
||||||
|
|||||||
@ -0,0 +1,12 @@
|
|||||||
|
namespace Artemis.UI.Avalonia.Services.Interfaces
|
||||||
|
{
|
||||||
|
public interface IRegistrationService : IArtemisUIService
|
||||||
|
{
|
||||||
|
void RegisterBuiltInDataModelDisplays();
|
||||||
|
void RegisterBuiltInDataModelInputs();
|
||||||
|
void RegisterBuiltInPropertyEditors();
|
||||||
|
void RegisterProviders();
|
||||||
|
void RegisterControllers();
|
||||||
|
void ApplyPreferredGraphicsContext();
|
||||||
|
}
|
||||||
|
}
|
||||||
40
src/Artemis.UI.Avalonia/Services/RegistrationService.cs
Normal file
40
src/Artemis.UI.Avalonia/Services/RegistrationService.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
using Artemis.Core.Services;
|
||||||
|
using Artemis.UI.Avalonia.Providers;
|
||||||
|
using Artemis.UI.Avalonia.Services.Interfaces;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Avalonia.Services
|
||||||
|
{
|
||||||
|
public class RegistrationService : IRegistrationService
|
||||||
|
{
|
||||||
|
private readonly IInputService _inputService;
|
||||||
|
|
||||||
|
public RegistrationService(IInputService inputService)
|
||||||
|
{
|
||||||
|
_inputService = inputService;
|
||||||
|
}
|
||||||
|
public void RegisterBuiltInDataModelDisplays()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterBuiltInDataModelInputs()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterBuiltInPropertyEditors()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterProviders()
|
||||||
|
{
|
||||||
|
_inputService.AddInputProvider(new AvaloniaInputProvider());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterControllers()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ApplyPreferredGraphicsContext()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user