1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 09:43:46 +00:00

Device debugger - Added placeholder

This commit is contained in:
SpoinkyNL 2020-06-19 15:41:02 +02:00
parent 24afb6b0f5
commit 479d9bb4b2
6 changed files with 120 additions and 34 deletions

View File

@ -11,6 +11,7 @@ using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline;
using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree; using Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Tree;
using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem; using Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem;
using Artemis.UI.Screens.Module.ProfileEditor.Visualization; using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
using Artemis.UI.Screens.Settings.Debug;
using Artemis.UI.Screens.Settings.Tabs.Devices; using Artemis.UI.Screens.Settings.Tabs.Devices;
using Stylet; using Stylet;
@ -30,6 +31,11 @@ namespace Artemis.UI.Ninject.Factories
DeviceSettingsViewModel Create(ArtemisDevice device); DeviceSettingsViewModel Create(ArtemisDevice device);
} }
public interface IDeviceDebugVmFactory : IVmFactory
{
DeviceDebugViewModel Create(ArtemisDevice device);
}
public interface IProfileEditorVmFactory : IVmFactory public interface IProfileEditorVmFactory : IVmFactory
{ {
ProfileEditorViewModel Create(ProfileModule module); ProfileEditorViewModel Create(ProfileModule module);

View File

@ -7,7 +7,6 @@
xmlns:s="https://github.com/canton7/Stylet" xmlns:s="https://github.com/canton7/Stylet"
xmlns:screens="clr-namespace:Artemis.UI.Screens" xmlns:screens="clr-namespace:Artemis.UI.Screens"
xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions" xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
xmlns:tb="http://www.hardcodet.net/taskbar"
mc:Ignorable="d" mc:Ignorable="d"
FadeContentIfInactive="False" FadeContentIfInactive="False"
Icon="/Resources/Images/Logo/logo-512.png" Icon="/Resources/Images/Logo/logo-512.png"
@ -21,9 +20,7 @@
Activated="{s:Action WindowActivated}" Activated="{s:Action WindowActivated}"
KeyDown="{s:Action WindowKeyDown}" KeyDown="{s:Action WindowKeyDown}"
KeyUp="{s:Action WindowKeyUp}" KeyUp="{s:Action WindowKeyUp}"
d:DesignHeight="640" d:DesignHeight="640" d:DesignWidth="1200" d:DataContext="{d:DesignInstance screens:RootViewModel}">
d:DesignWidth="1200"
d:DataContext="{d:DesignInstance screens:RootViewModel}">
<mde:MaterialWindow.Resources> <mde:MaterialWindow.Resources>
<Style TargetType="ContentControl" x:Key="InitializingFade"> <Style TargetType="ContentControl" x:Key="InitializingFade">
<Style.Triggers> <Style.Triggers>

View File

@ -9,45 +9,57 @@
xmlns:debug="clr-namespace:Artemis.UI.Screens.Settings.Debug" xmlns:debug="clr-namespace:Artemis.UI.Screens.Settings.Debug"
mc:Ignorable="d" mc:Ignorable="d"
Title="Artemis debugger" Title="Artemis debugger"
TitleBarIcon="{StaticResource BowIcon}"
Foreground="{DynamicResource MaterialDesignBody}"
Background="{DynamicResource MaterialDesignPaper}" Background="{DynamicResource MaterialDesignPaper}"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto" FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
UseLayoutRounding="True" UseLayoutRounding="True"
FadeContentIfInactive="False" FadeContentIfInactive="False"
Width="800" Width="800"
Height="800" Height="800"
d:DesignHeight="800" d:DesignHeight="800" d:DesignWidth="800" d:DataContext="{d:DesignInstance debug:DebugViewModel}"
d:DesignWidth="800"
d:DataContext="{d:DesignInstance debug:DebugViewModel}"
Icon="/Resources/Images/Logo/logo-512.png"> Icon="/Resources/Images/Logo/logo-512.png">
<StackPanel Margin="10, 10, 10, 10"> <DockPanel>
<TextBlock> <mde:AppBar Type="Dense"
In this window you can view the inner workings of Artemis. Title="Debugger"
Please not that having this window open can have a performance impact on your system. DockPanel.Dock="Top"
</TextBlock> Margin="-18 0 0 0">
<mde:AppBar.AppIcon>
<materialDesign:PackIcon Kind="BugReport" Width="20" Height="28" />
</mde:AppBar.AppIcon>
<materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False">
<StackPanel>
<Button Content="Force garbage collection" Command="{s:Action ForceGarbageCollection}"/>
</StackPanel>
</materialDesign:PopupBox>
</mde:AppBar>
<Grid Margin="0,10,0,0"> <StackPanel Margin="10, 10, 10, 10">
<Grid.ColumnDefinitions> <TextBlock TextWrapping="Wrap">
<ColumnDefinition Width="*" /> In this window you can view the inner workings of Artemis.
<ColumnDefinition Width="Auto" /> Please note that having this window open can have a performance impact on your system.
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0">
This image shows what is being rendered and dispatched to RGB.NET
</TextBlock> </TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,5,0" FontWeight="Bold">
FPS:
</TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Right" Text="{Binding CurrentFps}" />
</Grid>
<materialDesign:Card VerticalAlignment="Stretch" Margin="0, 5,0,0"> <Grid Margin="0,10,0,0">
<Image Source="{Binding CurrentFrame}" /> <Grid.ColumnDefinitions>
</materialDesign:Card> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0">
This image shows what is being rendered and dispatched to RGB.NET
</TextBlock>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" Margin="0,0,5,0" FontWeight="Bold">
FPS:
</TextBlock>
<TextBlock Grid.Column="2" HorizontalAlignment="Right" Text="{Binding CurrentFps}" />
</Grid>
<Button Command="{s:Action ForceGarbageCollection}" Style="{StaticResource MaterialDesignRaisedButton}" <materialDesign:Card VerticalAlignment="Stretch" Margin="0, 5,0,0">
HorizontalAlignment="Left" Margin="0, 10, 0, 0"> <Image Source="{Binding CurrentFrame}" />
Force garbage collection </materialDesign:Card>
</Button> </StackPanel>
</StackPanel> </DockPanel>
</mde:MaterialWindow> </mde:MaterialWindow>

View File

@ -0,0 +1,47 @@
<mde:MaterialWindow x:Class="Artemis.UI.Screens.Settings.Debug.DeviceDebugView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:mde="clr-namespace:MaterialDesignExtensions.Controls;assembly=MaterialDesignExtensions"
xmlns:debug="clr-namespace:Artemis.UI.Screens.Settings.Debug"
mc:Ignorable="d"
Title="Artemis device debugger"
TitleBarIcon="{StaticResource BowIcon}"
Foreground="{DynamicResource MaterialDesignBody}"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
UseLayoutRounding="True"
FadeContentIfInactive="False"
Width="800"
Height="800"
d:DesignHeight="800" d:DesignWidth="800" d:DataContext="{d:DesignInstance debug:DebugViewModel}"
Icon="/Resources/Images/Logo/logo-512.png">
<DockPanel>
<mde:AppBar Type="Dense"
Title="Device debugger"
DockPanel.Dock="Top"
Margin="-18 0 0 0">
<mde:AppBar.AppIcon>
<materialDesign:PackIcon Kind="HammerWrench" Width="20" Height="28" />
</mde:AppBar.AppIcon>
<!-- <materialDesign:PopupBox DockPanel.Dock="Right" PlacementMode="BottomAndAlignRightEdges" StaysOpen="False"> -->
<!-- <StackPanel> -->
<!-- <Button Content="Force garbage collection" Command="{s:Action ForceGarbageCollection}"/> -->
<!-- </StackPanel> -->
<!-- </materialDesign:PopupBox> -->
</mde:AppBar>
<StackPanel Margin="10, 10, 10, 10">
<TextBlock TextWrapping="Wrap">
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.
</TextBlock>
</StackPanel>
</DockPanel>
</mde:MaterialWindow>

View File

@ -0,0 +1,15 @@
using Artemis.Core.Models.Surface;
using Stylet;
namespace Artemis.UI.Screens.Settings.Debug
{
public class DeviceDebugViewModel : Screen
{
public ArtemisDevice Device { get; }
public DeviceDebugViewModel(ArtemisDevice device)
{
Device = device;
}
}
}

View File

@ -2,8 +2,11 @@
using System.Diagnostics; using System.Diagnostics;
using Artemis.Core.Models.Surface; using Artemis.Core.Models.Surface;
using Artemis.Core.Services; using Artemis.Core.Services;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Settings.Debug;
using Artemis.UI.Shared.Services.Interfaces; using Artemis.UI.Shared.Services.Interfaces;
using Humanizer; using Humanizer;
using Stylet;
namespace Artemis.UI.Screens.Settings.Tabs.Devices namespace Artemis.UI.Screens.Settings.Tabs.Devices
{ {
@ -11,11 +14,16 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
{ {
private readonly IDeviceService _deviceService; private readonly IDeviceService _deviceService;
private readonly IDialogService _dialogService; private readonly IDialogService _dialogService;
private readonly IWindowManager _windowManager;
private readonly IDeviceDebugVmFactory _deviceDebugVmFactory;
public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService) public DeviceSettingsViewModel(ArtemisDevice device, IDeviceService deviceService, IDialogService dialogService,
IWindowManager windowManager, IDeviceDebugVmFactory deviceDebugVmFactory)
{ {
_deviceService = deviceService; _deviceService = deviceService;
_dialogService = dialogService; _dialogService = dialogService;
_windowManager = windowManager;
_deviceDebugVmFactory = deviceDebugVmFactory;
Device = device; Device = device;
Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize(); Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize();
@ -38,6 +46,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
public void ShowDeviceDebugger() public void ShowDeviceDebugger()
{ {
_windowManager.ShowWindow(_deviceDebugVmFactory.Create(Device));
} }
public async void OpenPluginDirectory() public async void OpenPluginDirectory()