-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathCustomAction.cs
More file actions
144 lines (124 loc) · 3.5 KB
/
CustomAction.cs
File metadata and controls
144 lines (124 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
using Avalonia.Collections;
using CommunityToolkit.Mvvm.ComponentModel;
namespace SourceGit.Models
{
public enum CustomActionScope
{
Repository,
Commit,
Branch,
Tag,
Remote,
File,
}
public enum CustomActionControlType
{
TextBox = 0,
PathSelector,
CheckBox,
ComboBox,
}
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;
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 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;
set => SetProperty(ref _name, value);
}
public CustomActionScope Scope
{
get => _scope;
set => SetProperty(ref _scope, value);
}
public string Executable
{
get => _executable;
set => SetProperty(ref _executable, value);
}
public string Arguments
{
get => _arguments;
set => SetProperty(ref _arguments, value);
}
public AvaloniaList<CustomActionControl> Controls
{
get;
set;
} = [];
public bool WaitForExit
{
get => _waitForExit;
set => SetProperty(ref _waitForExit, value);
}
private string _name = string.Empty;
private CustomActionScope _scope = CustomActionScope.Repository;
private string _executable = string.Empty;
private string _arguments = string.Empty;
private bool _waitForExit = true;
}
}