@@ -38,6 +38,7 @@ public partial class FormReactExposition : Form
38
38
private long expositionAccumulative ;
39
39
private Stopwatch hitStopWatch = new Stopwatch ( ) ;
40
40
private Stopwatch accumulativeStopWatch = new Stopwatch ( ) ;
41
+ private Stopwatch betweenAttemptsStopWatch = new Stopwatch ( ) ;
41
42
private bool intervalCancelled ;
42
43
private bool cancelExposition = false ;
43
44
@@ -55,14 +56,15 @@ public partial class FormReactExposition : Form
55
56
private System . Windows . Forms . Label wordLabel = new System . Windows . Forms . Label ( ) ;
56
57
57
58
private bool exposing = false ;
59
+ private bool between = false ;
58
60
private string [ ] currentStimuli = { "-" , "-" } ;
59
61
private string [ ] currentLists = { "-" , "-" } ;
60
62
private int currentPosition ;
61
63
private string currentPositionOutput ;
62
64
private bool currentBeep = false ;
63
65
private string currentColor = "false" ;
64
66
private int currentExposition = 0 ;
65
-
67
+ private long fixPointTime = 100 ;
66
68
private ResourceManager LocRM = new ResourceManager ( "TestPlatform.Resources.Localizations.LocalizedResources" , typeof ( FormMain ) . Assembly ) ;
67
69
private CultureInfo currentCulture = CultureInfo . CurrentUICulture ;
68
70
@@ -368,7 +370,12 @@ private int waitIntervalTime(bool isWaitTimeRandom, int waitTime)
368
370
369
371
Stopwatch intervalStopWatch = new Stopwatch ( ) ;
370
372
intervalStopWatch . Start ( ) ;
371
- while ( intervalStopWatch . ElapsedMilliseconds < intervalTimeRandom )
373
+ long interval = intervalTimeRandom ;
374
+ if ( Program . hasFixPoint ( executingTest . ProgramInUse . FixPoint ) )
375
+ {
376
+ interval = intervalTimeRandom - fixPointTime ;
377
+ }
378
+ while ( intervalStopWatch . ElapsedMilliseconds < interval )
372
379
{
373
380
if ( expositionBW . CancellationPending )
374
381
{
@@ -377,6 +384,20 @@ private int waitIntervalTime(bool isWaitTimeRandom, int waitTime)
377
384
}
378
385
/* just wait for interval time to be finished */
379
386
}
387
+ ExpositionController . makingFixPoint ( executingTest . ProgramInUse . FixPoint , executingTest . ProgramInUse . FixPointColor ,
388
+ this ) ;
389
+ if ( Program . hasFixPoint ( executingTest . ProgramInUse . FixPoint ) )
390
+ {
391
+ while ( intervalStopWatch . ElapsedMilliseconds < intervalTimeRandom )
392
+ {
393
+ if ( expositionBW . CancellationPending )
394
+ {
395
+ intervalCancelled = true ;
396
+ break ;
397
+ }
398
+ /* just wait for interval time to be finished */
399
+ }
400
+ }
380
401
intervalShouldBe = intervalTimeRandom ;
381
402
intervalStopWatch . Stop ( ) ;
382
403
int elapsedTime = ( int ) intervalStopWatch . ElapsedMilliseconds ;
@@ -615,13 +636,20 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
615
636
expositionAccumulative = accumulativeStopWatch . ElapsedMilliseconds ;
616
637
hitStopWatch = new Stopwatch ( ) ;
617
638
hitStopWatch . Start ( ) ;
618
-
639
+ between = false ;
619
640
// Sending mark to neuronspectrum to sinalize that exposition of stimulus started
620
641
SendKeys . SendWait ( executingTest . Mark . ToString ( ) ) ;
621
642
executingTest . ExpositionTime = DateTime . Now ;
643
+ try
644
+ {
645
+ showStimulus ( ) ;
646
+ }
647
+ catch ( Exception )
648
+ {
649
+
650
+ }
651
+
622
652
623
- showStimulus ( ) ;
624
-
625
653
if ( intervalCancelled )
626
654
{
627
655
e . Cancel = true ;
@@ -646,6 +674,34 @@ private void expositionBW_DoWork(object sender, DoWorkEventArgs e)
646
674
/* just wait for exposition time to be finished */
647
675
}
648
676
}
677
+ between = true ;
678
+ if ( Player . SoundLocation != null )
679
+ {
680
+ Player . Stop ( ) ;
681
+ Player = new SoundPlayer ( ) ;
682
+ }
683
+ // cleaning screen
684
+ if ( ActiveForm != null )
685
+ {
686
+ this . CreateGraphics ( ) . Clear ( ActiveForm . BackColor ) ;
687
+
688
+ }
689
+ betweenAttemptsStopWatch = new Stopwatch ( ) ;
690
+ betweenAttemptsStopWatch . Start ( ) ;
691
+
692
+ while ( betweenAttemptsStopWatch . ElapsedMilliseconds < executingTest . ProgramInUse . IntervalBetweenAttempts )
693
+ {
694
+ if ( expositionBW . CancellationPending )
695
+ {
696
+ betweenAttemptsStopWatch . Stop ( ) ;
697
+ e . Cancel = true ;
698
+ break ;
699
+ }
700
+ else
701
+ {
702
+ /* just wait for between expositions time to be finished */
703
+ }
704
+ }
649
705
}
650
706
651
707
if ( Player . SoundLocation != null )
@@ -683,32 +739,41 @@ private void expositionBW_RunWorkerCompleted(object sender, RunWorkerCompletedEv
683
739
intervalBW . ReportProgress ( 50 , currentControl ) ;
684
740
}
685
741
}
686
- ExpositionController . makingFixPoint ( executingTest . ProgramInUse . FixPoint , executingTest . ProgramInUse . FixPointColor , this ) ;
687
742
}
688
743
else
689
744
{
690
745
/*do nothing*/
691
746
}
692
747
748
+ if ( ( e . Cancelled ) == true && between )
749
+ {
750
+ /* user clicked after stimulus disappeared */
751
+ between = false ;
752
+ executingTest . writeLineOutput ( intervalElapsedTime , intervalShouldBe , betweenAttemptsStopWatch . ElapsedMilliseconds ,
753
+ currentExposition + 1 , expositionAccumulative , currentLists , currentStimuli , currentPositionOutput , currentBeep , currentColor ,
754
+ ReactionProgram . responseTimeType [ ReactionProgram . AFTER_EXPOSITION ] ) ;
755
+ }
693
756
if ( ( e . Cancelled == true ) && ! intervalCancelled )
694
757
{
695
758
/* user clicked after stimulus is shown*/
696
759
executingTest . writeLineOutput ( intervalElapsedTime , intervalShouldBe , hitStopWatch . ElapsedMilliseconds ,
697
- currentExposition + 1 , expositionAccumulative , currentLists , currentStimuli , currentPositionOutput , currentBeep , currentColor ) ;
760
+ currentExposition + 1 , expositionAccumulative , currentLists , currentStimuli , currentPositionOutput , currentBeep , currentColor ,
761
+ ReactionProgram . responseTimeType [ ReactionProgram . DURING_EXPOSITION ] ) ;
698
762
}
699
-
700
763
else if ( ( e . Cancelled == true ) && intervalCancelled )
701
764
{
702
765
/* user clicked before stimulus is shown*/
703
766
executingTest . writeLineOutput ( intervalElapsedTime , intervalShouldBe , intervalElapsedTime - intervalShouldBe ,
704
- currentExposition + 1 , expositionAccumulative , currentLists , currentStimuli , currentPositionOutput , currentBeep , currentColor ) ;
767
+ currentExposition + 1 , expositionAccumulative , currentLists , currentStimuli , currentPositionOutput , currentBeep , currentColor ,
768
+ ReactionProgram . responseTimeType [ ReactionProgram . ANTECIPATION ] ) ;
705
769
}
706
770
else
707
771
{
708
772
/* user missed stimulus */
709
773
executingTest . CurrentResponse = "NA" ;
710
774
executingTest . writeLineOutput ( intervalElapsedTime , intervalShouldBe , 0 , currentExposition + 1 , expositionAccumulative , currentLists , currentStimuli ,
711
- currentPositionOutput , currentBeep , currentColor ) ;
775
+ currentPositionOutput , currentBeep , currentColor ,
776
+ ReactionProgram . responseTimeType [ ReactionProgram . NO_RESPONSE ] ) ;
712
777
hitStopWatch . Stop ( ) ;
713
778
}
714
779
expositionBW . Dispose ( ) ;
@@ -721,8 +786,6 @@ private void intervalBW_DoWork(object sender, DoWorkEventArgs e)
721
786
722
787
for ( int counter = 0 ; counter < executingTest . ProgramInUse . NumExpositions && ! cancelExposition ; counter ++ )
723
788
{
724
- ExpositionController . makingFixPoint ( executingTest . ProgramInUse . FixPoint , executingTest . ProgramInUse . FixPointColor ,
725
- this ) ;
726
789
currentExposition = counter ;
727
790
//preparing execution
728
791
expositionBackground ( ) ;
0 commit comments