1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

UI - Moved frame time to appbar to avoid Win+Tab issue

UI - Cleaned up home page
Overlay module - Removed test activation requirements
Debugger - Fixed rendering image scaling
Surface editor - Attempted to fix movement of devices without a layout
This commit is contained in:
Robert 2020-09-21 19:39:14 +02:00
parent 8aba0a55ec
commit 0537adc27a
9 changed files with 74 additions and 60 deletions

View File

@ -24,6 +24,9 @@
<ResourceDictionary Source="pack://application:,,,/MaterialDesignExtensions;component/Themes/MaterialDesignLightTheme.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Scrollbar.xaml" />
<!-- Shared UI -->
<ResourceDictionary Source="pack://application:,,,/Artemis.UI.Shared;component/Resources/ArtemisShared.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Some general convertes etc. -->

View File

@ -70,9 +70,8 @@
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8"
Foreground="{DynamicResource MaterialDesignBodyLight}"
VerticalAlignment="Top">
<Run
Text="If you need help, have some feedback or have any other questions feel free to contact us through any of the following channels" />
<Run Text=". " />
If you need help, have some feedback or have any other questions feel free to contact us through any of the
following channels.
</TextBlock>
</StackPanel>
<Border Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0" BorderThickness="0 1 0 0"
@ -86,7 +85,7 @@
<Button Style="{DynamicResource MaterialDesignFlatButton}"
HorizontalAlignment="Left"
x:Name="GitHubButton" Command="{s:Action OpenUrl}"
CommandParameter="https://github.com/SpoinkyNL/Artemis">
CommandParameter="https://github.com/Artemis-RGB/Artemis">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Github" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">GitHub</TextBlock>
@ -94,11 +93,11 @@
</Button>
<Button Grid.Row="0" Style="{DynamicResource MaterialDesignFlatButton}"
HorizontalAlignment="Right"
x:Name="TwitterButton" Command="{s:Action OpenUrl}"
CommandParameter="https://twitter.com/spoinkynl">
x:Name="WebsiteButton" Command="{s:Action OpenUrl}"
CommandParameter="https://artemis-rgb.com">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Twitter" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Twitter</TextBlock>
<materialDesign:PackIcon Kind="Web" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Website</TextBlock>
</StackPanel>
</Button>
<Button Grid.Row="1" Style="{DynamicResource MaterialDesignFlatButton}"
@ -141,9 +140,8 @@
<TextBlock TextWrapping="Wrap" Margin="16 0 16 8"
Foreground="{DynamicResource MaterialDesignBodyLight}"
VerticalAlignment="Top">
<Run
Text="This project is completely open source. If you like it and want to say thanks you could hit the GitHub Star button, tweet or post about it" />
<Run Text=". You can also make your own modules!" />
This project is completely open source. If you like it and want to say thanks you could hit the GitHub Star button,
I like numbers. You could even make plugins, there's a full documentation on the website
</TextBlock>
</StackPanel>
<Border Grid.Row="1" Grid.ColumnSpan="2" Grid.Column="0" BorderThickness="0 1 0 0"
@ -151,18 +149,19 @@
<DockPanel>
<Button Style="{DynamicResource MaterialDesignFlatButton}"
DockPanel.Dock="Right"
x:Name="DonateButton" Command="{s:Action OpenUrl}"
x:Name="DonateButton"
Command="{s:Action OpenUrl}"
CommandParameter="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=VQBAEJYUFLU4J">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Gift" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Donate</TextBlock>
</StackPanel>
</Button>
<TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}"
TextWrapping="Wrap" Margin="16" VerticalAlignment="Center">
<Run
Text="Feel like you want to make a donation? It would be gratefully received. Click the button to donate via " />
<Run Text="Paypal" /><Run Text="." />
<TextBlock Foreground="{DynamicResource MaterialDesignBodyLight}"
TextWrapping="Wrap"
Margin="16"
VerticalAlignment="Center">
Feel like you want to make a donation? It would be gratefully received. Click the button to donate via PayPal.
</TextBlock>
</DockPanel>
</Border>

View File

@ -65,7 +65,13 @@
Title="{Binding ActiveItem.DisplayName}"
ShowNavigationDrawerButton="True"
DockPanel.Dock="Top">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding FrameTime}"
VerticalAlignment="Center"
FontSize="14"
Margin="10 0"
ToolTip="The time the last frame took to render"/>
<!-- Bug: materialDesign:RippleAssist.RippleOnTop doesn't look as nice but otherwise it doesn't work at all, not sure why -->
<Button Style="{StaticResource MaterialDesignIconForegroundButton}"
ToolTip="Open debugger"

