2023-02-24 23:55:48 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using ECommons.Schedulers;
|
2023-02-18 03:34:49 +00:00
|
|
|
|
using Pal.Client.Windows;
|
|
|
|
|
|
|
|
|
|
namespace Pal.Client.Commands
|
|
|
|
|
{
|
2023-02-24 23:55:48 +00:00
|
|
|
|
internal sealed class PalTestConnectionCommand : ISubCommand
|
2023-02-18 03:34:49 +00:00
|
|
|
|
{
|
|
|
|
|
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()
|
2023-02-18 03:34:49 +00:00
|
|
|
|
{
|
2023-02-25 00:06:33 +00:00
|
|
|
|
_configWindow.IsOpen = true;
|
2023-02-18 03:34:49 +00:00
|
|
|
|
var _ = new TickScheduler(() => _configWindow.TestConnection());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|