Skip to content

Commit 67ae26e

Browse files
committed
Added random DMTS/DMTS
1 parent 6c95ef2 commit 67ae26e

10 files changed

+99
-29
lines changed

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

+6
Original file line numberDiff line numberDiff line change
@@ -2854,4 +2854,10 @@ user to the stimulus or if there is no reaction to the stimulus(ms)</td>
28542854
<data name="shouldSelectReason" xml:space="preserve">
28552855
<value>You should select a valid reason.</value>
28562856
</data>
2857+
<data name="alternatingDMTS_DNMTS" xml:space="preserve">
2858+
<value>DMTS/DNMTS(Alternating)</value>
2859+
</data>
2860+
<data name="randomDMTS_DNMTS" xml:space="preserve">
2861+
<value>DMTS/DNMTS(Random)</value>
2862+
</data>
28572863
</root>

StroopTest/Resources/Localizations/LocalizedResources.es-ES.resx

+6
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,10 @@ https://github.com/lab-neuro-comp/Test-Platform
348348
<data name="cannotRecoverFilesByMotive" xml:space="preserve">
349349
<value>Debe crear o recuperar las siguientes listas antes de recuperar el programa "</value>
350350
</data>
351+
<data name="alternatingDMTS_DNMTS" xml:space="preserve">
352+
<value>DMTS/DNMTS(Alterno)</value>
353+
</data>
354+
<data name="randomDMTS_DNMTS" xml:space="preserve">
355+
<value>DMTS/DNMTS(Aleatorio)</value>
356+
</data>
351357
</root>

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

+6
Original file line numberDiff line numberDiff line change
@@ -2837,4 +2837,10 @@ https://github.com/lab-neuro-comp/Test-Platform</value>
28372837
<data name="shouldSelectReason" xml:space="preserve">
28382838
<value>Um motivo válido deve ser selecionado.</value>
28392839
</data>
2840+
<data name="alternatingDMTS_DNMTS" xml:space="preserve">
2841+
<value>DMTS/DNMTS(Alternado)</value>
2842+
</data>
2843+
<data name="randomDMTS_DNMTS" xml:space="preserve">
2844+
<value>DMTS/DNMTS(Aleatorio)</value>
2845+
</data>
28402846
</root>

StroopTest/Views/MatchingPages/FormMatchConfig.Designer.cs

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

StroopTest/Views/MatchingPages/FormMatchConfig.cs

+17-13
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,21 @@ private void editProgram()
106106
feedbackAudioResponse.Checked = editProgram.FeedbackAudioResponse;
107107
expositonAudioResponse.Checked = editProgram.ExpositionAudioResponse;
108108
randomModelStimulusTime.Checked = editProgram.RandomIntervalModelStimulus;
109-
switch (editProgram.getExpositionType())
109+
if (editProgram.getExpositionType() == "DMTS")
110110
{
111-
case "DMTS":
112-
this.expositionType.SelectedIndex = 0;
113-
break;
114-
case "DNMTS":
115-
this.expositionType.SelectedIndex = 1;
116-
break;
117-
case "DMTS/DNMTS":
118-
this.expositionType.SelectedIndex = 2;
119-
break;
111+
this.expositionType.SelectedIndex = 0;
112+
}
113+
else if (editProgram.getExpositionType() == "DNMTS")
114+
{
115+
this.expositionType.SelectedIndex = 1;
116+
}
117+
else if (editProgram.getExpositionType() == LocRM.GetString("alternatingDMTS_DNMTS", currentCulture))
118+
{
119+
this.expositionType.SelectedIndex = 2;
120+
}
121+
else
122+
{
123+
this.expositionType.SelectedIndex = 3;
120124
}
121125

122126
// reads program instructions to instruction box if there are any
@@ -297,7 +301,7 @@ private void expositionType_Validating(object sender, CancelEventArgs e)
297301

