feature: support to use input control in custom action

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-06-25 16:28:54 +08:00
parent a8803ca188
commit 676785f8b1
No known key found for this signature in database
26 changed files with 659 additions and 56 deletions

View file

@ -1,4 +1,5 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Avalonia.Collections;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.Models
{
@ -9,6 +10,52 @@ namespace SourceGit.Models
Branch,
}
public enum CustomActionControlType
{
TextBox = 0,
PathSelector,
CheckBox,
}
public class CustomActionControl : ObservableObject
{
public CustomActionControlType Type
{
get => _type;
set => SetProperty(ref _type, value);
}
public string Label
{
get => _label;
set => SetProperty(ref _label, value);
}
public string Description
{
get => _description;
set => SetProperty(ref _description, value);
}
public string StringValue
{
get => _stringValue;
set => SetProperty(ref _stringValue, value);
}
public bool BoolValue
{
get => _boolValue;
set => SetProperty(ref _boolValue, value);
}
private CustomActionControlType _type = CustomActionControlType.TextBox;
private string _label = string.Empty;
private string _description = string.Empty;
private string _stringValue = string.Empty;
private bool _boolValue = false;
}
public class CustomAction : ObservableObject
{
public string Name
@ -35,6 +82,12 @@ namespace SourceGit.Models
set => SetProperty(ref _arguments, value);
}
public AvaloniaList<CustomActionControl> Controls
{
get;
set;
} = [];
public bool WaitForExit
{
get => _waitForExit;