1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2026-01-01 10:13:30 +00:00

Settings - Fix general tab breaking when there is no graphics context

This commit is contained in:
Robert 2022-07-04 17:58:44 +02:00
parent b3b324697a
commit 0256a0d625

View File

@ -15,6 +15,7 @@ using Artemis.UI.Shared;
using Avalonia; using Avalonia;
using DynamicData; using DynamicData;
using FluentAvalonia.Styling; using FluentAvalonia.Styling;
using Ninject;
using ReactiveUI; using ReactiveUI;
using Serilog.Events; using Serilog.Events;
@ -27,7 +28,7 @@ namespace Artemis.UI.Screens.Settings
private readonly IDebugService _debugService; private readonly IDebugService _debugService;
private readonly FluentAvaloniaTheme _fluentAvaloniaTheme; private readonly FluentAvaloniaTheme _fluentAvaloniaTheme;
public GeneralTabViewModel(ISettingsService settingsService, IPluginManagementService pluginManagementService, IDebugService debugService, IGraphicsContextProvider? graphicsContextProvider) public GeneralTabViewModel(IKernel kernel, ISettingsService settingsService, IPluginManagementService pluginManagementService, IDebugService debugService)
{ {
DisplayName = "General"; DisplayName = "General";
_settingsService = settingsService; _settingsService = settingsService;
@ -37,6 +38,7 @@ namespace Artemis.UI.Screens.Settings
List<LayerBrushProvider> layerBrushProviders = pluginManagementService.GetFeaturesOfType<LayerBrushProvider>(); List<LayerBrushProvider> layerBrushProviders = pluginManagementService.GetFeaturesOfType<LayerBrushProvider>();
LayerBrushDescriptors = new ObservableCollection<LayerBrushDescriptor>(layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors)); LayerBrushDescriptors = new ObservableCollection<LayerBrushDescriptor>(layerBrushProviders.SelectMany(l => l.LayerBrushDescriptors));
GraphicsContexts = new ObservableCollection<string> {"Software"}; GraphicsContexts = new ObservableCollection<string> {"Software"};
IGraphicsContextProvider? graphicsContextProvider = kernel.TryGet<IGraphicsContextProvider>();
if (graphicsContextProvider != null) if (graphicsContextProvider != null)
GraphicsContexts.AddRange(graphicsContextProvider.GraphicsContextNames); GraphicsContexts.AddRange(graphicsContextProvider.GraphicsContextNames);