-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFormConfig.cs
371 lines (316 loc) · 14.7 KB
/
FormConfig.cs
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
using EZ_Builder.Config.Sub;
using EZ_Builder.Scripting;
using EZ_Builder.UCForms.UC;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace Sighthound_Face_Detection {
public class FormConfig : Form {
private PluginV1 _cf;
private IContainer components = null;
private UCScriptEditInput ucScriptEditInput1;
private UCHelpHover ucHelpHover1;
private GroupBox groupBox1;
private GroupBox groupBox2;
private Panel panel1;
private Button btnCancel;
private Button btnSave;
private UCHelpHover ucHelpHover2;
private TextBox tbVarBodyPosition;
private UCHelpHover ucHelpHover4;
private Label label2;
private TextBox tbVarGenderConfidence;
private Label label1;
private GroupBox groupBox3;
private TextBox tbAPIKey;
private Button button1;
private UCHelpHover ucHelpHover3;
private Label label3;
private TextBox tbVarGender;
private UCHelpHover ucHelpHover6;
private Label label5;
private TextBox tbVarFaceDetected;
private UCHelpHover ucHelpHover5;
private Label label4;
private TextBox tbVarPersonDetected;
public FormConfig() {
InitializeComponent();
}
public void SetConfiguration(PluginV1 cf) {
ucScriptEditInput1.Value = cf.STORAGE[ConfigTitles.SCRIPT_TXT].ToString();
ucScriptEditInput1.XML = cf.STORAGE[ConfigTitles.SCRIPT_XML].ToString();
tbVarBodyPosition.Text = cf.STORAGE[ConfigTitles.VARIABLE_BODY_POSITION].ToString();
tbVarGenderConfidence.Text = cf.STORAGE[ConfigTitles.VARIABLE_GENDER_CONFIDENCE].ToString();
tbVarGender.Text = cf.STORAGE[ConfigTitles.VARIABLE_GENDER].ToString();
tbVarPersonDetected.Text = cf.STORAGE[ConfigTitles.VARIABLE_PERSON_DETECTED].ToString();
tbVarFaceDetected.Text = cf.STORAGE[ConfigTitles.VARIABLE_FACE_DETECTED].ToString();
tbAPIKey.Text = cf.STORAGE[ConfigTitles.APIKey].ToString();
_cf = cf;
}
public PluginV1 GetConfiguration() {
_cf.STORAGE[ConfigTitles.SCRIPT_TXT] = ucScriptEditInput1.Value;
_cf.STORAGE[ConfigTitles.SCRIPT_XML] = ucScriptEditInput1.XML;
_cf.STORAGE[ConfigTitles.VARIABLE_BODY_POSITION] = tbVarBodyPosition.Text;
_cf.STORAGE[ConfigTitles.VARIABLE_GENDER_CONFIDENCE] = tbVarGenderConfidence.Text;
_cf.STORAGE[ConfigTitles.VARIABLE_GENDER] = tbVarGender.Text;
_cf.STORAGE[ConfigTitles.VARIABLE_FACE_DETECTED] = tbVarFaceDetected.Text;
_cf.STORAGE[ConfigTitles.VARIABLE_PERSON_DETECTED] = tbVarPersonDetected.Text;
_cf.STORAGE[ConfigTitles.APIKey] = tbAPIKey.Text.Trim();
return _cf;
}
private void btnSave_Click(object sender, EventArgs e) {
try {
VariableManager.IsVariableValid(tbVarFaceDetected.Text);
VariableManager.IsVariableValid(tbVarGender.Text);
VariableManager.IsVariableValid(tbVarPersonDetected.Text);
VariableManager.IsVariableValid(tbVarBodyPosition.Text);
VariableManager.IsVariableValid(tbVarGenderConfidence.Text);
} catch (Exception ex) {
MessageBox.Show(ex.Message);
return;
}
base.DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, EventArgs e) {
base.DialogResult = DialogResult.Cancel;
}
private void FormConfig_Load(object sender, EventArgs e) {
}
private void button1_Click(object sender, EventArgs e) {
Help.ShowHelp(this, "https://www.sighthound.com/products/cloud");
}
protected override void Dispose(bool disposing) {
if (disposing && components != null) {
components.Dispose();
}
base.Dispose(disposing);
}
private void InitializeComponent() {
ucScriptEditInput1 = new EZ_Builder.UCForms.UC.UCScriptEditInput();
ucHelpHover1 = new EZ_Builder.UCForms.UC.UCHelpHover();
groupBox1 = new System.Windows.Forms.GroupBox();
groupBox2 = new System.Windows.Forms.GroupBox();
ucHelpHover4 = new EZ_Builder.UCForms.UC.UCHelpHover();
label2 = new System.Windows.Forms.Label();
tbVarGenderConfidence = new System.Windows.Forms.TextBox();
label1 = new System.Windows.Forms.Label();
ucHelpHover2 = new EZ_Builder.UCForms.UC.UCHelpHover();
tbVarBodyPosition = new System.Windows.Forms.TextBox();
panel1 = new System.Windows.Forms.Panel();
btnCancel = new System.Windows.Forms.Button();
btnSave = new System.Windows.Forms.Button();
groupBox3 = new System.Windows.Forms.GroupBox();
tbAPIKey = new System.Windows.Forms.TextBox();
button1 = new System.Windows.Forms.Button();
ucHelpHover3 = new EZ_Builder.UCForms.UC.UCHelpHover();
label3 = new System.Windows.Forms.Label();
tbVarGender = new System.Windows.Forms.TextBox();
ucHelpHover5 = new EZ_Builder.UCForms.UC.UCHelpHover();
label4 = new System.Windows.Forms.Label();
tbVarPersonDetected = new System.Windows.Forms.TextBox();
ucHelpHover6 = new EZ_Builder.UCForms.UC.UCHelpHover();
label5 = new System.Windows.Forms.Label();
tbVarFaceDetected = new System.Windows.Forms.TextBox();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
panel1.SuspendLayout();
groupBox3.SuspendLayout();
SuspendLayout();
ucScriptEditInput1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
ucScriptEditInput1.Location = new System.Drawing.Point(41, 31);
ucScriptEditInput1.Margin = new System.Windows.Forms.Padding(0);
ucScriptEditInput1.Name = "ucScriptEditInput1";
ucScriptEditInput1.Size = new System.Drawing.Size(446, 20);
ucScriptEditInput1.TabIndex = 0;
ucScriptEditInput1.Text = "ucScriptEditInput1";
ucScriptEditInput1.Value = "ucScriptEditInput1";
ucScriptEditInput1.XML = "";
ucHelpHover1.Location = new System.Drawing.Point(12, 31);
ucHelpHover1.Margin = new System.Windows.Forms.Padding(0);
ucHelpHover1.Name = "ucHelpHover1";
ucHelpHover1.SetHelpText = "This script will execute with the result of detecting a scene";
ucHelpHover1.Size = new System.Drawing.Size(20, 20);
ucHelpHover1.TabIndex = 1;
groupBox1.Controls.Add(ucScriptEditInput1);
groupBox1.Controls.Add(ucHelpHover1);
groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
groupBox1.Location = new System.Drawing.Point(0, 46);
groupBox1.Name = "groupBox1";
groupBox1.Size = new System.Drawing.Size(524, 78);
groupBox1.TabIndex = 2;
groupBox1.TabStop = false;
groupBox1.Text = "Script";
groupBox2.Controls.Add(ucHelpHover6);
groupBox2.Controls.Add(label5);
groupBox2.Controls.Add(tbVarFaceDetected);
groupBox2.Controls.Add(ucHelpHover5);
groupBox2.Controls.Add(label4);
groupBox2.Controls.Add(tbVarPersonDetected);
groupBox2.Controls.Add(ucHelpHover3);
groupBox2.Controls.Add(label3);
groupBox2.Controls.Add(tbVarGender);
groupBox2.Controls.Add(ucHelpHover4);
groupBox2.Controls.Add(label2);
groupBox2.Controls.Add(tbVarGenderConfidence);
groupBox2.Controls.Add(label1);
groupBox2.Controls.Add(ucHelpHover2);
groupBox2.Controls.Add(tbVarBodyPosition);
groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
groupBox2.Location = new System.Drawing.Point(0, 124);
groupBox2.Name = "groupBox2";
groupBox2.Size = new System.Drawing.Size(524, 171);
groupBox2.TabIndex = 3;
groupBox2.TabStop = false;
groupBox2.Text = "Variables";
ucHelpHover4.Location = new System.Drawing.Point(12, 58);
ucHelpHover4.Margin = new System.Windows.Forms.Padding(0);
ucHelpHover4.Name = "ucHelpHover4";
ucHelpHover4.SetHelpText = "This variable will store the percentage of confidence";
ucHelpHover4.Size = new System.Drawing.Size(20, 20);
ucHelpHover4.TabIndex = 6;
label2.Location = new System.Drawing.Point(41, 58);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(182, 23);
label2.TabIndex = 5;
label2.Text = "Gender Confidence";
label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
tbVarGenderConfidence.Location = new System.Drawing.Point(229, 58);
tbVarGenderConfidence.Name = "tbVariableConfidence";
tbVarGenderConfidence.Size = new System.Drawing.Size(203, 20);
tbVarGenderConfidence.TabIndex = 4;
label1.Location = new System.Drawing.Point(41, 30);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(182, 23);
label1.TabIndex = 3;
label1.Text = "Detected Body Position";
label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
ucHelpHover2.Location = new System.Drawing.Point(12, 30);
ucHelpHover2.Margin = new System.Windows.Forms.Padding(0);
ucHelpHover2.Name = "ucHelpHover2";
ucHelpHover2.SetHelpText = "This variable will store the detected scene description";
ucHelpHover2.Size = new System.Drawing.Size(20, 20);
ucHelpHover2.TabIndex = 2;
tbVarBodyPosition.Location = new System.Drawing.Point(229, 30);
tbVarBodyPosition.Name = "tbVariable";
tbVarBodyPosition.Size = new System.Drawing.Size(203, 20);
tbVarBodyPosition.TabIndex = 0;
panel1.Controls.Add(btnCancel);
panel1.Controls.Add(btnSave);
panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
panel1.Location = new System.Drawing.Point(0, 295);
panel1.Name = "panel1";
panel1.Size = new System.Drawing.Size(524, 56);
panel1.TabIndex = 4;
btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
btnCancel.Location = new System.Drawing.Point(103, 6);
btnCancel.Name = "btnCancel";
btnCancel.Size = new System.Drawing.Size(86, 41);
btnCancel.TabIndex = 1;
btnCancel.Text = "Cancel";
btnCancel.UseVisualStyleBackColor = true;
btnCancel.Click += new System.EventHandler(btnCancel_Click);
btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
btnSave.Location = new System.Drawing.Point(12, 6);
btnSave.Name = "btnSave";
btnSave.Size = new System.Drawing.Size(75, 41);
btnSave.TabIndex = 0;
btnSave.Text = "Save";
btnSave.UseVisualStyleBackColor = true;
btnSave.Click += new System.EventHandler(btnSave_Click);
groupBox3.Controls.Add(tbAPIKey);
groupBox3.Controls.Add(button1);
groupBox3.Dock = System.Windows.Forms.DockStyle.Top;
groupBox3.Location = new System.Drawing.Point(0, 0);
groupBox3.Name = "groupBox3";
groupBox3.Size = new System.Drawing.Size(524, 46);
groupBox3.TabIndex = 5;
groupBox3.TabStop = false;
groupBox3.Text = "API Key";
tbAPIKey.Dock = System.Windows.Forms.DockStyle.Fill;
tbAPIKey.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0);
tbAPIKey.Location = new System.Drawing.Point(3, 16);
tbAPIKey.Name = "tbAPIKey";
tbAPIKey.Size = new System.Drawing.Size(443, 22);
tbAPIKey.TabIndex = 1;
button1.Dock = System.Windows.Forms.DockStyle.Right;
button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
button1.Location = new System.Drawing.Point(446, 16);
button1.Name = "button1";
button1.Size = new System.Drawing.Size(75, 27);
button1.TabIndex = 0;
button1.Text = "Get Key";
button1.UseVisualStyleBackColor = true;
button1.Click += new System.EventHandler(button1_Click);
ucHelpHover3.Location = new System.Drawing.Point(12, 84);
ucHelpHover3.Margin = new System.Windows.Forms.Padding(0);
ucHelpHover3.Name = "ucHelpHover3";
ucHelpHover3.SetHelpText = "This variable will store the percentage of confidence";
ucHelpHover3.Size = new System.Drawing.Size(20, 20);
ucHelpHover3.TabIndex = 9;
label3.Location = new System.Drawing.Point(41, 84);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(182, 23);
label3.TabIndex = 8;
label3.Text = "Gender";
label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
tbVarGender.Location = new System.Drawing.Point(229, 84);
tbVarGender.Name = "textBox1";
tbVarGender.Size = new System.Drawing.Size(203, 20);
tbVarGender.TabIndex = 7;
ucHelpHover5.Location = new System.Drawing.Point(12, 110);
ucHelpHover5.Margin = new System.Windows.Forms.Padding(0);
ucHelpHover5.Name = "ucHelpHover5";
ucHelpHover5.SetHelpText = "This variable will store the percentage of confidence";
ucHelpHover5.Size = new System.Drawing.Size(20, 20);
ucHelpHover5.TabIndex = 12;
label4.Location = new System.Drawing.Point(41, 110);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(182, 23);
label4.TabIndex = 11;
label4.Text = "Person Detected";
label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
tbVarPersonDetected.Location = new System.Drawing.Point(229, 110);
tbVarPersonDetected.Name = "textBox2";
tbVarPersonDetected.Size = new System.Drawing.Size(203, 20);
tbVarPersonDetected.TabIndex = 10;
ucHelpHover6.Location = new System.Drawing.Point(12, 136);
ucHelpHover6.Margin = new System.Windows.Forms.Padding(0);
ucHelpHover6.Name = "ucHelpHover6";
ucHelpHover6.SetHelpText = "This variable will store the percentage of confidence";
ucHelpHover6.Size = new System.Drawing.Size(20, 20);
ucHelpHover6.TabIndex = 15;
label5.Location = new System.Drawing.Point(41, 136);
label5.Name = "label5";
label5.Size = new System.Drawing.Size(182, 23);
label5.TabIndex = 14;
label5.Text = "Face Detected";
label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
tbVarFaceDetected.Location = new System.Drawing.Point(229, 136);
tbVarFaceDetected.Name = "textBox3";
tbVarFaceDetected.Size = new System.Drawing.Size(203, 20);
tbVarFaceDetected.TabIndex = 13;
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.White;
base.ClientSize = new System.Drawing.Size(524, 351);
base.Controls.Add(groupBox2);
base.Controls.Add(panel1);
base.Controls.Add(groupBox1);
base.Controls.Add(groupBox3);
base.MaximizeBox = false;
base.MinimizeBox = false;
base.Name = "FormConfig";
base.ShowIcon = false;
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
Text = "Config";
base.Load += new System.EventHandler(FormConfig_Load);
groupBox1.ResumeLayout(false);
groupBox2.ResumeLayout(false);
groupBox2.PerformLayout();
panel1.ResumeLayout(false);
groupBox3.ResumeLayout(false);
groupBox3.PerformLayout();
ResumeLayout(false);
}
}
}