Esempio n. 1
0
    /// <summary>
    /// This method creates a new <see cref="RawData"/> with the
    ///   event id and sends it to be recorded into the dataset
    ///   by a call of <see cref="NewRawDataAvailable"/>.
    /// </summary>
    /// <param name="inputEvent">
    /// A <see cref="TrialEvent"/> with the
    ///   event data.
    /// </param>
    private void WriteTrialEventToRawData(TrialEvent inputEvent)
    {
      // Create a new RawData object
      // Fill its members with current values.
      var newRawData = new RawData
                         {
                           SubjectName = this.currentTracker.Subject.SubjectName,
                           TrialSequence = this.trialSequenceCounter,
                           Time = inputEvent.Time + this.currentTrialStarttime,
                           EventID = inputEvent.EventID
                         };

      // Raise the NewRawDataAvailable event with the new data
      // to submit its contents to the database.
      this.OnNewRawDataAvailable(new NewRawDataAvailableEventArgs(newRawData));
    }
Esempio n. 2
0
    /// <summary>
    /// Deletes the given <see cref="TrialEvent"/> marker
    /// </summary>
    /// <param name="trialEvent">The <see cref="TrialEvent"/>
    /// marker to be deleted.</param>
    public static void DeleteMarkerEventByID(TrialEvent trialEvent)
    {
      try
      {
        string expression = "SubjectName = '" + trialEvent.SubjectName + "' AND TrialSequence = '" +
          trialEvent.TrialSequence.ToString() + "' AND EventID = '" +
          trialEvent.EventID.ToString() + "'";
        DataRow[] foundRows;

        // Use the Select method to find all rows matching the filter.
        foundRows = Document.ActiveDocument.DocDataSet.TrialEvents.Select(expression);
        if (foundRows.Length > 0)
        {
          foreach (DataRow row in foundRows)
          {
            row.Delete();
          }
        }

        // Update Database
        int affectedRows =
          Document.ActiveDocument.DocDataSet.TrialEventsAdapter.Update(Document.ActiveDocument.DocDataSet.TrialEvents);
      }
      catch (Exception ex)
      {
        ExceptionMethods.HandleException(ex);
      }
    }
Esempio n. 3
0
    /// <summary>
    /// This method checks the current trial for the contained
    /// slides and if there is more than one it populates
    /// the given <see cref="TrialTimeLine"/> with <see cref="TrialEvents"/>.
    /// </summary>
    /// <param name="timeline">A <see cref="TrialTimeLine"/> to display the trial sections.</param>
    protected void LoadTrialSlidesIntoTimeline(TrialTimeLine timeline)
    {
      // Update time line with events
      int slideCount = this.CurrentTrial.Count;
      if (slideCount > 1)
      {
        timeline.Duration = slideCount * 1000;
        this.Picture.SectionEndTime = slideCount * 1000;

        SortedList<int, TrialEvent> trialEvents = new SortedList<int, TrialEvent>();
        for (int i = 0; i < slideCount; i++)
        {
          Slide slide = this.CurrentTrial[i];
          TrialEvent slideEvent = new TrialEvent();
          slideEvent.Type = EventType.Slide;
          int time = i * 1000;
          slideEvent.Time = time;
          if (i > 0)
          {
            trialEvents.Add(time, slideEvent);
          }
        }

        timeline.TrialEvents = trialEvents;
        timeline.HighlightFirstSlide();
      }
      else
      {
        timeline.RemoveEvents();
      }
    }
Esempio n. 4
0
    ///////////////////////////////////////////////////////////////////////////////
    // Construction and Initializing methods                                     //
    ///////////////////////////////////////////////////////////////////////////////
    #region CONSTRUCTION

    /// <summary>
    /// Initializes a new instance of the TrialEventOccuredEventArgs class.
    /// </summary>
    /// <param name="newTrialEvent">A <see cref="TrialEvent"/> with 
    /// the occured trial event and params.</param>
    /// <param name="newEventTime">A <see cref="Int64"/> with the time the event occured
    /// measured in sample time.</param>
    public TrialEventOccuredEventArgs(TrialEvent newTrialEvent, long newEventTime)
    {
      this.trialEvent = newTrialEvent;
      this.eventTime = newEventTime;
    }