/// <summary> /// This method creates the initialization trial. /// </summary> private void InitializeFirstTrial() { var coll = new StopConditionCollection(); var stc = new TimeStopCondition(5000); coll.Add(stc); this.preparedSlideOne.Slide = new Slide( "OgamaDummyStartTrial6gsj2", Color.Gray, Images.CreateRecordInstructionImage( Document.ActiveDocument.ExperimentSettings.WidthStimulusScreen, Document.ActiveDocument.ExperimentSettings.HeightStimulusScreen), coll, new StopConditionCollection(), string.Empty, Document.ActiveDocument.PresentationSize); var wait = new VGText( ShapeDrawAction.None, "Initializing ...", new Font("Verdana", 40f), Color.WhiteSmoke, HorizontalAlignment.Center, 1, 6, Pens.Red, Brushes.Red, SystemFonts.MenuFont, Color.Black, new RectangleF(100, 100, 400, 200), VGStyleGroup.None, "Text", string.Empty, null); this.preparedSlideOne.Slide.VGStimuli.Add(wait); // Reset the cursor position to initial location if applicable var newPoint = new Point( this.presentationBounds.Left + this.presentationBounds.Width / 2, this.presentationBounds.Top + this.presentationBounds.Height / 2); Cursor.Position = newPoint; Cursor.Hide(); this.hiddenCursor = true; // Prepare preparation slide this.preparedSlideOne.Trial = new Trial("DummyTrial", -1); this.preparedSlideOne.Trial.Add(this.preparedSlideOne.Slide); this.preparedSlideOne.Timer.Period = 2000; this.preparedSlideOne.Timer.Mode = TimerMode.OneShot; this.preparedSlideOne.Timer.SynchronizingObject = this; this.preparedSlideOne.Timer.Tick += this.TimerTick; this.DrawToBuffer(this.preparedSlideOne); this.PresentPreparedSlide(); // Prepare first slide of trial list this.preparedSlideTwo.Trial = this.trials[0]; this.preparedSlideTwo.Slide = this.trials[0][0]; this.preparedSlideTwo.Timer.Period = 200; this.preparedSlideTwo.Timer.Mode = TimerMode.OneShot; this.preparedSlideTwo.Timer.SynchronizingObject = this; this.preparedSlideTwo.Timer.Tick += this.TimerTick; this.InitializeNextSlide(this.preparedSlideTwo); this.DrawToBuffer(this.preparedSlideTwo); this.PrepareScreenCapture(-1); }
/// <summary> /// Removes all <see cref="StopCondition"/>s with a target condition /// of the given <see cref="ListBox"/> /// </summary> /// <param name="box"> /// A <see cref="ListBox"/> which should be checked for /// target conditions. /// </param> private void RemoveTargetConditions(ListBox box) { // Get conditions to remove var itemsToRemove = new StopConditionCollection(); foreach (StopCondition stc in box.Items) { if (stc is MouseStopCondition) { if (((MouseStopCondition)stc).Target != string.Empty) { itemsToRemove.Add(stc); } } } // Remove them from the ListBox foreach (StopCondition removeStc in itemsToRemove) { box.Items.Remove(removeStc); } }