View File

@ -29,12 +29,13 @@ namespace Artemis.UI.Screens
private readonly IEventAggregator _eventAggregator;
private readonly ISnackbarMessageQueue _snackbarMessageQueue;
private readonly ThemeWatcher _themeWatcher;
private readonly Timer _titleUpdateTimer;
private readonly Timer _frameTimeUpdateTimer;
private readonly PluginSetting<WindowSize> _windowSize;
private bool _activeItemReady;
private bool _lostFocus;
private ISnackbarMessageQueue _mainMessageQueue;
private string _windowTitle;
private string _frameTime;
public RootViewModel(
IEventAggregator eventAggregator,
@ -52,7 +53,7 @@ namespace Artemis.UI.Screens
_builtInRegistrationService = builtInRegistrationService;
_snackbarMessageQueue = snackbarMessageQueue;
_titleUpdateTimer = new Timer(500);
_frameTimeUpdateTimer = new Timer(500);
_colorScheme = settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic);
_windowSize = settingsService.GetSetting<WindowSize>("UI.RootWindowSize");
@ -62,6 +63,9 @@ namespace Artemis.UI.Screens
ActiveItem = SidebarViewModel.SelectedItem;
ActiveItemReady = true;
var versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
WindowTitle = $"Artemis {versionAttribute?.InformationalVersion}";
}
public SidebarViewModel SidebarViewModel { get; }
@ -84,6 +88,12 @@ namespace Artemis.UI.Screens
set => SetAndNotify(ref _windowTitle, value);
}
public string FrameTime
{
get => _frameTime;
set => SetAndNotify(ref _frameTime, value);
}
public void WindowDeactivated()
{
var windowState = ((Window) View).WindowState;
@ -129,12 +139,12 @@ namespace Artemis.UI.Screens
}
private void UpdateWindowTitle()
private void UpdateFrameTime()
{
var versionAttribute = typeof(RootViewModel).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();
WindowTitle = $"Artemis {versionAttribute?.InformationalVersion} - Frame time: {_coreService.FrameTime.TotalMilliseconds:F2} ms";
FrameTime = $"Frame time: {_coreService.FrameTime.TotalMilliseconds:F2} ms";
}
private void SidebarViewModelOnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == nameof(SidebarViewModel.SelectedItem) && ActiveItem != SidebarViewModel.SelectedItem)
@ -184,9 +194,9 @@ namespace Artemis.UI.Screens
extensionsPaletteHelper.SetLightDark(colorScheme == ApplicationColorScheme.Dark);
}
private void OnTitleUpdateTimerOnElapsed(object sender, ElapsedEventArgs args)
private void OnFrameTimeUpdateTimerOnElapsed(object sender, ElapsedEventArgs args)
{
UpdateWindowTitle();
UpdateFrameTime();
}
private void ThemeWatcherOnThemeChanged(object sender, WindowsThemeEventArgs e)
@ -218,18 +228,18 @@ namespace Artemis.UI.Screens
protected override void OnActivate()
{
MainMessageQueue = _snackbarMessageQueue;
UpdateWindowTitle();
UpdateFrameTime();
_builtInRegistrationService.RegisterBuiltInDataModelDisplays();
_builtInRegistrationService.RegisterBuiltInDataModelInputs();
_builtInRegistrationService.RegisterBuiltInPropertyEditors();
_titleUpdateTimer.Elapsed += OnTitleUpdateTimerOnElapsed;
_frameTimeUpdateTimer.Elapsed += OnFrameTimeUpdateTimerOnElapsed;
_colorScheme.SettingChanged += ColorSchemeOnSettingChanged;
_themeWatcher.ThemeChanged += ThemeWatcherOnThemeChanged;
SidebarViewModel.PropertyChanged += SidebarViewModelOnPropertyChanged;
_titleUpdateTimer.Start();
_frameTimeUpdateTimer.Start();
base.OnActivate();
}
@ -241,14 +251,14 @@ namespace Artemis.UI.Screens
Keyboard.ClearFocus();
MainMessageQueue = null;
_titleUpdateTimer.Stop();
_frameTimeUpdateTimer.Stop();
var window = (MaterialWindow) View;
_windowSize.Value ??= new WindowSize();
_windowSize.Value.ApplyFromWindow(window);
_windowSize.Save();
_titleUpdateTimer.Elapsed -= OnTitleUpdateTimerOnElapsed;
_frameTimeUpdateTimer.Elapsed -= OnFrameTimeUpdateTimerOnElapsed;
_colorScheme.SettingChanged -= ColorSchemeOnSettingChanged;
_themeWatcher.ThemeChanged -= ThemeWatcherOnThemeChanged;
SidebarViewModel.PropertyChanged -= SidebarViewModelOnPropertyChanged;

