/// <summary> /// The <see cref="TrialSequenceChanged"/> event handler. /// Raised when trial sequence change was found in the raw data. /// </summary> /// <param name="e"> /// A <see cref="TrialSequenceChangedEventArgs"/> with the new trial sequence. /// </param> /// . private void OnTrialSequenceChanged(TrialSequenceChangedEventArgs e) { if (this.TrialSequenceChanged != null) { this.TrialSequenceChanged(this, e); } }
/// <summary> /// The <see cref="ReplayPicture.TrialSequenceChanged"/> event handler for /// the <see cref="VectorGraphics.Canvas.Picture"/> <see cref="replayPicture"/>. /// Updates the picture with the new trials slide, if we are in continous mode, /// that means replaying the whole experiment. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">A <see cref="TrialSequenceChangedEventArgs"/> with the event data.</param> private void replayPicture_TrialSequenceChanged(object sender, TrialSequenceChangedEventArgs e) { // Load new trial stimulus during replay if we are in continous mode if (this.isInContinuousMode) { string subjectName = Document.ActiveDocument.SelectionState.SubjectName; this.StopTrialVideoAndTrialAudio(); // Load an video for the trial this.LoadTrialVideo(subjectName, e.TrialSequence); // Get the trial id for the current subject and sequence int trialID = Queries.GetTrialIDForSequence(subjectName, e.TrialSequence); // Load trial stimulus into picture if (!this.LoadTrialStimulus(trialID)) { this.Picture.ResetBackground(); this.LoadSlide(SlideNotFoundSlide, ActiveXMode.Off); } // if video is available reset the slide if (this.isUsingTrialVideo) { this.Picture.ResetBackground(); this.videoFramePusher.Start(); // AsyncHelper.FireAndForget(new MethodInvoker(this.videoFramePusher.Start)); } // Load trial stimulus into picture this.LoadAudioStimuli(this.FilterTrialEvents(this.TrialEvents, e.TrialSequence)); // Start sound if (this.btnEnableAudio.Checked) { if (this.Player != null) { this.Player.Play(); } } } }