PalacePal/Pal.Client/Commands/PalConfigCommand.cs

40 lines
1.0 KiB
C#
Raw Permalink Normal View History

2023-02-24 23:55:48 +00:00
using System;
using System.Collections.Generic;
using Pal.Client.Configuration;
using Pal.Client.Windows;
2023-03-30 20:01:43 +00:00
namespace Pal.Client.Commands;
2023-03-30 20:01:43 +00:00
internal class PalConfigCommand : ISubCommand
{
private readonly IPalacePalConfiguration _configuration;
private readonly AgreementWindow _agreementWindow;
private readonly ConfigWindow _configWindow;
2023-03-30 20:01:43 +00:00
public PalConfigCommand(
IPalacePalConfiguration configuration,
AgreementWindow agreementWindow,
ConfigWindow configWindow)
{
_configuration = configuration;
_agreementWindow = agreementWindow;
_configWindow = configWindow;
}
2023-02-24 23:55:48 +00:00
2023-03-30 20:01:43 +00:00
public IReadOnlyDictionary<string, Action<string>> GetHandlers()
=> new Dictionary<string, Action<string>>
{
2023-03-30 20:01:43 +00:00
{ "config", _ => Execute() },
{ "", _ => Execute() }
};
public void Execute()
{
if (_configuration.FirstUse)
_agreementWindow.IsOpen = true;
else
_configWindow.Toggle();
}
}