From 0c922c1695547fded633d5698df6fb418b217e7b Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sat, 25 Feb 2023 01:07:10 +0100 Subject: [PATCH] Use PalConfigCommand for the config UI button (partial revert of previous commit) --- Pal.Client/Commands/PalConfigCommand.cs | 2 +- Pal.Client/DependencyInjectionContext.cs | 1 + Pal.Client/Plugin.cs | 9 +-------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Pal.Client/Commands/PalConfigCommand.cs b/Pal.Client/Commands/PalConfigCommand.cs index 74218e1..e2f9432 100644 --- a/Pal.Client/Commands/PalConfigCommand.cs +++ b/Pal.Client/Commands/PalConfigCommand.cs @@ -29,7 +29,7 @@ namespace Pal.Client.Commands { "", _ => Execute() } }; - private void Execute() + public void Execute() { if (_configuration.FirstUse) _agreementWindow.IsOpen = true; diff --git a/Pal.Client/DependencyInjectionContext.cs b/Pal.Client/DependencyInjectionContext.cs index 9632c3b..7ae62e4 100644 --- a/Pal.Client/DependencyInjectionContext.cs +++ b/Pal.Client/DependencyInjectionContext.cs @@ -113,6 +113,7 @@ namespace Pal.Client _serviceCollection.AddTransient(); // commands + _serviceCollection.AddScoped(); _serviceCollection.AddScoped(); _serviceCollection.AddScoped(); _serviceCollection.AddScoped(); diff --git a/Pal.Client/Plugin.cs b/Pal.Client/Plugin.cs index 09a3d0e..312f23f 100644 --- a/Pal.Client/Plugin.cs +++ b/Pal.Client/Plugin.cs @@ -193,14 +193,7 @@ namespace Pal.Client } private void OpenConfigUi() - { - _rootScope!.ServiceProvider.GetRequiredService>() - .SelectMany(cmd => cmd.GetHandlers()) - .Where(cmd => cmd.Key == "config") - .Select(cmd => cmd.Value) - .Single() - .Invoke("config"); - } + => _rootScope!.ServiceProvider.GetRequiredService().Execute(); private void LanguageChanged(string languageCode) {