sourcegit/src/Views/AddWorktree.axaml.cs

29 lines
776 B
C#
Raw Normal View History

2024-06-27 03:25:16 -07:00
using Avalonia.Controls;
using Avalonia.Interactivity;
using Avalonia.Platform.Storage;
namespace SourceGit.Views
{
public partial class AddWorktree : UserControl
{
public AddWorktree()
{
InitializeComponent();
}
2024-07-14 00:55:15 -07:00
private async void SelectLocation(object _, RoutedEventArgs e)
2024-06-27 03:25:16 -07:00
{
var toplevel = TopLevel.GetTopLevel(this);
if (toplevel == null)
return;
2024-07-14 00:55:15 -07:00
var options = new FolderPickerOpenOptions() { AllowMultiple = false };
2024-06-27 03:25:16 -07:00
var selected = await toplevel.StorageProvider.OpenFolderPickerAsync(options);
if (selected.Count == 1)
TxtLocation.Text = selected[0].Path.LocalPath;
e.Handled = true;
}
}
}