298302
private bool validExpositionType(out string errorMessage)
299303
{
300-
if(this.expositionType.SelectedIndex >= 0 && this.expositionType.SelectedIndex < 3)
304+
if(this.expositionType.SelectedIndex >= 0 && this.expositionType.SelectedIndex < 4)
301305
{
302306
errorMessage = "";
303307
return true;
@@ -318,7 +322,7 @@ private void expositionType_SelectedIndexChanged(object sender, EventArgs e)
318322
{
319323
this.errorProvider1.Clear();
320324
this.errorProvider2.Clear();
321-
if(this.expositionType.SelectedIndex > 2)
325+
if(this.expositionType.SelectedIndex > 3)
322326
{
323327
this.errorProvider1.SetError(this.expositionType, LocRM.GetString("unavailableExpo", currentCulture));
324328
}
@@ -348,7 +352,7 @@ private void expositionType_SelectedIndexChanged(object sender, EventArgs e)
348352
DNMTSBackgroundColor.Enabled = true;
349353
DNMTSBackground.Enabled = true;
350354
}
351-
else if (this.expositionType.SelectedIndex == 2)
355+
else if (this.expositionType.SelectedIndex == 2 || this.expositionType.SelectedIndex == 3)
352356
{
353357
DMTSBackgroundLabel.Enabled = true;
354358
DMTSColorPanel.Enabled = true;

StroopTest/Views/MatchingPages/FormMatchConfig.en-US.resx

+4-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
<value>DNMTS</value>
140140
</data>
141141
<data name="expositionType.Items2" xml:space="preserve">
142-
<value>DMTS/DNMTS</value>
142+
<value>DMTS/DNMTS(Alternating)</value>
143143
</data>
144144
<data name="expositionType.Items" xml:space="preserve">
145145
<value>DMTS</value>
@@ -270,4 +270,7 @@
270270
<data name="audioResponseLabel.Text" xml:space="preserve">
271271
<value>Auditory feedback:</value>
272272
</data>
273+
<data name="expositionType.Items3" xml:space="preserve">
274+
<value>DMTS/DNMTS(Random)</value>
275+
</data>
273276
</root>

StroopTest/Views/MatchingPages/FormMatchConfig.es-ES.resx

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
<value>DNMTS</value>
158158
</data>
159159
<data name="expositionType.Items2" xml:space="preserve">
160-
<value>DMTS/DNMTS</value>
160+
<value>DMTS/DNMTS(Alterno)</value>
161161
</data>
162162
<data name="expositionType.Items" xml:space="preserve">
163163
<value>DMTS</value>
@@ -270,4 +270,7 @@
270270
<data name="audioResponseLabel.Text" xml:space="preserve">
271271
<value>Respuesta auditiva:</value>
272272
</data>
273+
<data name="expositionType.Items3" xml:space="preserve">
274+
<value>DMTS/DNMTS(Aleatorio)</value>
275+
</data>
273276
</root>

StroopTest/Views/MatchingPages/FormMatchConfig.pt-BR.resx

+4-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
<value>DNMTS</value>
167167
</data>
168168
<data name="expositionType.Items2" xml:space="preserve">
169-
<value>DMTS/DNMTS</value>
169+
<value>DMTS/DNMTS(Alternado)</value>
170170
</data>
171171
<data name="expositionType.Items" xml:space="preserve">
172172
<value>DMTS</value>
@@ -270,4 +270,7 @@
270270
<data name="audioResponseLabel.Text" xml:space="preserve">
271271
<value>Resposta auditiva:</value>
272272
</data>
273+
<data name="expositionType.Items3" xml:space="preserve">
274+
<value>DMTS/DNMTS(Aleatorio)</value>
275+
</data>
273276
</root>

StroopTest/Views/MatchingPages/FormMatchConfig.resx

+4-1
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,10 @@
13001300
<value>DNMTS</value>
13011301
</data>
13021302
<data name="expositionType.Items2" xml:space="preserve">
1303-
<value>DMTS/DNMTS</value>
1303+
<value>DMTS/DNMTS(Alternado)</value>
1304+
</data>
1305+
<data name="expositionType.Items3" xml:space="preserve">
1306+
<value>DMTS/DNMTS(Aleatorio)</value>
13041307
</data>
13051308
<data name="expositionType.Location" type="System.Drawing.Point, System.Drawing">
13061309
<value>102, 13</value>

StroopTest/Views/MatchingPages/MatchingExposition.cs

+46-11
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ public string getControlName(Control control, int stimuluType)
130130
private bool showAudioFeedbackOnNextClick = false;
131131
private long modelReactTime;
132132
bool shouldChangeExpositionType = false;
133+
bool shouldRandomizeExpositionType = false;
133134
private long attemptIntervalTime;
134135
private int stimuluType;
136+
Random randGen = new Random(Guid.NewGuid().GetHashCode());
135137

136138
public MatchingExposition(string prgName, string participantName, char mark)
137139
{
@@ -157,11 +159,24 @@ private void startExposition()
157159
if (executingTest.ProgramInUse.Ready(path))
158160
{
159161
currentExpositionType = this.executingTest.ProgramInUse.getExpositionType();
160-
if(this.currentExpositionType == "DMTS/DNMTS")
162+
if(this.currentExpositionType == LocRM.GetString("alternatingDMTS_DNMTS", currentCulture))
161163
{
162164
shouldChangeExpositionType = true;
163165
this.currentExpositionType = "DMTS";
164166
}
167+
if (this.currentExpositionType == LocRM.GetString("randomDMTS_DNMTS", currentCulture))
168+
{
169+
int rand = randGen.Next(2);
170+
shouldRandomizeExpositionType = true;
171+
if (rand == 0)
172+
{
173+
this.currentExpositionType = "DMTS";
174+
}
175+
else
176+
{
177+
this.currentExpositionType = "DNMTS";
178+
}
179+
}
165180
initializeExposition();
166181
}
167182
else
@@ -431,7 +446,8 @@ private void expositionControllerBW_DoWork(object sender, DoWorkEventArgs e)
431446
}
432447
if (shouldChangeExpositionType)
433448
{
434-
if(currentExpositionType == "DMTS")
449+
450+
if (currentExpositionType == "DMTS")
435451
{
436452
currentExpositionType = "DNMTS";
437453
}
@@ -441,6 +457,18 @@ private void expositionControllerBW_DoWork(object sender, DoWorkEventArgs e)
441457
}
442458
changeBackgroundColor();
443459
}
460+
if (shouldRandomizeExpositionType)
461+
{
462+
int rand = randGen.Next(2);
463+
if (rand == 0)
464+
{
465+
this.currentExpositionType = "DMTS";
466+
}
467+
else
468+
{
469+
this.currentExpositionType = "DNMTS";
470+
}
471+
}
444472
Thread.Sleep(10);
445473
}
446474

@@ -693,22 +721,29 @@ private int[] randomScreenPosition(Size item)
693721

694722
private void expositionControllerBW_ProgressChanged(object sender, ProgressChangedEventArgs e)
695723
{
696-
List<Control> controls = (List<Control>)e.UserState;
697-
foreach (Control c in controls)
724+
try
698725
{
699-
if (exposing)
726+
List<Control> controls = (List<Control>)e.UserState;
727+
foreach (Control c in controls)
700728
{
701-
this.Controls.Add(c);
729+
if (exposing)
730+
{
731+
this.Controls.Add(c);
732+
}
733+
else
734+
{
735+
this.Controls.Remove(c);
736+
}
702737
}
703-
else
738+
if (this.executingTest.ProgramInUse.ExpositionAudioResponse && exposing && !cancelExposition)
704739
{
705-
this.Controls.Remove(c);
740+
System.Media.SoundPlayer player = new System.Media.SoundPlayer(TestPlatform.Properties.Resources.bell);
741+
player.Play();
706742
}
707743
}
708-
if (this.executingTest.ProgramInUse.ExpositionAudioResponse && exposing && !cancelExposition)
744+
catch(Exception)
709745
{
710-
System.Media.SoundPlayer player = new System.Media.SoundPlayer(TestPlatform.Properties.Resources.bell);
711-
player.Play();
746+
/*do nothing*/
712747
}
713748
}
714749

0 commit comments

Comments
 (0)