Skip to content

Commit 4735aac

Browse files
committed
Adding new interval between attempts field in model and view for reactiontest
1 parent 2c918fc commit 4735aac

File tree

7 files changed

+1408
-643
lines changed

7 files changed

+1408
-643
lines changed

StroopTest/Models/Tests/Reaction/ReactionProgram.cs

+21-12
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class ReactionProgram : Program
2020
private Boolean hasColorList; // [23]
2121
private int fontSize; // [24]
2222
private bool sstInterval; // interval calculated according to stop signal test
23-
24-
private static Int32 ELEMENTS = 26; //quantity of fields used in ReactionProgram
23+
private int intervalBetweenAttempts;
24+
private static Int32 ELEMENTS = 27; //quantity of fields used in ReactionProgram
2525

2626
public ReactionProgram()
2727
{
@@ -47,7 +47,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
4747
bool isBeeping, int beepDuration, string stimulusColor,
4848
string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom,
4949
string stimuluShape, bool beepRandom, int numberPositions,
50-
string responseType, string colorList, bool hasColorList, bool sstInterval)
50+
string responseType, string colorList, bool hasColorList, bool sstInterval, int intervalBetweenAttempts)
5151
{
5252
// ReactionProgram properties
5353
this.expositionType = "shapes";
@@ -60,7 +60,8 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
6060
this.NumberPositions = numberPositions;
6161
this.hasColorList = hasColorList;
6262
this.SstInterval = sstInterval;
63-
63+
this.intervalBetweenAttempts = intervalBetweenAttempts;
64+
6465
if(!hasColorList)
6566
{
6667
this.stimulusColor = stimulusColor;
@@ -98,7 +99,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
9899
bool isBeeping, int beepDuration, string stimulusColor,
99100
string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom,
100101
bool beepRandom, int numberPositions, string responseType,
101-
string wordList, bool expositionRandom, string colorList, bool hasColorList, int fontSize, bool sstInterval)
102+
string wordList, bool expositionRandom, string colorList, bool hasColorList, int fontSize, bool sstInterval, int intervalBetweenAttempts)
102103
{
103104
// ReactionProgram properties
104105
this.expositionType = "words";
@@ -113,6 +114,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
113114
this.setWordListFile(wordList);
114115
this.hasColorList = hasColorList;
115116
this.SstInterval = sstInterval;
117+
this.intervalBetweenAttempts = intervalBetweenAttempts;
116118

117119
if (!hasColorList)
118120
{
@@ -151,7 +153,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
151153
bool isBeeping, int beepDuration,
152154
string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom,
153155
string imageList, bool beepRandom, int numberPositions,
154-
string responseType, bool isExpositionRandom, bool expandImage, bool sstInterval)
156+
string responseType, bool isExpositionRandom, bool expandImage, bool sstInterval, int intervalBetweenAttempts)
155157
{
156158
// ReactionProgram properties
157159
this.expositionType = "images";
@@ -166,6 +168,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
166168
this.hasColorList = false;
167169
this.ExpandImage = expandImage;
168170
this.SstInterval = sstInterval;
171+
this.intervalBetweenAttempts = intervalBetweenAttempts;
169172

170173
//default configurations for first version of ReactionProgram
171174
this.setAudioListFile("false");
@@ -193,7 +196,8 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
193196
bool isBeeping, int beepDuration,
194197
string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom,
195198
string imageList, string wordList, string colorList, bool beepRandom, int numberPositions,
196-
bool hasColorList, string responseType, bool isExpositionRandom, string stimulusColor, int fontSize, bool expandImage, bool sstInterval)
199+
bool hasColorList, string responseType, bool isExpositionRandom, string stimulusColor, int fontSize, bool expandImage, bool sstInterval,
200+
int intervalBetweenAttempts)
197201
{
198202

199203
// ReactionProgram properties
@@ -209,6 +213,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
209213
this.FontSize = fontSize;
210214
this.ExpandImage = expandImage;
211215
this.SstInterval = sstInterval;
216+
this.intervalBetweenAttempts = intervalBetweenAttempts;
212217

213218
if (!hasColorList)
214219
{
@@ -246,7 +251,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
246251
string stimulusColor,
247252
string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom, int numberPositions,
248253
string responseType, string colorList, bool hasColorList, bool isExpositionRandom,int fontSize, string audioListFile, string wordListFile,
249-
bool sstInterval)
254+
bool sstInterval, int intervalBetweenAttempts)
250255
{
251256

252257
// ReactionProgram properties
@@ -258,6 +263,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
258263

259264
this.ResponseType = responseType;
260265
this.NumberPositions = numberPositions;
266+
this.intervalBetweenAttempts = intervalBetweenAttempts;
261267
this.hasColorList = hasColorList;
262268
if (!hasColorList)
263269
{
@@ -296,7 +302,8 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
296302
/// </summary>
297303
public ReactionProgram(string programName, int expositionTime, int numExpositions, int intervalTime,
298304
string fixPoint, string backgroundColor, string fixPointColor, bool intervalTimeRandom, int numberPositions,
299-
string responseType, double stimulusSize, bool isExpositionRandom,string audioListFile, string imageListFile, bool expandImage, bool sstInterval)
305+
string responseType, double stimulusSize, bool isExpositionRandom,string audioListFile, string imageListFile, bool expandImage, bool sstInterval,
306+
int intervalBetweenAttempts)
300307
{
301308

302309
// ReactionProgram properties
@@ -308,7 +315,7 @@ public ReactionProgram(string programName, int expositionTime, int numExposition
308315
this.ResponseType = responseType;
309316
this.NumberPositions = numberPositions;
310317
this.ExpandImage = expandImage;
311-
318+
this.intervalBetweenAttempts = intervalBetweenAttempts;
312319
//default configurations for image with audio version of ReactionProgram
313320
this.fontSize = 10;
314321
this.setColorListFile("false");
@@ -577,9 +584,10 @@ public string data()
577584
this.ResponseType + " " +
578585
this.ExpositionRandom.ToString() + " " +
579586
this.hasColorList.ToString() + " " +
580-
this.FontSize + " " +
587+
this.FontSize + " " +
581588
this.ExpandImage + " " +
582-
this.SstInterval;
589+
this.SstInterval + " " +
590+
this.intervalBetweenAttempts.ToString();
583591
return data;
584592
}
585593

@@ -635,6 +643,7 @@ public void readProgramFile(string filepath)
635643
FontSize = int.Parse(config[23]);
636644
expandImage = bool.Parse(config[24]);
637645
SstInterval = bool.Parse(config[25]);
646+
intervalBetweenAttempts = int.Parse(config[26]);
638647

639648
string[] linesInstruction = File.ReadAllLines(filepath);
640649
if (linesInstruction.Length > 1) // read instructions if any

StroopTest/Resources/Localizations/LocalizedResources.en-US.resx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1026,7 +1026,7 @@ To upgrade, the new version installation file must be run in the same folder as
10261026
<value>#F8E000 #007BB7 #7EC845 #D01C1F</value>
10271027
</data>
10281028
<data name="defaultReactionProgram" xml:space="preserve">
1029-
<value>default 12 1000 50 2000 false false #000000 False 0 #FFFF00 shapes false false + #FF0000 True square, False 4 space false false 10 false false</value>
1029+
<value>default 12 1000 50 2000 false false #000000 False 0 #FFFF00 shapes false false + #FF0000 True square, False 4 space false false 10 false false 500</value>
10301030
</data>
10311031
<data name="defaultReactionProgramError" xml:space="preserve">
10321032
<value>Couldn't write default Reaction Test program.</value>

StroopTest/Resources/Localizations/LocalizedResources.pt-BR.resx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ https://github.com/lab-neuro-comp/Test-Platform</value>
12591259
<value>A tarefa vai começar agora</value>
12601260
</data>
12611261
<data name="defaultReactionProgram" xml:space="preserve">
1262-
<value>padrao 12 1000 50 2000 false false #000000 False 0 #FFFF00 shapes false false + #FF0000 True square, False 4 space false false 10 false false</value>
1262+
<value>padrao 12 1000 50 2000 false false #000000 False 0 #FFFF00 shapes false false + #FF0000 True square, False 4 space false false 10 false false 500</value>
12631263
</data>
12641264
<data name="defaultReactionProgramError" xml:space="preserve">
12651265
<value>Erro ao criar o programa padrão do teste de tempo de reação.</value>

StroopTest/Views/ReactionPages/FormTRConfig.Designer.cs

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

StroopTest/Views/ReactionPages/FormTRConfig.cs

+23-6
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ private ReactionProgram configureNewProgram()
388388
Convert.ToInt32(beepDuration.Value), stimulusColorCheck(),
389389
fixPointValue(), bgColorButton.Text, fixPointColor(),
390390
rndIntervalCheck.Checked, shapeValue(), randomBeepCheck.Checked,
391-
Convert.ToInt32(positionsBox.Text), responseType(), openColorListButton.Text, ColorListOption.Checked, sstCheckBox.Checked);
391+
Convert.ToInt32(positionsBox.Text), responseType(), openColorListButton.Text, ColorListOption.Checked, sstCheckBox.Checked, Convert.ToInt32(intervalBetweenAttempts.Value));
392392
break;
393393
// Program type "words"
394394
case 1:
@@ -400,7 +400,7 @@ private ReactionProgram configureNewProgram()
400400
fixPointValue(), bgColorButton.Text, fixPointColor(),
401401
rndIntervalCheck.Checked, randomBeepCheck.Checked,
402402
Convert.ToInt32(positionsBox.Text), responseType(), openWordListButton.Text, isRandomExposition.Checked,
403-
openColorListButton.Text, ColorListOption.Checked, Convert.ToInt32(fontSizeUpDown.Value), sstCheckBox.Checked);
403+
openColorListButton.Text, ColorListOption.Checked, Convert.ToInt32(fontSizeUpDown.Value), sstCheckBox.Checked, Convert.ToInt32(intervalBetweenAttempts.Value));
404404
break;
405405

