@@ -130,8 +130,10 @@ public string getControlName(Control control, int stimuluType)
130
130
private bool showAudioFeedbackOnNextClick = false ;
131
131
private long modelReactTime ;
132
132
bool shouldChangeExpositionType = false ;
133
+ bool shouldRandomizeExpositionType = false ;
133
134
private long attemptIntervalTime ;
134
135
private int stimuluType ;
136
+ Random randGen = new Random ( Guid . NewGuid ( ) . GetHashCode ( ) ) ;
135
137
136
138
public MatchingExposition ( string prgName , string participantName , char mark )
137
139
{
@@ -157,11 +159,24 @@ private void startExposition()
157
159
if ( executingTest . ProgramInUse . Ready ( path ) )
158
160
{
159
161
currentExpositionType = this . executingTest . ProgramInUse . getExpositionType ( ) ;
160
- if ( this . currentExpositionType == "DMTS/DNMTS" )
162
+ if ( this . currentExpositionType == LocRM . GetString ( "alternatingDMTS_DNMTS" , currentCulture ) )
161
163
{
162
164
shouldChangeExpositionType = true ;
163
165
this . currentExpositionType = "DMTS" ;
164
166
}
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
+ }
165
180
initializeExposition ( ) ;
166
181
}
167
182
else
@@ -431,7 +446,8 @@ private void expositionControllerBW_DoWork(object sender, DoWorkEventArgs e)
431
446
}
432
447
if ( shouldChangeExpositionType )
433
448
{
434
- if ( currentExpositionType == "DMTS" )
449
+
450
+ if ( currentExpositionType == "DMTS" )
435
451
{
436
452
currentExpositionType = "DNMTS" ;
437
453
}
@@ -441,6 +457,18 @@ private void expositionControllerBW_DoWork(object sender, DoWorkEventArgs e)
441
457
}
442
458
changeBackgroundColor ( ) ;
443
459
}
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
+ }
444
472
Thread . Sleep ( 10 ) ;
445
473
}
446
474
@@ -693,22 +721,29 @@ private int[] randomScreenPosition(Size item)
693
721
694
722
private void expositionControllerBW_ProgressChanged ( object sender , ProgressChangedEventArgs e )
695
723
{
696
- List < Control > controls = ( List < Control > ) e . UserState ;
697
- foreach ( Control c in controls )
724
+ try
698
725
{
699
- if ( exposing )
726
+ List < Control > controls = ( List < Control > ) e . UserState ;
727
+ foreach ( Control c in controls )
700
728
{
701
- this . Controls . Add ( c ) ;
729
+ if ( exposing )
730
+ {
731
+ this . Controls . Add ( c ) ;
732
+ }
733
+ else
734
+ {
735
+ this . Controls . Remove ( c ) ;
736
+ }
702
737
}
703
- else
738
+ if ( this . executingTest . ProgramInUse . ExpositionAudioResponse && exposing && ! cancelExposition )
704
739
{
705
- this . Controls . Remove ( c ) ;
740
+ System . Media . SoundPlayer player = new System . Media . SoundPlayer ( TestPlatform . Properties . Resources . bell ) ;
741
+ player . Play ( ) ;
706
742
}
707
743
}
708
- if ( this . executingTest . ProgramInUse . ExpositionAudioResponse && exposing && ! cancelExposition )
744
+ catch ( Exception )
709
745
{
710
- System . Media . SoundPlayer player = new System . Media . SoundPlayer ( TestPlatform . Properties . Resources . bell ) ;
711
- player . Play ( ) ;
746
+ /*do nothing*/
712
747
}
713
748
}
714
749
0 commit comments