mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
29 lines
781 B
C#
29 lines
781 B
C#
|
using Avalonia.Controls;
|
||
|
using Avalonia.Interactivity;
|
||
|
using Avalonia.Platform.Storage;
|
||
|
|
||
|
namespace SourceGit.Views
|
||
|
{
|
||
|
public partial class AddWorktree : UserControl
|
||
|
{
|
||
|
public AddWorktree()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
private async void SelectLocation(object sender, RoutedEventArgs e)
|
||
|
{
|
||
|
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
|
||
|
var toplevel = TopLevel.GetTopLevel(this);
|
||
|
if (toplevel == null)
|
||
|
return;
|
||
|
|
||
|
var selected = await toplevel.StorageProvider.OpenFolderPickerAsync(options);
|
||
|
if (selected.Count == 1)
|
||
|
TxtLocation.Text = selected[0].Path.LocalPath;
|
||
|
|
||
|
e.Handled = true;
|
||
|
}
|
||
|
}
|
||
|
}
|