diff --git a/src/Artemis.Core/Plugins/Modules/ActivationRequirements/ProcessActivationRequirement.cs b/src/Artemis.Core/Plugins/Modules/ActivationRequirements/ProcessActivationRequirement.cs index aa9a5c3cd..87ee34783 100644 --- a/src/Artemis.Core/Plugins/Modules/ActivationRequirements/ProcessActivationRequirement.cs +++ b/src/Artemis.Core/Plugins/Modules/ActivationRequirements/ProcessActivationRequirement.cs @@ -4,7 +4,6 @@ using System.Diagnostics; using System.IO; using System.Linq; using Artemis.Core.Services; -using Ninject; namespace Artemis.Core.Modules { @@ -13,8 +12,6 @@ namespace Artemis.Core.Modules /// public class ProcessActivationRequirement : IModuleActivationRequirement { - private readonly IProcessMonitorService _processMonitorService; - /// /// Creates a new instance of the class /// @@ -25,11 +22,6 @@ namespace Artemis.Core.Modules if (string.IsNullOrWhiteSpace(processName) && string.IsNullOrWhiteSpace(location)) throw new ArgumentNullException($"Atleast one {nameof(processName)} and {nameof(location)} must not be null"); - // Let's not make a habit out of this :P - if (CoreService.Kernel == null) - throw new ArtemisCoreException("Cannot create a ProcessActivationRequirement before initializing the Core"); - _processMonitorService = CoreService.Kernel.Get(); - ProcessName = processName; Location = location; } @@ -44,13 +36,15 @@ namespace Artemis.Core.Modules /// public string? Location { get; set; } + internal static IProcessMonitorService? ProcessMonitorService { get; set; } + /// public bool Evaluate() { - if (ProcessName == null && Location == null) + if (ProcessMonitorService == null || ProcessName == null && Location == null) return false; - IEnumerable processes = _processMonitorService.GetRunningProcesses(); + IEnumerable processes = ProcessMonitorService.GetRunningProcesses(); if (ProcessName != null) processes = processes.Where(p => string.Equals(p.ProcessName, ProcessName, StringComparison.InvariantCultureIgnoreCase)); if (Location != null) diff --git a/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs b/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs index dd5900922..bd1451101 100644 --- a/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs +++ b/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Timers; +using Artemis.Core.Modules; namespace Artemis.Core.Services { @@ -22,6 +23,8 @@ namespace Artemis.Core.Services _processScanTimer.Elapsed += OnTimerElapsed; _processScanTimer.Start(); _comparer = new ProcessComparer(); + + ProcessActivationRequirement.ProcessMonitorService = this; } public event EventHandler? ProcessStarted; @@ -67,4 +70,4 @@ namespace Artemis.Core.Services return obj.Id; } } -} +} \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Controls/ColorPicker.xaml b/src/Artemis.UI.Shared/Controls/ColorPicker.xaml index c28b32576..4077a0948 100644 --- a/src/Artemis.UI.Shared/Controls/ColorPicker.xaml +++ b/src/Artemis.UI.Shared/Controls/ColorPicker.xaml @@ -44,10 +44,10 @@ Grid.Row="1" OpacityMask="{x:Null}"> - + - + @@ -433,12 +434,11 @@ diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml index 9b7cb5e48..bef651de6 100644 --- a/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml +++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileEditorView.xaml @@ -224,6 +224,4 @@ - - \ No newline at end of file