mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
Plugin settings - Restart Artemis for plugins that require admin rights
Setup wizard - Restart Artemis device providers that require admin rights Setup wizard - Gracefully handle errors during device provider enable Profile editor - Select a valid default brush on clean installs
This commit is contained in:
1 parent
b917f36978
commit
985a94dbaf
16 files changed
+363
-151
No files matched your search
@@ -5,6 +5,7 @@
|
||||
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"
|
||||
Width="800"
|
||||
Height="600"
|
||||
@@ -17,47 +18,58 @@
|
||||
FontFamily="pack://application:,,,/MaterialDesignThemes.Wpf;component/Resources/Roboto/#Roboto"
|
||||
UseLayoutRounding="True"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
|
||||
<mde:Stepper IsLinear="True" Layout="Horizontal" ActiveStepChanged="{s:Action ActiveStepChanged}" CancelNavigation="{s:Action SkipOrFinishWizard}" Margin="15">
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Welcome" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Devices" SecondLevelTitle="Pick your brands" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Desktop layout" SecondLevelTitle="Map your surface" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Settings" SecondLevelTitle="Set your preferences" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Finish" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
</mde:Stepper>
|
||||
<materialDesign:DialogHost IsTabStop="False"
|
||||
Focusable="False"
|
||||
Identifier="RootDialog"
|
||||
DialogTheme="Inherit"
|
||||
SnackbarMessageQueue="{Binding MainMessageQueue}">
|
||||
<Grid>
|
||||
<mde:Stepper IsLinear="True" Layout="Horizontal" ActiveStepChanged="{s:Action ActiveStepChanged}" CancelNavigation="{s:Action SkipOrFinishWizard}" Margin="15">
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Welcome" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Devices" SecondLevelTitle="Pick your brands" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Desktop layout" SecondLevelTitle="Map your surface" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Settings" SecondLevelTitle="Set your preferences" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
<mde:Step>
|
||||
<mde:Step.Header>
|
||||
<mde:StepTitleHeader FirstLevelTitle="Finish" />
|
||||
</mde:Step.Header>
|
||||
<mde:Step.Content>
|
||||
<ContentControl s:View.Model="{Binding ActiveItem}" />
|
||||
</mde:Step.Content>
|
||||
</mde:Step>
|
||||
</mde:Stepper>
|
||||
<materialDesign:Snackbar x:Name="MainSnackbar"
|
||||
MessageQueue="{Binding MainMessageQueue}"
|
||||
materialDesign:SnackbarMessage.InlineActionButtonMaxHeight="80"
|
||||
materialDesign:SnackbarMessage.ContentMaxHeight="200" />
|
||||
</Grid>
|
||||
</materialDesign:DialogHost>
|
||||
</mde:MaterialWindow>
|
||||
@@ -2,18 +2,22 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.StartupWizard.Steps;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using MaterialDesignExtensions.Controllers;
|
||||
using MaterialDesignExtensions.Controls;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Stylet;
|
||||
|
||||
namespace Artemis.UI.Screens.StartupWizard
|
||||
{
|
||||
public class StartupWizardViewModel : Conductor<Screen>.Collection.OneActive
|
||||
{
|
||||
private readonly IMessageService _messageService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private StepperController _stepperController;
|
||||
|
||||
public StartupWizardViewModel(ISettingsService settingsService,
|
||||
IMessageService messageService,
|
||||
WelcomeStepViewModel welcome,
|
||||
DevicesStepViewModel devices,
|
||||
LayoutStepViewModel layout,
|
||||
@@ -21,6 +25,7 @@ namespace Artemis.UI.Screens.StartupWizard
|
||||
FinishStepViewModel finish)
|
||||
{
|
||||
_settingsService = settingsService;
|
||||
_messageService = messageService;
|
||||
Items.Add(welcome);
|
||||
Items.Add(devices);
|
||||
Items.Add(layout);
|
||||
@@ -30,6 +35,8 @@ namespace Artemis.UI.Screens.StartupWizard
|
||||
ActiveItem = Items.First();
|
||||
}
|
||||
|
||||
public ISnackbarMessageQueue MainMessageQueue { get; set; }
|
||||
|
||||
public void ActiveStepChanged(object sender, ActiveStepChangedEventArgs e)
|
||||
{
|
||||
Stepper stepper = (Stepper) sender;
|
||||
@@ -40,22 +47,23 @@ namespace Artemis.UI.Screens.StartupWizard
|
||||
}
|
||||
|
||||
public void SkipOrFinishWizard()
|
||||
{
|
||||
RequestClose();
|
||||
}
|
||||
|
||||
protected override void OnClose()
|
||||
{
|
||||
PluginSetting<bool> setting = _settingsService.GetSetting("UI.SetupWizardCompleted", false);
|
||||
setting.Value = true;
|
||||
setting.Save();
|
||||
|
||||
base.OnClose();
|
||||
RequestClose();
|
||||
}
|
||||
|
||||
|
||||
public void Continue()
|
||||
{
|
||||
_stepperController.Continue();
|
||||
}
|
||||
|
||||
protected override void OnInitialActivate()
|
||||
{
|
||||
MainMessageQueue = _messageService.MainMessageQueue;
|
||||
base.OnInitialActivate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Style="{StaticResource MaterialDesignBody1TextBlock}" TextWrapping="Wrap">
|
||||
EnabledDevices are supported through the use of device providers. <LineBreak />
|
||||
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>
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Artemis.UI.Screens.StartupWizard.Steps
|
||||
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)));
|
||||
Items.AddRange(features.Select(d => _settingsVmFactory.CreatePluginFeatureViewModel(d, true)));
|
||||
|
||||
base.OnActivate();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ 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;
|
||||
|
||||
namespace Artemis.UI.Screens.StartupWizard.Steps
|
||||
@@ -34,7 +35,7 @@ namespace Artemis.UI.Screens.StartupWizard.Steps
|
||||
_settingsService.GetSetting("UI.AutoRun", false).Value = value;
|
||||
_settingsService.GetSetting("UI.AutoRun", false).Save();
|
||||
NotifyOfPropertyChange(nameof(StartWithWindows));
|
||||
Task.Run(ApplyAutorun);
|
||||
Task.Run(() => ApplyAutorun(false));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,23 +60,35 @@ namespace Artemis.UI.Screens.StartupWizard.Steps
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyAutorun()
|
||||
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
|
||||
{
|
||||
string autoRunFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "Artemis.lnk");
|
||||
string executableFile = Constants.ExecutablePath;
|
||||
bool taskCreated = false;
|
||||
if (!recreate)
|
||||
taskCreated = SettingsUtilities.IsAutoRunTaskCreated();
|
||||
|
||||
if (File.Exists(autoRunFile))
|
||||
File.Delete(autoRunFile);
|
||||
if (StartWithWindows)
|
||||
ShortcutUtilities.Create(autoRunFile, executableFile, "--autorun", new FileInfo(executableFile).DirectoryName, "Artemis", "", "");
|
||||
else
|
||||
StartMinimized = false;
|
||||
if (StartWithWindows && !taskCreated)
|
||||
SettingsUtilities.CreateAutoRunTask(TimeSpan.FromSeconds(15));
|
||||
else if (!StartWithWindows && taskCreated)
|
||||
SettingsUtilities.RemoveAutoRunTask();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_dialogService.ShowExceptionDialog("An exception occured while trying to apply the auto run setting", e);
|
||||
Execute.PostToUIThread(() => _dialogService.ShowExceptionDialog("An exception occured while trying to apply the auto run setting", e));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user