-
Notifications
You must be signed in to change notification settings - Fork 385
Expand file tree
/
Copy pathAddRemote.axaml.cs
More file actions
33 lines (28 loc) · 897 Bytes
/
AddRemote.axaml.cs
File metadata and controls
33 lines (28 loc) · 897 Bytes
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
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
namespace SourceGit.Views
{
public partial class AddRemote : UserControl
{
public AddRemote()
{
InitializeComponent();
}
private async void SelectSSHKey(object _, RoutedEventArgs e)
{
var toplevel = TopLevel.GetTopLevel(this);
if (toplevel == null)
return;
var options = new FilePickerOpenOptions()
{
AllowMultiple = false,
FileTypeFilter = [new FilePickerFileType("SSHKey") { Patterns = ["*.*"] }]
};
var selected = await toplevel.StorageProvider.OpenFilePickerAsync(options);
if (selected.Count == 1)
TxtSshKey.Text = selected[0].Path.LocalPath;
e.Handled = true;
}
}
}