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
26 changed files with 659 additions and 56 deletions

View File

@@ -819,17 +819,34 @@ namespace SourceGit.ViewModels
}
public void ApplyPatch()
{
if (CanCreatePopup())
ShowPopup(new Apply(this));
}
public void ExecCustomAction(Models.CustomAction action, object scope)
{
if (!CanCreatePopup())
return;
ShowPopup(new Apply(this));
var popup = null as ExecuteCustomAction;
if (scope is Models.Branch b)
popup = new ExecuteCustomAction(this, action, b);
else if (scope is Models.Commit c)
popup = new ExecuteCustomAction(this, action, c);
else
popup = new ExecuteCustomAction(this, action);
if (action.Controls.Count == 0)
ShowAndStartPopup(popup);
else
ShowPopup(popup);
}
public void Cleanup()
{
if (!CanCreatePopup())
return;
ShowAndStartPopup(new Cleanup(this));
if (CanCreatePopup())
ShowAndStartPopup(new Cleanup(this));
}
public void ClearFilter()
@@ -1706,9 +1723,7 @@ namespace SourceGit.ViewModels
item.Header = dup.Name;
item.Click += (_, e) =>
{
if (CanCreatePopup())
ShowAndStartPopup(new ExecuteCustomAction(this, dup));
ExecCustomAction(dup, null);
e.Handled = true;
};
@@ -2805,9 +2820,7 @@ namespace SourceGit.ViewModels
item.Header = dup.Name;
item.Click += (_, e) =>
{
if (CanCreatePopup())
ShowAndStartPopup(new ExecuteCustomAction(this, dup, branch));
ExecCustomAction(dup, branch);
e.Handled = true;
};