406406
// Program type "images"
@@ -409,7 +409,7 @@ private ReactionProgram configureNewProgram()
409409
Convert.ToInt32(intervalTime.Value), beepingCheckbox.Checked, Convert.ToInt32(beepDuration.Value),
410410
fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked, openImgListButton.Text,
411411
randomBeepCheck.Checked, Convert.ToInt32(positionsBox.Text), responseType(), isRandomExposition.Checked,
412-
expandImageCheck.Checked, sstCheckBox.Checked);
412+
expandImageCheck.Checked, sstCheckBox.Checked, Convert.ToInt32(intervalBetweenAttempts.Value));
413413
break;
414414

415415
// Program type "imageAndWord"
@@ -419,7 +419,7 @@ private ReactionProgram configureNewProgram()
419419
fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked,
420420
openImgListButton.Text, openWordListButton.Text, openColorListButton.Text, randomBeepCheck.Checked,
421421
Convert.ToInt32(positionsBox.Text), ColorListOption.Checked, responseType(), isRandomExposition.Checked,
422-
stimulusColorCheck(), Convert.ToInt32(fontSizeUpDown.Value), expandImageCheck.Checked, sstCheckBox.Checked);
422+
stimulusColorCheck(), Convert.ToInt32(fontSizeUpDown.Value), expandImageCheck.Checked, sstCheckBox.Checked, Convert.ToInt32(intervalBetweenAttempts.Value));
423423
break;
424424

