1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-31 09:43:46 +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:,,,/MaterialDesignExtensions;component/Themes/MaterialDesignLightTheme.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Scrollbar.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> </ResourceDictionary.MergedDictionaries>
<!-- Some general convertes etc. --> <!-- Some general convertes etc. -->

View File

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

View File

@ -65,7 +65,13 @@
Title="{Binding ActiveItem.DisplayName}" Title="{Binding ActiveItem.DisplayName}"
ShowNavigationDrawerButton="True" ShowNavigationDrawerButton="True"
DockPanel.Dock="Top"> 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 --> <!-- Bug: materialDesign:RippleAssist.RippleOnTop doesn't look as nice but otherwise it doesn't work at all, not sure why -->
<Button Style="{StaticResource MaterialDesignIconForegroundButton}" <Button Style="{StaticResource MaterialDesignIconForegroundButton}"
ToolTip="Open debugger" ToolTip="Open debugger"

View File

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

View File

@ -7,13 +7,18 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:RenderDebugViewModel}"> d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance local:RenderDebugViewModel}">
<StackPanel> <Grid>
<TextBlock TextWrapping="Wrap"> <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. 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. Please note that having this window open can have a performance impact on your system.
</TextBlock> </TextBlock>
<Grid Margin="0,10,0,0"> <Grid Grid.Row="1" Margin="0,10,0,0">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
@ -28,8 +33,8 @@
<TextBlock Grid.Column="2" HorizontalAlignment="Right" Text="{Binding CurrentFps}" /> <TextBlock Grid.Column="2" HorizontalAlignment="Right" Text="{Binding CurrentFps}" />
</Grid> </Grid>
<materialDesign:Card VerticalAlignment="Stretch" Margin="0, 5,0,0"> <materialDesign:Card Grid.Row="2" Margin="0,5,0,0" Background="{StaticResource Checkerboard}">
<Image Source="{Binding CurrentFrame}" /> <Image Source="{Binding CurrentFrame}" />
</materialDesign:Card> </materialDesign:Card>
</StackPanel> </Grid>
</UserControl> </UserControl>

View File

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

View File

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

View File

@ -9,15 +9,19 @@
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid Margin="15"> <Grid Margin="15">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock> <TextBlock TextWrapping="Wrap">
Enter absolute paths to the device layout and choose the image layout you wish to test. <LineBreak /> 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. 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> </TextBlock>
<DataGrid Grid.Row="1"
<Separator Grid.Row="1" Style="{StaticResource MaterialDesignLightSeparator}" />
<DataGrid Grid.Row="2"
ItemsSource="{Binding Definitions}" ItemsSource="{Binding Definitions}"
AutoGenerateColumns="False" AutoGenerateColumns="False"
CanUserSortColumns="True" CanUserSortColumns="True"
@ -36,7 +40,7 @@
EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}" /> EditingElementStyle="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}" />
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </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}"> <Button Style="{StaticResource MaterialDesignOutlinedButton}" Margin="0 0 5 0" Command="{s:Action Cancel}">
CANCEL CANCEL
</Button> </Button>

View File

@ -1,6 +1,4 @@
using System; using Artemis.Core;
using System.IO;
using Artemis.Core;
using Artemis.Core.Modules; using Artemis.Core.Modules;
using SkiaSharp; using SkiaSharp;
@ -15,20 +13,6 @@ namespace Artemis.Plugins.Modules.Overlay
DisplayName = "Overlay"; DisplayName = "Overlay";
DisplayIcon = "ArrangeBringToFront"; DisplayIcon = "ArrangeBringToFront";
DefaultPriorityCategory = ModulePriorityCategory.Overlay; 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. // This is the end of your plugin life cycle.