View File

@ -7,13 +7,18 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:RenderDebugViewModel}">
<StackPanel>
<TextBlock TextWrapping="Wrap">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" 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>
<Grid Margin="0,10,0,0">
<Grid Grid.Row="1" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
@ -28,8 +33,8 @@
<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.Row="2" Margin="0,5,0,0" Background="{StaticResource Checkerboard}">
<Image Source="{Binding CurrentFrame}" />
</materialDesign:Card>
</StackPanel>
</Grid>
</UserControl>

View File

@ -199,6 +199,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
_pluginService.DisablePlugin(Plugin);
NotifyOfPropertyChange(nameof(IsEnabled));
NotifyOfPropertyChange(nameof(CanOpenSettings));
NotifyOfPropertyChange(nameof(RequiresRestart));
NotifyOfPropertyChange(nameof(DisplayLoadFailed));
}

View File

@ -25,13 +25,15 @@
<Rectangle Fill="{DynamicResource MaterialDesignCardBackground}"
Stroke="{DynamicResource MaterialDesignTextBoxBorder}"
StrokeThickness="1"
Visibility="{Binding Device.RgbDevice.DeviceInfo.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}" />
Visibility="{Binding Device.RgbDevice.DeviceInfo.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}"
IsHitTestVisible="False"/>
<TextBlock Text="{Binding Device.RgbDevice.DeviceInfo.DeviceName}"
Visibility="{Binding Device.RgbDevice.DeviceInfo.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
TextWrapping="Wrap"
TextAlignment="Center" />
TextAlignment="Center"
Visibility="{Binding Device.RgbDevice.DeviceInfo.Image, ConverterParameter=Inverted, Converter={StaticResource NullToVisibilityConverter}}"
IsHitTestVisible="False"/>
</Grid>
<!-- Selection rectangle -->

View File

@ -9,15 +9,19 @@
d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="15">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock>
<TextBlock TextWrapping="Wrap">
Enter absolute paths to the device layout and choose the image layout you wish to test. <LineBreak />
Please note that currently RGB.NET does not support changing devices on runtime and so any changes below won't be applied until you restart Artemis.
</TextBlock>
<DataGrid Grid.Row="1"
<Separator Grid.Row="1" Style="{StaticResource MaterialDesignLightSeparator}" />
<DataGrid Grid.Row="2"
ItemsSource="{Binding Definitions}"
AutoGenerateColumns="False"
CanUserSortColumns="True"
@ -36,7 +40,7 @@
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}" />
</DataGrid.Columns>
</DataGrid>
<StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Style="{StaticResource MaterialDesignOutlinedButton}" Margin="0 0 5 0" Command="{s:Action Cancel}">
CANCEL
</Button>

View File

@ -1,6 +1,4 @@
using System;
using System.IO;
using Artemis.Core;
using Artemis.Core;
using Artemis.Core.Modules;
using SkiaSharp;
@ -15,20 +13,6 @@ namespace Artemis.Plugins.Modules.Overlay
DisplayName = "Overlay";
DisplayIcon = "ArrangeBringToFront";
DefaultPriorityCategory = ModulePriorityCategory.Overlay;
UpdateDuringActivationOverride = false;
ActivationRequirements.Add(new ProcessActivationRequirement("taskmgr"));
ActivationRequirements.Add(new ProcessActivationRequirement("calc"));
ActivationRequirements.Add(new ProcessActivationRequirement("mspaint")
{
Location = Path.Combine(Directory.GetParent(Environment.GetFolderPath(Environment.SpecialFolder.System)).FullName, "System32")
});
AddTimedUpdate(TimeSpan.FromSeconds(5), DelayedUpdate);
}
private void DelayedUpdate(double obj)
{
}
// This is the end of your plugin life cycle.