diff --git a/src/Models/CustomAction.cs b/src/Models/CustomAction.cs
index 1ed65b8b3..42da53769 100644
--- a/src/Models/CustomAction.cs
+++ b/src/Models/CustomAction.cs
@@ -21,6 +21,23 @@ public enum CustomActionControlType
public class CustomActionControl : ObservableObject
{
+ public CustomActionControl()
+ {
+ }
+
+ public CustomActionControl(CustomActionControl cac)
+ {
+ if (cac != null)
+ {
+ Type = cac.Type;
+ Description = cac.Description;
+ Label = cac.Label;
+ Description = cac.Description;
+ StringValue = cac.StringValue;
+ BoolValue = cac.BoolValue;
+ }
+ }
+
public CustomActionControlType Type
{
get => _type;
@@ -60,6 +77,24 @@ public bool BoolValue
public class CustomAction : ObservableObject
{
+ public CustomAction()
+ {
+ }
+
+ public CustomAction(CustomAction action)
+ {
+ if (action != null)
+ {
+ Name = action.Name;
+ Scope = action.Scope;
+ Executable = action.Executable;
+ Arguments = action.Arguments;
+ WaitForExit = action.WaitForExit;
+ foreach (var control in action.Controls)
+ Controls.Add(new CustomActionControl(control));
+ }
+ }
+
public string Name
{
get => _name;
diff --git a/src/Models/RepositorySettings.cs b/src/Models/RepositorySettings.cs
index c19fa21e2..9b5b4b56b 100644
--- a/src/Models/RepositorySettings.cs
+++ b/src/Models/RepositorySettings.cs
@@ -410,6 +410,16 @@ public CustomAction AddNewCustomAction()
return act;
}
+ public CustomAction DuplicateCustomAction(CustomAction baseAct)
+ {
+ var act = new CustomAction(baseAct)
+ {
+ Name = baseAct.Name + "(Duplicated)"
+ };
+ CustomActions.Add(act);
+ return act;
+ }
+
public void RemoveCustomAction(CustomAction act)
{
if (act != null)
diff --git a/src/ViewModels/RepositoryConfigure.cs b/src/ViewModels/RepositoryConfigure.cs
index 738167ecb..6a628d8be 100644
--- a/src/ViewModels/RepositoryConfigure.cs
+++ b/src/ViewModels/RepositoryConfigure.cs
@@ -238,6 +238,11 @@ public void RemoveSelectedCustomAction()
SelectedCustomAction = null;
}
+ public void DuplicateSelectedCustomAction()
+ {
+ SelectedCustomAction = _repo.Settings.DuplicateCustomAction(_selectedCustomAction);
+ }
+
public void MoveSelectedCustomActionUp()
{
if (_selectedCustomAction != null)
diff --git a/src/Views/Preferences.axaml b/src/Views/Preferences.axaml
index 39055dfe3..01bdcf815 100644
--- a/src/Views/Preferences.axaml
+++ b/src/Views/Preferences.axaml
@@ -595,7 +595,7 @@
-
+
-
+
-
-
+
-
+
-