Meta - Replace WPF projects with Avalonia projects

This commit is contained in:
Robert committed 2022-03-27 11:55:26 +02:00
1 parent fcf0376a9a
commit d7f3ee1190
1110 files changed
+10872 -52240

No files matched your search

@@ -1,37 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.StartupWizard.Steps.DevicesStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mde="https://spiegelp.github.io/MaterialDesignExtensions/winfx/xaml"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
Devices are supported through the use of device providers. <LineBreak />
In the list below you can enable device providers for each brand you own by checking <Run Text="Feature enabled" FontWeight="Bold" />.
</TextBlock>
<ListBox Grid.Row="1" ItemsSource="{Binding Items}" HorizontalContentAlignment="Stretch" VirtualizingPanel.ScrollUnit="Pixel" Margin="0 15">
<ListBox.ItemTemplate>
<DataTemplate>
<ContentControl s:View.Model="{Binding}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" IsTabStop="False" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Grid.Row="2" Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="#FFB9A40A" TextWrapping="Wrap">
<Run Text="Note:" FontWeight="Bold" /> To avoid possible instability it's recommended to disable the device providers of brands you don't own.
</TextBlock>
<mde:StepButtonBar Grid.Row="3" VerticalAlignment="Bottom" Continue="CONTINUE" Back="BACK" />
</Grid>
</UserControl>
@@ -1,41 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using Artemis.Core;
using Artemis.Core.DeviceProviders;
using Artemis.Core.Services;
using Artemis.UI.Ninject.Factories;
using Artemis.UI.Screens.Settings.Tabs.Plugins;
using Stylet;
namespace Artemis.UI.Screens.StartupWizard.Steps
{
public class DevicesStepViewModel : Conductor<PluginFeatureViewModel>.Collection.AllActive
{
private readonly IPluginManagementService _pluginManagementService;
private readonly ISettingsVmFactory _settingsVmFactory;
public DevicesStepViewModel(IPluginManagementService pluginManagementService, ISettingsVmFactory settingsVmFactory)
{
_pluginManagementService = pluginManagementService;
_settingsVmFactory = settingsVmFactory;
}
#region Overrides of Screen
/// <inheritdoc />
protected override void OnActivate()
{
Items.Clear();
// _pluginManagementService.GetFeaturesOfType<>() will only give us enabled features so lets get all of them this way
IEnumerable<PluginFeatureInfo> features = _pluginManagementService.GetAllPlugins()
.SelectMany(p => p.Features.Where(f => typeof(DeviceProvider).IsAssignableFrom(f.FeatureType)))
.OrderBy(d => d.GetType().Name);
Items.AddRange(features.Select(d => _settingsVmFactory.CreatePluginFeatureViewModel(d, true)));
base.OnActivate();
}
#endregion
}
}
@@ -1,65 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.StartupWizard.Steps.FinishStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mde="https://spiegelp.github.io/MaterialDesignExtensions/winfx/xaml"
xmlns:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.ColumnSpan="2">
<TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}">All finished!</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
You are now ready to start using Artemis, enjoy! (●'◡'●)<LineBreak />
</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
To learn more about Artemis and how to use it you may find these resources useful:
</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap" Margin="5 5 0 0">
- The
<Hyperlink NavigateUri="https://wiki.artemis-rgb.com/" RequestNavigate="{s:Action OpenHyperlink}" Style="{StaticResource ArtemisHyperlink}">
Artemis wiki
</Hyperlink>
and more specifically the
<Hyperlink NavigateUri="https://wiki.artemis-rgb.com/en/guides/user/introduction" RequestNavigate="{s:Action OpenHyperlink}" Style="{StaticResource ArtemisHyperlink}">
getting started
</Hyperlink>
guide
</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap" Margin="5 0 0 0">
- The Artemis
<Hyperlink NavigateUri="https://github.com/Artemis-RGB/Artemis" RequestNavigate="{s:Action OpenHyperlink}" Style="{StaticResource ArtemisHyperlink}">
GitHub repository
</Hyperlink>
</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap" Margin="5 0 0 0">
- Our
<Hyperlink NavigateUri="https://discord.gg/S3MVaC9" RequestNavigate="{s:Action OpenHyperlink}" Style="{StaticResource ArtemisHyperlink}">
Discord server
</Hyperlink>
</TextBlock>
</StackPanel>
<mde:StepButtonBar Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Back="BACK" />
<Button Grid.Row="1"
Grid.Column="1"
Margin="0 8"
VerticalAlignment="Bottom"
HorizontalAlignment="Right"
Style="{StaticResource MaterialDesignFlatButton}"
Command="{s:Action Finish}">
FINISH
</Button>
</Grid>
</UserControl>
@@ -1,18 +0,0 @@
using System.Windows.Navigation;
using Stylet;
namespace Artemis.UI.Screens.StartupWizard.Steps
{
public class FinishStepViewModel : Screen
{
public void OpenHyperlink(object sender, RequestNavigateEventArgs e)
{
Core.Utilities.OpenUrl(e.Uri.AbsoluteUri);
}
public void Finish()
{
((StartupWizardViewModel) Parent).SkipOrFinishWizard();
}
}
}
@@ -1,72 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.StartupWizard.Steps.LayoutStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mde="https://spiegelp.github.io/MaterialDesignExtensions/winfx/xaml"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
Artemis uses <Run Text="spatial awareness" FontStyle="Italic" /> to create realistic effects across multiple devices. <LineBreak />
In order to do this correctly, we need to know where your devices are located on your desk.
Select one of the two presets below, after the setup wizard finishes you can tweak this in detail in the <Run Text="Surface editor" FontWeight="Bold" Foreground="{StaticResource PrimaryHueMidBrush}"/>.
</TextBlock>
<Button Grid.Row="1"
Grid.Column="0"
Style="{StaticResource MaterialDesignFlatButton}"
Foreground="{DynamicResource MaterialDesignBody}"
Command="{s:Action ApplyLeftHandedPreset}"
HorizontalAlignment="Right"
Margin="0 0 10 0"
Width="280"
Height="280"
IsEnabled="False">
<StackPanel>
<materialDesign:PackIcon Kind="HandLeft" Width="150" Height="150" HorizontalAlignment="Center" />
<TextBlock TextAlignment="Center" Style="{StaticResource MaterialDesignHeadline6TextBlock}" Margin="0 10 0 0">
Left-handed preset
</TextBlock>
<TextBlock TextAlignment="Center" Style="{StaticResource MaterialDesignBody2TextBlock}" TextWrapping="Wrap">
A preset with the mouse on the left side of the keyboard
</TextBlock>
</StackPanel>
</Button>
<Button Grid.Row="1"
Grid.Column="1"
Style="{StaticResource MaterialDesignFlatButton}"
Foreground="{DynamicResource MaterialDesignBody}"
Command="{s:Action ApplyRightHandedPreset}"
HorizontalAlignment="Left"
Margin="10 0 0 0"
Width="280"
Height="280">
<StackPanel>
<materialDesign:PackIcon Kind="HandRight" Width="150" Height="150" HorizontalAlignment="Center" />
<TextBlock TextAlignment="Center" Style="{StaticResource MaterialDesignHeadline6TextBlock}" Margin="0 10 0 0">
Right-handed preset
</TextBlock>
<TextBlock TextAlignment="Center" Style="{StaticResource MaterialDesignBody2TextBlock}" TextWrapping="Wrap">
A preset with the mouse on the right side of the keyboard
</TextBlock>
</StackPanel>
</Button>
<mde:StepButtonBar Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" VerticalAlignment="Bottom" Back="BACK" />
</Grid>
</UserControl>
@@ -1,47 +0,0 @@
using Artemis.Core.Services;
using Stylet;
namespace Artemis.UI.Screens.StartupWizard.Steps
{
public class LayoutStepViewModel : Screen
{
private readonly IRgbService _rgbService;
public LayoutStepViewModel(IRgbService rgbService)
{
_rgbService = rgbService;
}
public void ApplyLeftHandedPreset()
{
_rgbService.AutoArrangeDevices();
StartupWizardViewModel startupWizardViewModel = (StartupWizardViewModel) Parent;
startupWizardViewModel.Continue();
}
public void ApplyRightHandedPreset()
{
_rgbService.AutoArrangeDevices();
StartupWizardViewModel startupWizardViewModel = (StartupWizardViewModel) Parent;
startupWizardViewModel.Continue();
}
#region Overrides of Screen
/// <inheritdoc />
protected override void OnActivate()
{
_rgbService.SetRenderPaused(true);
base.OnActivate();
}
/// <inheritdoc />
protected override void OnDeactivate()
{
_rgbService.SetRenderPaused(false);
base.OnDeactivate();
}
#endregion
}
}
@@ -1,85 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.StartupWizard.Steps.SettingsStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:mde="https://spiegelp.github.io/MaterialDesignExtensions/winfx/xaml"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
Artemis comes with a variety of settings you can change to tweak everything to your liking. <LineBreak/>
Below you can find a few relevant settings, many more can be changed later on the <Run Text="Settings" FontWeight="Bold" Foreground="{StaticResource PrimaryHueMidBrush}"/> page.
</TextBlock>
<materialDesign:Card Grid.Row="1" materialDesign:ShadowAssist.ShadowDepth="Depth1" VerticalAlignment="Stretch" Margin="0 20 0 0">
<StackPanel Margin="15">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Start up with Windows</TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding StartWithWindows}" />
</StackPanel>
</Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Start up with Windows minimized</TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding StartMinimized}" IsEnabled="{Binding StartWithWindows}" />
</StackPanel>
</Grid>
<Separator Style="{StaticResource MaterialDesignSeparator}" Margin="-15 5" />
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0">
<TextBlock Style="{StaticResource MaterialDesignTextBlock}">Color scheme</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignTextBlock}" Foreground="{DynamicResource MaterialDesignNavigationItemSubheader}" TextWrapping="Wrap">
Pick between a light and dark color scheme, the automatic option copies your Windows settings.
</TextBlock>
</StackPanel>
<StackPanel Grid.Row="0" Grid.Column="1" VerticalAlignment="Center">
<ComboBox Width="80" SelectedValue="{Binding SelectedColorScheme}" ItemsSource="{Binding ColorSchemes}" SelectedValuePath="Value" DisplayMemberPath="Description" />
</StackPanel>
</Grid>
</StackPanel>
</materialDesign:Card>
<mde:StepButtonBar Grid.Row="2" VerticalAlignment="Bottom" Continue="CONTINUE" Back="BACK" />
</Grid>
</UserControl>
@@ -1,97 +0,0 @@
using System;
using System.IO;
using System.Threading.Tasks;
using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Screens.Settings.Tabs.General;
using Artemis.UI.Screens.Settings.Tabs.Plugins;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services;
using Artemis.UI.Utilities;
using Stylet;
using EnumUtilities = Artemis.UI.Shared.EnumUtilities;
namespace Artemis.UI.Screens.StartupWizard.Steps
{
public class SettingsStepViewModel : Conductor<PluginFeatureViewModel>.Collection.AllActive
{
private readonly IDialogService _dialogService;
private readonly ISettingsService _settingsService;
public SettingsStepViewModel(IDialogService dialogService, ISettingsService settingsService)
{
_dialogService = dialogService;
_settingsService = settingsService;
ColorSchemes = new BindableCollection<ValueDescription>(EnumUtilities.GetAllValuesAndDescriptions(typeof(ApplicationColorScheme)));
}
public BindableCollection<ValueDescription> ColorSchemes { get; }
public bool StartWithWindows
{
get => _settingsService.GetSetting("UI.AutoRun", false).Value;
set
{
_settingsService.GetSetting("UI.AutoRun", false).Value = value;
_settingsService.GetSetting("UI.AutoRun", false).Save();
NotifyOfPropertyChange(nameof(StartWithWindows));
Task.Run(() => ApplyAutorun(false));
}
}
public bool StartMinimized
{
get => !_settingsService.GetSetting("UI.ShowOnStartup", true).Value;
set
{
_settingsService.GetSetting("UI.ShowOnStartup", true).Value = !value;
_settingsService.GetSetting("UI.ShowOnStartup", true).Save();
NotifyOfPropertyChange(nameof(StartMinimized));
}
}
public ApplicationColorScheme SelectedColorScheme
{
get => _settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Value;
set
{
_settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Value = value;
_settingsService.GetSetting("UI.ColorScheme", ApplicationColorScheme.Automatic).Save();
}
}
private void ApplyAutorun(bool recreate)
{
if (!StartWithWindows)
StartMinimized = false;
// Remove the old auto-run method of placing a shortcut in shell:startup
string autoRunFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Artemis.lnk");
if (File.Exists(autoRunFile))
File.Delete(autoRunFile);
// Local builds shouldn't auto-run, this is just annoying
// if (Constants.BuildInfo.IsLocalBuild)
// return;
// Create or remove the task if necessary
try
{
bool taskCreated = false;
if (!recreate)
taskCreated = SettingsUtilities.IsAutoRunTaskCreated();
if (StartWithWindows && !taskCreated)
SettingsUtilities.CreateAutoRunTask(TimeSpan.FromSeconds(15));
else if (!StartWithWindows && taskCreated)
SettingsUtilities.RemoveAutoRunTask();
}
catch (Exception e)
{
Execute.PostToUIThread(() => _dialogService.ShowExceptionDialog("An exception occured while trying to apply the auto run setting", e));
throw;
}
}
}
}
@@ -1,30 +0,0 @@
<UserControl x:Class="Artemis.UI.Screens.StartupWizard.Steps.WelcomeStepView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mde="https://spiegelp.github.io/MaterialDesignExtensions/winfx/xaml"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel>
<TextBlock Style="{StaticResource MaterialDesignHeadline4TextBlock}">Welcome to the Artemis startup wizard!</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
In this wizard we'll walk you through the initial configuration of Artemis.<LineBreak/>
</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
Before you can start you need to tell Artemis which devices you want to use and where they are placed on your desk.
You will also get the opportunity to choose some plugins to start off with.<LineBreak/>
</TextBlock>
<TextBlock Style="{StaticResource MaterialDesignBody1TextBlock}" Foreground="{DynamicResource MaterialDesignBodyLight}" TextWrapping="Wrap">
PS: You can also skip the wizard and set things up yourself.<LineBreak/>
</TextBlock>
</StackPanel>
<mde:StepButtonBar Grid.Row="1" VerticalAlignment="Bottom" Continue="CONTINUE" Cancel="SKIP WIZARD"/>
</Grid>
</UserControl>
@@ -1,11 +0,0 @@
using Stylet;
namespace Artemis.UI.Screens.StartupWizard.Steps
{
public class WelcomeStepViewModel : Screen
{
public WelcomeStepViewModel()
{
}
}
}