mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 21:24:59 +00:00
feature: supports custom actions (#638)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
7c5de7e48c
commit
a36058ec51
17 changed files with 478 additions and 2 deletions
|
@ -1,4 +1,6 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
|
||||
namespace SourceGit.Views
|
||||
{
|
||||
|
@ -14,5 +16,20 @@ namespace SourceGit.Views
|
|||
(DataContext as ViewModels.RepositoryConfigure)?.Save();
|
||||
base.OnClosing(e);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue