-
Notifications
You must be signed in to change notification settings - Fork 315
add DuplicateCustomAction( #1632) #1634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,23 @@ public record CustomActionTargetFile(string File, Commit Revision); | |
|
|
||
| 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; | ||
|
|
@@ -64,6 +81,24 @@ public bool BoolValue | |
|
|
||
| public class CustomAction : ObservableObject | ||
| { | ||
| public CustomAction() | ||
| { | ||
| } | ||
|
|
||
| public CustomAction(CustomAction action) | ||
| { | ||
| if (action != null) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that you can assume that reference will not be |
||
| { | ||
| 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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -259,6 +259,16 @@ public CustomAction AddNewCustomAction() | |
| return act; | ||
| } | ||
|
|
||
| public CustomAction DuplicateCustomAction(CustomAction baseAct) | ||
| { | ||
| var act = new CustomAction(baseAct) | ||
| { | ||
| Name = baseAct.Name + " - (Copy)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be localizable |
||
| }; | ||
| CustomActions.Add(act); | ||
| return act; | ||
| } | ||
|
|
||
| public void RemoveCustomAction(CustomAction act) | ||
| { | ||
| if (act != null) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -455,6 +455,22 @@ private void OnRemoveSelectedCustomAction(object sender, RoutedEventArgs e) | |
| e.Handled = true; | ||
| } | ||
|
|
||
| private void OnDuplicateSelectedCustomAction(object sender, RoutedEventArgs e) | ||
| { | ||
| if (SelectedCustomAction == null) | ||
| return; | ||
|
|
||
| var action = new Models.CustomAction(SelectedCustomAction) | ||
| { | ||
| Name = SelectedCustomAction.Name + " - (Copy)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be localizable |
||
| }; | ||
|
|
||
| ViewModels.Preferences.Instance.CustomActions.Add(action); | ||
| SelectedCustomAction = action; | ||
|
|
||
| e.Handled = true; | ||
| } | ||
|
|
||
| private void OnMoveSelectedCustomActionUp(object sender, RoutedEventArgs e) | ||
| { | ||
| if (SelectedCustomAction == null) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that you can assume that reference will not be
null