Use PalConfigCommand for the config UI button (partial revert of previous commit)

This commit is contained in:
Liza 2023-02-25 01:07:10 +01:00
parent e1dc8cafd9
commit 0c922c1695
3 changed files with 3 additions and 9 deletions

View File

@ -29,7 +29,7 @@ namespace Pal.Client.Commands
{ "", _ => Execute() }
};
private void Execute()
public void Execute()
{
if (_configuration.FirstUse)
_agreementWindow.IsOpen = true;

View File

@ -113,6 +113,7 @@ namespace Pal.Client
_serviceCollection.AddTransient<RepoVerification>();
// commands
_serviceCollection.AddScoped<PalConfigCommand>();
_serviceCollection.AddScoped<ISubCommand, PalConfigCommand>();
_serviceCollection.AddScoped<ISubCommand, PalNearCommand>();
_serviceCollection.AddScoped<ISubCommand, PalStatsCommand>();

View File

@ -193,14 +193,7 @@ namespace Pal.Client
}
private void OpenConfigUi()
{
_rootScope!.ServiceProvider.GetRequiredService<IEnumerable<ISubCommand>>()
.SelectMany(cmd => cmd.GetHandlers())
.Where(cmd => cmd.Key == "config")
.Select(cmd => cmd.Value)
.Single()
.Invoke("config");
}
=> _rootScope!.ServiceProvider.GetRequiredService<PalConfigCommand>().Execute();
private void LanguageChanged(string languageCode)
{