1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +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.ProfileTree.TreeItem;
using Artemis.UI.Screens.Module.ProfileEditor.Visualization;
using Artemis.UI.Screens.Settings.Debug;
using Artemis.UI.Screens.Settings.Tabs.Devices;
using Stylet;
@ -30,6 +31,11 @@ namespace Artemis.UI.Ninject.Factories
DeviceSettingsViewModel Create(ArtemisDevice device);
}
public interface IDeviceDebugVmFactory : IVmFactory
{
DeviceDebugViewModel Create(ArtemisDevice device);
}
public interface IProfileEditorVmFactory : IVmFactory
{
ProfileEditorViewModel Create(ProfileModule module);

View File

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

View File

@ -9,45 +9,57 @@
xmlns:debug="clr-namespace:Artemis.UI.Screens.Settings.Debug"
mc:Ignorable="d"
Title="Artemis 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}"
d:DesignHeight="800" d:DesignWidth="800" d:DataContext="{d:DesignInstance debug:DebugViewModel}"
Icon="/Resources/Images/Logo/logo-512.png">
<StackPanel Margin="10, 10, 10, 10">
<TextBlock>
In this window you can view the inner workings of Artemis.
Please not that having this window open can have a performance impact on your system.
</TextBlock>
<DockPanel>
<mde:AppBar Type="Dense"
Title="Debugger"
DockPanel.Dock="Top"
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">
<Grid.ColumnDefinitions>
<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
<StackPanel Margin="10, 10, 10, 10">
<TextBlock TextWrapping="Wrap">
In this window you can view the inner workings of Artemis.
Please note that having this window open can have a performance impact on your system.
</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">
<Image Source="{Binding CurrentFrame}" />
</materialDesign:Card>
<Grid Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<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}"
HorizontalAlignment="Left" Margin="0, 10, 0, 0">
Force garbage collection
</Button>
</StackPanel>
<materialDesign:Card VerticalAlignment="Stretch" Margin="0, 5,0,0">
<Image Source="{Binding CurrentFrame}" />
</materialDesign:Card>
</StackPanel>
</DockPanel>
</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 Artemis.Core.Models.Surface;
using Artemis.Core.Services;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Settings.Debug;
using Artemis.UI.Shared.Services.Interfaces;
using Humanizer;
using Stylet;
namespace Artemis.UI.Screens.Settings.Tabs.Devices
{
@ -11,11 +14,16 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
{
private readonly IDeviceService _deviceService;
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;
_dialogService = dialogService;
_windowManager = windowManager;
_deviceDebugVmFactory = deviceDebugVmFactory;
Device = device;
Type = Device.RgbDevice.DeviceInfo.DeviceType.ToString().Humanize();
@ -38,6 +46,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Devices
public void ShowDeviceDebugger()
{
_windowManager.ShowWindow(_deviceDebugVmFactory.Create(Device));
}
public async void OpenPluginDirectory()