/// <summary> /// The <see cref="RecordModule.NewRawDataAvailable"/> event handler. /// Adds the sent <see cref="RawData"/> struct to the <see cref="rawDataLists"/>. /// </summary> /// <remarks> /// After successful recording this list will be written into /// the database. /// Because the access to this list is not allowed to be simultaneous from /// different methods, this event is introduced. /// It is called from each method that writes raw data /// rows (response entries or gaze data entries) /// </remarks> /// <param name="sender"> /// Source of the event. /// </param> /// <param name="e"> /// A <see cref="NewRawDataAvailableEventArgs"/> with the event data. /// </param> private void RecordModuleNewRawDataAvailable(object sender, NewRawDataAvailableEventArgs e) { // Write row into table try { // The beginloaddata and endloaddata methods are called to // workaround the follwing error message : // "DataTable internal index is corrupted: '5'" // Which occured some times during adding. // This workaround is // from http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=98279 // _subjectRawDataTable.BeginLoadData(); // _subjectRawDataTable.AddRawdataRow(e.RawdataRow); // _subjectRawDataTable.EndLoadData(); // This above approach didn´t even work, so finally I // came over with the following solution: // Writing all the data into a large list // which after trial is finished is written into the database if (e.RawData.TrialSequence >= 0) { this.rawDataLists[this.listCounter].Add(e.RawData); } } catch (Exception ex) { ExceptionMethods.HandleExceptionSilent(ex); } }
/// <summary> /// Raises <see cref="NewRawDataAvailable"/> event by invoking the delegates. /// </summary> /// <param name="e"> /// A <see cref="TrialChangedEventArgs"/> with the event data. /// </param> private void OnNewRawDataAvailable(NewRawDataAvailableEventArgs e) { if (this.NewRawDataAvailable != null) { this.NewRawDataAvailable(this, e); } }