/// <summary> /// The <see cref="PresenterModule.TrialEventOccured"/> event handler. /// Stores the new trial event into the list. /// </summary> /// <param name="sender"> /// Source of the event. /// </param> /// <param name="e"> /// A <see cref="TrialEventOccuredEventArgs"/> with the event data. /// </param> private void ObjPresenterTrialEventOccured(object sender, TrialEventOccuredEventArgs e) { // Save scroll offsets for raw data transformation if (e.TrialEvent.Type == EventType.Scroll) { string[] scrollOffsets = e.TrialEvent.Param.Split(';'); lock (this) { this.xScrollOffset = Convert.ToInt32(scrollOffsets[0]); this.yScrollOffset = Convert.ToInt32(scrollOffsets[1]); } var newScrollPosition = new Point(this.xScrollOffset, this.yScrollOffset); this.ThreadSafeSetAutoScrollPosition(newScrollPosition); } long time = e.EventTime - this.recordingStarttime - this.currentTrialStarttime; // Store trial event event e.TrialEvent.EventID = this.trialEventList.Count; e.TrialEvent.Time = time; e.TrialEvent.TrialSequence = this.trialSequenceCounter; e.TrialEvent.SubjectName = this.currentTracker.Subject.SubjectName; if (this.trialSequenceCounter < 0) { return; } this.trialEventList.Add(e.TrialEvent); if (e.TrialEvent.Type != EventType.Marker) { this.WriteTrialEventToRawData(e.TrialEvent); } }
/// <summary> /// This method raises the <see cref="TrialEventOccured"/> /// event by invoking the delegates. /// It should be called whenever an event occured in a trial. /// </summary> /// <param name="e"> /// A <see cref="TrialEventOccuredEventArgs"/> with the event data. /// </param> /// . private void OnTrialEventOccured(TrialEventOccuredEventArgs e) { if (this.TrialEventOccured != null) { this.TrialEventOccured(this, e); // AsyncHelper.FireAndForget(this.TrialEventOccured, this, e); } }