mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Platform.Storage;
|
|
|
|
namespace SourceGit.Views
|
|
{
|
|
public partial class RepositoryConfigure : ChromelessWindow
|
|
{
|
|
public RepositoryConfigure()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnClosing(WindowClosingEventArgs e)
|
|
{
|
|
base.OnClosing(e);
|
|
|
|
if (!Design.IsDesignMode && DataContext is ViewModels.RepositoryConfigure configure)
|
|
configure.Save();
|
|
}
|
|
|
|
private async void SelectExecutableForCustomAction(object sender, RoutedEventArgs e)
|
|
{
|
|
var options = new FilePickerOpenOptions()
|
|
{
|
|
FileTypeFilter = [new FilePickerFileType("Executable file(script)") { Patterns = ["*.*"] }],
|
|
AllowMultiple = false,
|
|
};
|
|
|
|
var selected = await StorageProvider.OpenFilePickerAsync(options);
|
|
if (selected.Count == 1 && sender is Button { DataContext: Models.CustomAction action })
|
|
action.Executable = selected[0].Path.LocalPath;
|
|
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
}
|