PalacePal/Pal.Client/Commands/PalTestConnectionCommand.cs

31 lines
823 B
C#
Raw Normal View History

2023-02-24 23:55:48 +00:00
using System;
using System.Collections.Generic;
using ECommons.Schedulers;
using Pal.Client.Windows;
namespace Pal.Client.Commands
{
2023-02-24 23:55:48 +00:00
internal sealed class PalTestConnectionCommand : ISubCommand
{
private readonly ConfigWindow _configWindow;
public PalTestConnectionCommand(ConfigWindow configWindow)
{
_configWindow = configWindow;
}
2023-02-24 23:55:48 +00:00
public IReadOnlyDictionary<string, Action<string>> GetHandlers()
=> new Dictionary<string, Action<string>>
{
{ "test-connection", _ => Execute() },
{ "tc", _ => Execute() },
};
private void Execute()
{
_configWindow.IsOpen = true;
var _ = new TickScheduler(() => _configWindow.TestConnection());
}
}
}