Skip to content

Commit ed1147b

Browse files
committed
Fixing minor bugs in reaction test and stroop test
1 parent 5fd637e commit ed1147b

File tree

4 files changed

+22
-28
lines changed

4 files changed

+22
-28
lines changed

StroopTest/Controllers/ExpositionController.cs

-7
Original file line numberDiff line numberDiff line change
@@ -126,15 +126,8 @@ public static void BeginStroopTest(string programName, string participantName, c
126126

127127
public static void BeginReactionTest(string programName, string participantName, char mark, Form form)
128128
{
129-
try
130-
{
131129
SendKeys.SendWait("i");
132130
FormReactExposition reactionExposition = new FormReactExposition(programName, participantName, mark);
133-
}
134-
catch (Exception ex)
135-
{
136-
MessageBox.Show(ex.Message);
137-
}
138131
}
139132

140133
public static void BeginMatchingTest(string programName, string participantName, char mark, Form form)

StroopTest/Models/Tests/Stroop/StroopProgram.cs

+1-8
Original file line numberDiff line numberDiff line change
@@ -304,14 +304,7 @@ public string SubtitlesListFile
304304
get { return subtitlesListFile; }
305305
set
306306
{
307-
if (Validations.isListValid(value))
308-
{
309-
subtitlesListFile = value;
310-
}
311-
else
312-
{
313-
throw new ArgumentException(LocRM.GetString("fileName", currentCulture) + value + LocRM.GetString("fileNameError", currentCulture));
314-
}
307+
subtitlesListFile = value;
315308
}
316309
}
317310

StroopTest/Views/ReactionPages/FormReactExposition.cs

+20-12
Original file line numberDiff line numberDiff line change
@@ -640,15 +640,7 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
640640
// Sending mark to neuronspectrum to sinalize that exposition of stimulus started
641641
SendKeys.SendWait(executingTest.Mark.ToString());
642642
executingTest.ExpositionTime = DateTime.Now;
643-
try
644-
{
645-
showStimulus();
646-
}
647-
catch (Exception)
648-
{
649-
650-
}
651-
643+
showStimulus();
652644

653645
if (intervalCancelled)
654646
{
@@ -674,7 +666,21 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
674666
/* just wait for exposition time to be finished */
675667
}
676668
}
677-
between = true;
669+
// if current control is enabled it means that just showed a stimulus
670+
if (currentControl.Enabled)
671+
{
672+
// signaling to interval background worker that exposing must end and control must be removed from screen
673+
exposing = false;
674+
intervalBW.ReportProgress(50, currentControl);
675+
}
676+
if (e.Cancel)
677+
{
678+
between = false;
679+
}
680+
else
681+
{
682+
between = true;
683+
}
678684
if (Player.SoundLocation != null)
679685
{
680686
Player.Stop();
@@ -689,7 +695,7 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
689695
betweenAttemptsStopWatch = new Stopwatch();
690696
betweenAttemptsStopWatch.Start();
691697

692-
while (betweenAttemptsStopWatch.ElapsedMilliseconds < executingTest.ProgramInUse.IntervalBetweenAttempts)
698+
while (betweenAttemptsStopWatch.ElapsedMilliseconds < executingTest.ProgramInUse.IntervalBetweenAttempts && !(e.Cancel))
693699
{
694700
if (expositionBW.CancellationPending)
695701
{
@@ -720,6 +726,7 @@ private void expositionBW_ProgressChanged(object sender, ProgressChangedEventArg
720726

721727
private void expositionBW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
722728
{
729+
Console.WriteLine(cancelExposition);
723730
if (!cancelExposition)
724731
{
725732
// cleaning screen
@@ -753,7 +760,7 @@ private void expositionBW_RunWorkerCompleted(object sender, RunWorkerCompletedEv
753760
currentExposition + 1, expositionAccumulative, currentLists, currentStimuli, currentPositionOutput, currentBeep, currentColor,
754761
ReactionProgram.responseTimeType[ReactionProgram.AFTER_EXPOSITION]);
755762
}
756-
if ((e.Cancelled == true) && !intervalCancelled)
763+
else if ((e.Cancelled == true) && !intervalCancelled)
757764
{
758765
/* user clicked after stimulus is shown*/
759766
executingTest.writeLineOutput(intervalElapsedTime, intervalShouldBe, hitStopWatch.ElapsedMilliseconds,
@@ -796,6 +803,7 @@ private void intervalBW_DoWork(object sender, DoWorkEventArgs e)
796803
Thread.Sleep(1);
797804

798805
}
806+
Thread.Sleep(50);
799807
}
800808

801809
private void intervalBW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)

StroopTest/Views/StroopPages/FormExposition.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ private void configureSubtitle()
795795
string[] subtitlesArray = null;
796796
if (currentTest.ProgramInUse.SubtitleShow)
797797
{
798-
subtitlesArray = StrList.readListFile(FileManipulation._listFolderName + "/Lst/" + currentTest.ProgramInUse.SubtitlesListFile);
798+
subtitlesArray = StrList.readListFile(FileManipulation._listFolderName + currentTest.ProgramInUse.SubtitlesListFile + "_words.lst");
799799
if (currentTest.ProgramInUse.SubtitleColor.ToLower() != "false")
800800
{
801801
subtitleLabel.ForeColor = ColorTranslator.FromHtml(currentTest.ProgramInUse.SubtitleColor);

0 commit comments

Comments
 (0)