sourcegit/src/Views/AddRemote.axaml.cs

34 lines
897 B
C#
Raw Normal View History

using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
namespace SourceGit.Views
{
public partial class AddRemote : UserControl
{
public AddRemote()
{
InitializeComponent();
}
2024-07-14 00:55:15 -07:00
private async void SelectSSHKey(object _, RoutedEventArgs e)
{
var toplevel = TopLevel.GetTopLevel(this);
2024-07-14 00:55:15 -07:00
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)
2024-07-14 00:55:15 -07:00
TxtSshKey.Text = selected[0].Path.LocalPath;
e.Handled = true;
}
}
}