Workshop - Added layout finder

This commit is contained in:
RobertBeekman committed 2024-05-02 20:02:12 +02:00
1 parent c18f542a61
commit 957bfde0af
35 files changed
+598 -127

No files matched your search

@@ -29,10 +29,12 @@ public partial class StartupWizardView : ReactiveAppWindow<StartupWizardViewMode
else if (step == 2)
Frame.NavigateToType(typeof(DevicesStep), null, new FrameNavigationOptions());
else if (step == 3)
Frame.NavigateToType(typeof(LayoutStep), null, new FrameNavigationOptions());
Frame.NavigateToType(typeof(LayoutsStep), null, new FrameNavigationOptions());
else if (step == 4)
Frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions());
Frame.NavigateToType(typeof(SurfaceStep), null, new FrameNavigationOptions());
else if (step == 5)
Frame.NavigateToType(typeof(SettingsStep), null, new FrameNavigationOptions());
else if (step == 6)
Frame.NavigateToType(typeof(FinishStep), null, new FrameNavigationOptions());
}
}
@@ -9,6 +9,7 @@ using Artemis.Core.DeviceProviders;
using Artemis.Core.Services;
using Artemis.UI.DryIoc.Factories;
using Artemis.UI.Screens.Plugins;
using Artemis.UI.Screens.Workshop.LayoutFinder;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Providers;
using Artemis.UI.Shared.Services;
@@ -35,7 +36,8 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
IPluginManagementService pluginManagementService,
IWindowService windowService,
IDeviceService deviceService,
ISettingsVmFactory settingsVmFactory)
ISettingsVmFactory settingsVmFactory,
LayoutFinderViewModel layoutFinderViewModel)
{
_settingsService = settingsService;
_windowService = windowService;
@@ -54,6 +56,7 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
.Where(p => p.Info.IsCompatible && p.Features.Any(f => f.AlwaysEnabled && f.FeatureType.IsAssignableTo(typeof(DeviceProvider))))
.OrderBy(p => p.Info.Name)
.Select(p => settingsVmFactory.PluginViewModel(p, ReactiveCommand.Create(() => new Unit()))));
LayoutFinderViewModel = layoutFinderViewModel;
CurrentStep = 1;
SetupButtons();
@@ -82,7 +85,8 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
public string Version { get; }
public ObservableCollection<PluginViewModel> DeviceProviders { get; }
public LayoutFinderViewModel LayoutFinderViewModel { get; }
public bool IsAutoRunSupported => _autoRunProvider != null;
public PluginSetting<bool> UIAutoRun => _settingsService.GetSetting("UI.AutoRun", false);
@@ -98,7 +102,7 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
CurrentStep--;
// Skip the settings step if none of it's contents are supported
if (CurrentStep == 4 && !IsAutoRunSupported)
if (CurrentStep == 5 && !IsAutoRunSupported)
CurrentStep--;
SetupButtons();
@@ -106,11 +110,11 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
private void ExecuteContinue()
{
if (CurrentStep < 5)
if (CurrentStep < 6)
CurrentStep++;
// Skip the settings step if none of it's contents are supported
if (CurrentStep == 4 && !IsAutoRunSupported)
if (CurrentStep == 5 && !IsAutoRunSupported)
CurrentStep++;
SetupButtons();
@@ -118,9 +122,9 @@ public partial class StartupWizardViewModel : DialogViewModelBase<bool>
private void SetupButtons()
{
ShowContinue = CurrentStep != 3 && CurrentStep < 5;
ShowContinue = CurrentStep != 4 && CurrentStep < 6;
ShowGoBack = CurrentStep > 1;
ShowFinish = CurrentStep == 5;
ShowFinish = CurrentStep == 6;
}
private void ExecuteSkipOrFinishWizard()
@@ -0,0 +1,31 @@
<UserControl xmlns="https://github.com/avaloniaui"
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:startupWizard="clr-namespace:Artemis.UI.Screens.StartupWizard"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.StartupWizard.Steps.LayoutsStep"
x:DataType="startupWizard:StartupWizardViewModel">
<Border Classes="card">
<Grid RowDefinitions="Auto,Auto,Auto">
<StackPanel Grid.Row="0">
<TextBlock TextWrapping="Wrap">
Device layouts provide Artemis with an image of your devices and exact LED positions. <LineBreak />
While not strictly necessary, this helps to create effects that are perfectly aligned with your hardware.
</TextBlock>
<TextBlock TextWrapping="Wrap" Margin="0 10">
Below you can automatically search the Artemis Workshop for device layouts of your devices.
</TextBlock>
</StackPanel>
<Button Grid.Row="1"
Content="Auto-install layouts"
Command="{CompiledBinding LayoutFinderViewModel.SearchAll}"
ToolTip.Tip="Search layouts and if found install them automatically"
HorizontalAlignment="Right"/>
<ScrollViewer Grid.Row="2" Margin="0 15">
<ContentControl Content="{CompiledBinding LayoutFinderViewModel}"></ContentControl>
</ScrollViewer>
</Grid>
</Border>
</UserControl>
@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace Artemis.UI.Screens.StartupWizard.Steps;
public partial class LayoutsStep : UserControl
{
public LayoutsStep()
{
InitializeComponent();
}
}
@@ -5,7 +5,7 @@
xmlns:startupWizard="clr-namespace:Artemis.UI.Screens.StartupWizard"
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.Screens.StartupWizard.Steps.LayoutStep"
x:Class="Artemis.UI.Screens.StartupWizard.Steps.SurfaceStep"
x:DataType="startupWizard:StartupWizardViewModel">
<Grid RowDefinitions="Auto,*,Auto,Auto" ColumnDefinitions="*,*">
@@ -3,9 +3,9 @@ using Avalonia.Markup.Xaml;
namespace Artemis.UI.Screens.StartupWizard.Steps;
public partial class LayoutStep : UserControl
public partial class SurfaceStep : UserControl
{
public LayoutStep()
public SurfaceStep()
{
InitializeComponent();
}