425425
// Program type "wordWithAudio"
@@ -428,7 +428,7 @@ private ReactionProgram configureNewProgram()
428428
stimulusColorCheck(), fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked,
429429
Convert.ToInt32(positionsBox.Text), responseType(), openColorListButton.Text, ColorListOption.Checked,
430430
isRandomExposition.Checked, Convert.ToInt32(fontSizeUpDown.Value), openAudioListButton.Text, openWordListButton.Text,
431-
sstCheckBox.Checked);
431+
sstCheckBox.Checked, Convert.ToInt32(intervalBetweenAttempts.Value));
432432

433433
break;
434434

@@ -437,7 +437,7 @@ private ReactionProgram configureNewProgram()
437437
newProgram = new ReactionProgram(prgNameTextBox.Text, Convert.ToInt32(expoTime.Value), Convert.ToInt32(numExpo.Value), Convert.ToInt32(intervalTime.Value),
438438
fixPointValue(), bgColorButton.Text, fixPointColor(), rndIntervalCheck.Checked, Convert.ToInt32(positionsBox.Text),
439439
responseType(), Convert.ToDouble(stimuluSize.Value), isRandomExposition.Checked, openAudioListButton.Text,
440-
openImgListButton.Text, expandImageCheck.Checked, sstCheckBox.Checked);
440+
openImgListButton.Text, expandImageCheck.Checked, sstCheckBox.Checked, Convert.ToInt32(intervalBetweenAttempts.Value));
441441
break;
442442

443443
// invalid type was choosen
@@ -670,6 +670,23 @@ private void intervalTime_Validated(object sender, System.EventArgs e)
670670
errorProvider1.SetError(intervalTime, "");
671671
}
672672

673+
private void intervalBetweenAttemptsTime_Validating(object sender,
674+
System.ComponentModel.CancelEventArgs e)
675+
{
676+
string errorMsg;
677+
if (!ValidIntervalTime(Convert.ToInt32(this.intervalBetweenAttempts.Value), out errorMsg))
678+
{
679+
e.Cancel = true;
680+
this.errorProvider1.SetError(this.intervalBetweenAttempts, errorMsg);
681+
}
682+
}
683+
684+
private void intervalBetweenAttemptsTime_Validated(object sender, System.EventArgs e)
685+
{
686+
// If all conditions have been met, clear the ErrorProvider of errors.
687+
errorProvider1.SetError(intervalBetweenAttempts, "");
688+
}
689+
673690
public bool ValidIntervalTime(int intervalTime, out string errorMessage)
674691
{
675692
if (!Validations.isIntervalTimeValid(intervalTime))

0 commit comments

Comments
 (0)