forked from gitextensions/gitextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormPuttyError.cs
40 lines (36 loc) · 1.25 KB
/
FormPuttyError.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Diagnostics.CodeAnalysis;
using System.Windows.Forms;
namespace GitUI
{
/// <summary>
/// A form that explains that the command needed authentication, and offers to load a private key.
/// </summary>
public partial class FormPuttyError : GitExtensionsForm
{
/// <summary>Shows the "SSH error" dialog modally, and returns the path to the key, if one was loaded.</summary>
public static bool AskForKey(IWin32Window parent, [NotNullWhen(returnValue: true)] out string? keyPath)
{
using FormPuttyError form = new();
var result = form.ShowDialog(parent);
keyPath = form.KeyPath;
return result == DialogResult.Retry;
}
public string? KeyPath { get; private set; }
public FormPuttyError()
{
InitializeComponent();
InitializeComplete();
}
private void LoadSSHKey_Click(object sender, EventArgs e)
{
var pathLoaded = BrowseForPrivateKey.BrowseAndLoad(this);
if (!string.IsNullOrEmpty(pathLoaded))
{
KeyPath = pathLoaded;
DialogResult = DialogResult.Retry;
Close();
}
}
}
}