Merge branch 'development' into VisualScripting

This commit is contained in:
Robert committed 2021-08-23 20:42:36 +02:00
commit 3874078f16
35 files changed
+790 -506

No files matched your search

@@ -140,7 +140,7 @@ namespace Artemis.UI.Screens.Settings.Device.Tabs
Device.GreenScale = GreenScale / 100f;
Device.BlueScale = BlueScale / 100f;
_rgbService.Surface.Update(true);
_rgbService.FlushLeds = true;
}
public void BrowseCustomLayout(object sender, MouseEventArgs e)
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Artemis.UI.Screens.Settings"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignInstance local:SettingsTabsViewModel}">
@@ -16,18 +17,31 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<TabControl Style="{StaticResource MaterialDesignAppBarTabControl}"
ItemsSource="{Binding Items}"
SelectedItem="{Binding ActiveItem}"
DisplayMemberPath="DisplayName">
<TabControl.ContentTemplate>
<DataTemplate>
<ContentControl s:View.Model="{Binding IsAsync=True}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
IsTabStop="False"
TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
<Grid>
<TabControl Style="{StaticResource MaterialDesignAppBarTabControl}"
ItemsSource="{Binding Items}"
SelectedItem="{Binding ActiveItem}"
DisplayMemberPath="DisplayName">
<TabControl.ContentTemplate>
<DataTemplate>
<ContentControl s:View.Model="{Binding IsAsync=True}"
VerticalContentAlignment="Stretch"
HorizontalContentAlignment="Stretch"
IsTabStop="False"
TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
<!-- Bug: materialDesign:RippleAssist.RippleOnTop doesn't look as nice but otherwise it doesn't work at all, not sure why -->
<Button Style="{StaticResource MaterialDesignIconForegroundButton}"
VerticalAlignment="Top"
HorizontalAlignment="Right"
ToolTip="Open debugger"
Command="{s:Action ShowDebugger}"
materialDesign:RippleAssist.RippleOnTop="True">
<materialDesign:PackIcon Kind="Matrix" />
</Button>
</Grid>
</UserControl>
@@ -2,18 +2,23 @@
using Artemis.UI.Screens.Settings.Tabs.Devices;
using Artemis.UI.Screens.Settings.Tabs.General;
using Artemis.UI.Screens.Settings.Tabs.Plugins;
using Artemis.UI.Services;
using Stylet;
namespace Artemis.UI.Screens.Settings
{
public class SettingsTabsViewModel : Conductor<Screen>.Collection.OneActive
{
private readonly IDebugService _debugService;
public SettingsTabsViewModel(
GeneralSettingsTabViewModel generalSettingsTabViewModel,
PluginSettingsTabViewModel pluginSettingsTabViewModel,
DeviceSettingsTabViewModel deviceSettingsTabViewModel,
AboutTabViewModel aboutTabViewModel)
AboutTabViewModel aboutTabViewModel,
IDebugService debugService)
{
_debugService = debugService;
DisplayName = "Settings";
Items.Add(generalSettingsTabViewModel);
@@ -23,5 +28,10 @@ namespace Artemis.UI.Screens.Settings
ActiveItem = generalSettingsTabViewModel;
}
public void ShowDebugger()
{
_debugService.ShowDebugger();
}
}
}
@@ -37,7 +37,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
}
public PluginFeatureInfo FeatureInfo { get; }
public Exception LoadException => FeatureInfo.Instance?.LoadException;
public Exception LoadException => FeatureInfo.LoadException;
public bool ShowShield { get; }
@@ -81,7 +81,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
public async Task InstallPrerequisites()
{
if (FeatureInfo.Prerequisites.Any())
await PluginPrerequisitesInstallDialogViewModel.Show(_dialogService, new List<IPrerequisitesSubject> { FeatureInfo });
await PluginPrerequisitesInstallDialogViewModel.Show(_dialogService, new List<IPrerequisitesSubject> {FeatureInfo});
}
public async Task RemovePrerequisites()
@@ -119,12 +119,19 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
private async Task UpdateEnabled(bool enable)
{
if (IsEnabled == enable || FeatureInfo.Instance == null)
if (IsEnabled == enable)
{
NotifyOfPropertyChange(nameof(IsEnabled));
return;
}
if (FeatureInfo.Instance == null)
{
NotifyOfPropertyChange(nameof(IsEnabled));
_messageService.ShowMessage($"Feature '{FeatureInfo.Name}' is in a broken state and cannot enable.", "VIEW LOGS", ShowLogsFolder);
return;
}
if (enable)
{
Enabling = true;
@@ -144,7 +151,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
// Check if all prerequisites are met async
if (!FeatureInfo.ArePrerequisitesMet())
{
await PluginPrerequisitesInstallDialogViewModel.Show(_dialogService, new List<IPrerequisitesSubject> { FeatureInfo });
await PluginPrerequisitesInstallDialogViewModel.Show(_dialogService, new List<IPrerequisitesSubject> {FeatureInfo});
if (!FeatureInfo.ArePrerequisitesMet())
{
NotifyOfPropertyChange(nameof(IsEnabled));
@@ -156,7 +163,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
}
catch (Exception e)
{
_messageService.ShowMessage($"Failed to enable {FeatureInfo.Name}\r\n{e.Message}", "VIEW LOGS", ShowLogsFolder);
_messageService.ShowMessage($"Failed to enable '{FeatureInfo.Name}'.\r\n{e.Message}", "VIEW LOGS", ShowLogsFolder);
}
finally
{
@@ -20,6 +20,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="200" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" TextWrapping="Wrap">
The list below shows all loaded plugins. <LineBreak />
@@ -38,7 +39,17 @@
Margin="5 0"
Text="{Binding SearchPluginInput, Delay=300, UpdateSourceTrigger=PropertyChanged}" />
<Button Grid.Column="3"
<Button Grid.Column="3" Style="{DynamicResource MaterialDesignFlatButton}"
HorizontalAlignment="Right"
Command="{s:Action OpenUrl}"
CommandParameter="https://wiki.artemis-rgb.com/en/guides/user/plugins">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="OpenInBrowser" />
<TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Get more plugins</TextBlock>
</StackPanel>
</Button>
<Button Grid.Column="4"
HorizontalAlignment="Right"
Style="{StaticResource MaterialDesignRaisedButton}"
Command="{s:Action ImportPlugin}"
@@ -77,6 +77,11 @@ namespace Artemis.UI.Screens.Settings.Tabs.Plugins
base.OnInitialActivate();
}
public void OpenUrl(string url)
{
Core.Utilities.OpenUrl(url);
}
public async Task ImportPlugin()
{
VistaOpenFileDialog dialog = new() {Filter = "ZIP files (*.zip)|*.zip", Title = "Import Artemis plugin"};