Skip to content

Commit

Permalink
Fixing minor bugs in reaction test and stroop test
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiola-m committed Aug 17, 2018
1 parent 5fd637e commit ed1147b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 28 deletions.
7 changes: 0 additions & 7 deletions StroopTest/Controllers/ExpositionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,8 @@ public static void BeginStroopTest(string programName, string participantName, c

public static void BeginReactionTest(string programName, string participantName, char mark, Form form)
{
try
{
SendKeys.SendWait("i");
FormReactExposition reactionExposition = new FormReactExposition(programName, participantName, mark);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}

public static void BeginMatchingTest(string programName, string participantName, char mark, Form form)
Expand Down
9 changes: 1 addition & 8 deletions StroopTest/Models/Tests/Stroop/StroopProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,7 @@ public string SubtitlesListFile
get { return subtitlesListFile; }
set
{
if (Validations.isListValid(value))
{
subtitlesListFile = value;
}
else
{
throw new ArgumentException(LocRM.GetString("fileName", currentCulture) + value + LocRM.GetString("fileNameError", currentCulture));
}
subtitlesListFile = value;
}
}

Expand Down
32 changes: 20 additions & 12 deletions StroopTest/Views/ReactionPages/FormReactExposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -640,15 +640,7 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
// Sending mark to neuronspectrum to sinalize that exposition of stimulus started
SendKeys.SendWait(executingTest.Mark.ToString());
executingTest.ExpositionTime = DateTime.Now;
try
{
showStimulus();
}
catch (Exception)
{

}

showStimulus();

if (intervalCancelled)
{
Expand All @@ -674,7 +666,21 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
/* just wait for exposition time to be finished */
}
}
between = true;
// if current control is enabled it means that just showed a stimulus
if (currentControl.Enabled)
{
// signaling to interval background worker that exposing must end and control must be removed from screen
exposing = false;
intervalBW.ReportProgress(50, currentControl);
}
if (e.Cancel)
{
between = false;
}
else
{
between = true;
}
if (Player.SoundLocation != null)
{
Player.Stop();
Expand All @@ -689,7 +695,7 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
betweenAttemptsStopWatch = new Stopwatch();
betweenAttemptsStopWatch.Start();

while (betweenAttemptsStopWatch.ElapsedMilliseconds < executingTest.ProgramInUse.IntervalBetweenAttempts)
while (betweenAttemptsStopWatch.ElapsedMilliseconds < executingTest.ProgramInUse.IntervalBetweenAttempts && !(e.Cancel))
{
if (expositionBW.CancellationPending)
{
Expand Down Expand Up @@ -720,6 +726,7 @@ private void expositionBW_ProgressChanged(object sender, ProgressChangedEventArg

private void expositionBW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
Console.WriteLine(cancelExposition);
if (!cancelExposition)
{
// cleaning screen
Expand Down Expand Up @@ -753,7 +760,7 @@ private void expositionBW_RunWorkerCompleted(object sender, RunWorkerCompletedEv
currentExposition + 1, expositionAccumulative, currentLists, currentStimuli, currentPositionOutput, currentBeep, currentColor,
ReactionProgram.responseTimeType[ReactionProgram.AFTER_EXPOSITION]);
}
if ((e.Cancelled == true) && !intervalCancelled)
else if ((e.Cancelled == true) && !intervalCancelled)
{
/* user clicked after stimulus is shown*/
executingTest.writeLineOutput(intervalElapsedTime, intervalShouldBe, hitStopWatch.ElapsedMilliseconds,
Expand Down Expand Up @@ -796,6 +803,7 @@ private void intervalBW_DoWork(object sender, DoWorkEventArgs e)
Thread.Sleep(1);

}
Thread.Sleep(50);
}

private void intervalBW_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion StroopTest/Views/StroopPages/FormExposition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ private void configureSubtitle()
string[] subtitlesArray = null;
if (currentTest.ProgramInUse.SubtitleShow)
{
subtitlesArray = StrList.readListFile(FileManipulation._listFolderName + "/Lst/" + currentTest.ProgramInUse.SubtitlesListFile);
subtitlesArray = StrList.readListFile(FileManipulation._listFolderName + currentTest.ProgramInUse.SubtitlesListFile + "_words.lst");
if (currentTest.ProgramInUse.SubtitleColor.ToLower() != "false")
{
subtitleLabel.ForeColor = ColorTranslator.FromHtml(currentTest.ProgramInUse.SubtitleColor);
Expand Down

0 comments on commit ed1147b

Please sign in to comment.