* Implementing SSH (changes from ap/ssh branch). * Implemented opening links in the last active window. * Using settings to determine where to open link (tab or window). * Adding FluentTerminal.App_TemporaryKey.pfx back to repo, to solve bug with keys. * App activation on mosh schema launching; mosh protocol parsing. (#35) * SSH handling changed to improve links. * Creating shortcuts from SSH dialog. * Trivial Mosh checkbox label fix It's "Mosh" not "MOSH". * Obtain mosh key from ssh connection (#40) * Prepopulate SSH username with Windows username (#50) * Undoing Max's mosh authentication changes. * Adding the new mosh wrapper. * Request user name from tray process (#51) * Mosh implemented, but still doesn't work (cannot find mosh.exe). * Add New Remote Shell menu; Rename New Tab into New Local Shell (#52) * Mosh works like charm. * Mosh wrapper improved to print an error. * Changing mosh wrapper to always exit with 0 (to ensure that the tab gets closed). * Changing mosh wrapper again to return error codes. * Slightly optimizing getting the username. * Saving links improved. * Fixed an issue in mosh wrapper, related to mosh to hostname. * mosh-client.exe updated with 32 bit version for x86 platform (#59) * Set line endings for remote shell connection; Left focus on SSH info dialog if input validation error occured; Update DataContext object on each key entered into target host text box control. * Simplifying SSH dialog. * Fixing some leftovers after merging. * Fixing some after-merge issues. * Avoiding some unintentional upstream changes. * Fix review findings
81 lines
2.9 KiB
C#
81 lines
2.9 KiB
C#
using FluentTerminal.App.Services.Dialogs;
|
|
using FluentTerminal.Models;
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace FluentTerminal.App.Services.Implementation
|
|
{
|
|
public class DialogService : IDialogService
|
|
{
|
|
private readonly Func<IShellProfileSelectionDialog> _shellProfileSelectionDialogFactory;
|
|
private readonly Func<IMessageDialog> _messageDialogFactory;
|
|
private readonly Func<ICreateKeyBindingDialog> _createKeyBindingDialogFactory;
|
|
private readonly Func<IInputDialog> _inputDialogFactory;
|
|
private readonly Func<ISshConnectionInfoDialog> _sshConnectionInfoDialogFactory;
|
|
|
|
public DialogService(Func<IShellProfileSelectionDialog> shellProfileSelectionDialogFactory,
|
|
Func<IMessageDialog> messageDialogFactory, Func<ICreateKeyBindingDialog> createKeyBindingDialogFactory,
|
|
Func<IInputDialog> inputDialogFactory, Func<ISshConnectionInfoDialog> sshConnectionInfoDialogFactory)
|
|
{
|
|
_shellProfileSelectionDialogFactory = shellProfileSelectionDialogFactory;
|
|
_messageDialogFactory = messageDialogFactory;
|
|
_createKeyBindingDialogFactory = createKeyBindingDialogFactory;
|
|
_inputDialogFactory = inputDialogFactory;
|
|
_sshConnectionInfoDialogFactory = sshConnectionInfoDialogFactory;
|
|
}
|
|
|
|
public Task<KeyBinding> ShowCreateKeyBindingDialog()
|
|
{
|
|
var dialog = _createKeyBindingDialogFactory();
|
|
|
|
return dialog.CreateKeyBinding();
|
|
}
|
|
|
|
public Task<DialogButton> ShowMessageDialogAsnyc(string title, string content, params DialogButton[] buttons)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(title))
|
|
{
|
|
throw new ArgumentNullException(nameof(title));
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(content))
|
|
{
|
|
throw new ArgumentNullException(nameof(content));
|
|
}
|
|
|
|
if (buttons.Length == 0)
|
|
{
|
|
throw new ArgumentException("Must not be empty", nameof(buttons));
|
|
}
|
|
|
|
var dialog = _messageDialogFactory();
|
|
dialog.Content = content;
|
|
dialog.Title = title;
|
|
|
|
foreach (var button in buttons)
|
|
{
|
|
dialog.AddButton(button);
|
|
}
|
|
|
|
return dialog.ShowAsync();
|
|
}
|
|
|
|
public Task<string> ShowInputDialogAsync(string title)
|
|
{
|
|
var dialog = _inputDialogFactory.Invoke();
|
|
dialog.SetTitle(title);
|
|
|
|
return dialog.GetInput();
|
|
}
|
|
|
|
public Task<ShellProfile> ShowProfileSelectionDialogAsync()
|
|
{
|
|
var dialog = _shellProfileSelectionDialogFactory();
|
|
|
|
return dialog.SelectProfile();
|
|
}
|
|
|
|
public Task<ISshConnectionInfo> ShowSshConnectionInfoDialogAsync(ISshConnectionInfo input = null) =>
|
|
_sshConnectionInfoDialogFactory().GetSshConnectionInfoAsync(input);
|
|
}
|
|
} |