diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs
index 1a0f26a4a..079bb18e2 100644
--- a/src/Artemis.Core/Services/CoreService.cs
+++ b/src/Artemis.Core/Services/CoreService.cs
@@ -238,11 +238,7 @@ namespace Artemis.Core.Services
// Initialize the services
_pluginManagementService.CopyBuiltInPlugins();
- _pluginManagementService.LoadPlugins(
- StartupArguments.Contains("--ignore-plugin-lock"),
- StartupArguments.Contains("--force-elevation"),
- IsElevated
- );
+ _pluginManagementService.LoadPlugins(StartupArguments, IsElevated);
_rgbService.IsRenderPaused = false;
OnInitialized();
diff --git a/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs b/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs
index 3791ae838..d0719bd38 100644
--- a/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs
+++ b/src/Artemis.Core/Services/Interfaces/IPluginManagementService.cs
@@ -26,7 +26,7 @@ namespace Artemis.Core.Services
///
/// Loads all installed plugins. If plugins already loaded this will reload them all
///
- void LoadPlugins(bool ignorePluginLock, bool stayElevated, bool isElevated);
+ void LoadPlugins(List startupArguments, bool isElevated);
///
/// Unloads all installed plugins.
diff --git a/src/Artemis.Core/Services/PluginManagementService.cs b/src/Artemis.Core/Services/PluginManagementService.cs
index e0c16e1e2..a88c8f788 100644
--- a/src/Artemis.Core/Services/PluginManagementService.cs
+++ b/src/Artemis.Core/Services/PluginManagementService.cs
@@ -179,8 +179,11 @@ namespace Artemis.Core.Services
#region Plugins
- public void LoadPlugins(bool ignorePluginLock, bool stayElevated, bool isElevated)
+ public void LoadPlugins(List startupArguments, bool isElevated)
{
+ bool ignorePluginLock = startupArguments.Contains("--ignore-plugin-lock");
+ bool stayElevated = startupArguments.Contains("--force-elevation");
+ bool droppedAdmin = startupArguments.Contains("--dropped-admin");
if (LoadingPlugins)
throw new ArtemisCoreException("Cannot load plugins while a previous load hasn't been completed yet.");
@@ -218,10 +221,15 @@ namespace Artemis.Core.Services
if (isElevated && !adminRequired && !stayElevated)
{
- // No need for a delay this early on, nothing that needs graceful shutdown is happening yet
- _logger.Information("Restarting because no plugin requires elevation and --force-elevation was not supplied");
- Utilities.Restart(false, TimeSpan.Zero);
- return;
+ if (droppedAdmin)
+ _logger.Information("No plugin requires elevation but dropping admin failed before, ignoring");
+ else
+ {
+ // No need for a delay this early on, nothing that needs graceful shutdown is happening yet
+ _logger.Information("Restarting because no plugin requires elevation and --force-elevation was not supplied");
+ Utilities.Restart(false, TimeSpan.Zero, "--dropped-admin");
+ return;
+ }
}
foreach (Plugin plugin in _plugins.Where(p => p.Entity.IsEnabled))
diff --git a/src/Artemis.Core/Services/WebServer/WebServerService.cs b/src/Artemis.Core/Services/WebServer/WebServerService.cs
index 55c7cbcfb..589004e29 100644
--- a/src/Artemis.Core/Services/WebServer/WebServerService.cs
+++ b/src/Artemis.Core/Services/WebServer/WebServerService.cs
@@ -43,10 +43,9 @@ namespace Artemis.Core.Services
Server?.Dispose();
Server = null;
- string url = $"http://*:{_webServerPortSetting.Value}/";
WebApiModule apiModule = new("/api/", JsonNetSerializer);
- PluginsModule.ServerUrl = url;
- WebServer server = new WebServer(o => o.WithUrlPrefix(url).WithMode(HttpListenerMode.EmbedIO))
+ PluginsModule.ServerUrl = $"http://localhost:{_webServerPortSetting.Value}/";
+ WebServer server = new WebServer(o => o.WithUrlPrefix($"http://*:{_webServerPortSetting.Value}/").WithMode(HttpListenerMode.EmbedIO))
.WithLocalSessionManager()
.WithModule(apiModule)
.WithModule(PluginsModule)
@@ -61,7 +60,7 @@ namespace Artemis.Core.Services
server.StateChanged += (s, e) => _logger.Verbose("WebServer new state - {state}", e.NewState);
// Store the URL in a webserver.txt file so that remote applications can find it
- File.WriteAllText(Path.Combine(Constants.DataFolder, "webserver.txt"), $"http://localhost:{_webServerPortSetting.Value}/");
+ File.WriteAllText(Path.Combine(Constants.DataFolder, "webserver.txt"), PluginsModule.ServerUrl);
return server;
}
@@ -156,7 +155,6 @@ namespace Artemis.Core.Services
private void HandleDataModelRequest(Module module, T value) where T : DataModel
{
-
}
public void RemovePluginEndPoint(PluginEndPoint endPoint)
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs
index 40395868a..76c54481b 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs
@@ -32,6 +32,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
private readonly IDialogService _dialogService;
private readonly IProfileEditorService _profileEditorService;
private readonly IWindowManager _windowManager;
+ private LayerBrushSettingsWindowViewModel? _layerBrushSettingsWindowVm;
+ private LayerEffectSettingsWindowViewModel _layerEffectSettingsWindowVm;
public TreeGroupViewModel(LayerPropertyGroupViewModel layerPropertyGroupViewModel, IProfileEditorService profileEditorService, IDialogService dialogService, IWindowManager windowManager)
{
@@ -73,7 +75,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
ConstructorArgument argument = new(brushParameter.Name, layerBrush);
BrushConfigurationViewModel viewModel = (BrushConfigurationViewModel) layerBrush.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
- _windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(viewModel));
+ _layerBrushSettingsWindowVm = new LayerBrushSettingsWindowViewModel(viewModel);
+ _windowManager.ShowDialog(_layerBrushSettingsWindowVm);
}
catch (Exception e)
{
@@ -98,7 +101,9 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
ParameterInfo effectParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerEffect).IsAssignableFrom(p.ParameterType));
ConstructorArgument argument = new(effectParameter.Name, layerEffect);
EffectConfigurationViewModel viewModel = (EffectConfigurationViewModel) layerEffect.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
- _windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(viewModel));
+
+ _layerEffectSettingsWindowVm = new LayerEffectSettingsWindowViewModel(viewModel);
+ _windowManager.ShowDialog(_layerEffectSettingsWindowVm);
}
catch (Exception e)
{
@@ -185,6 +190,11 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
protected override void OnClose()
{
LayerPropertyGroupViewModel.PropertyChanged -= LayerPropertyGroupViewModelOnPropertyChanged;
+
+ // Clean up windows that may be open, sorry but your brush/effect is closed!
+ _layerBrushSettingsWindowVm?.RequestClose();
+ _layerEffectSettingsWindowVm?.RequestClose();
+
base.OnClose();
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Windows/LayerBrushSettingsWindowView.xaml b/src/Artemis.UI/Screens/ProfileEditor/Windows/LayerBrushSettingsWindowView.xaml
index fe90efb28..d0b42c891 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Windows/LayerBrushSettingsWindowView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/Windows/LayerBrushSettingsWindowView.xaml
@@ -18,13 +18,18 @@
d:DesignWidth="800"
d:DataContext="{d:DesignInstance windows:LayerBrushSettingsWindowViewModel}"
Icon="/Resources/Images/Logo/logo-512.png">
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
+
+
+
\ No newline at end of file