コード例 #1
0
ファイル: RecordModule.cs プロジェクト: DeSciL/Ogama
    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for Custom Defined Events                                    //
    ///////////////////////////////////////////////////////////////////////////////

    /// <summary>
    /// The <see cref="PresenterModule.CounterChanged"/> event handler.
    ///   Indicates a slide change in the presenter, so update trial and slide
    ///   counter and the live viewer.
    /// </summary>
    /// <param name="sender">
    /// Source of the event.
    /// </param>
    /// <param name="e">
    /// A <see cref="CounterChangedEventArgs"/> with the event data.
    /// </param>
    private void ObjPresenterCounterChanged(object sender, CounterChangedEventArgs e)
    {
      this.counterChangedTime = this.GetCurrentTime();

      if (this.counterChangedTime < 0)
      {
        throw new ArgumentException("Tracking had not been started");
      }

      if (this.recordingStarttime == -5)
      {
        this.recordingStarttime = this.counterChangedTime;
        this.recordTimerWatch.Start();
        this.tmrRecordClock.Start();

        // Start update timer of control panel viewer
        this.Picture.StartAnimation();
      }

      lock (this)
      {
        this.slideCounter = e.SlideCounter;

        // Don´t use presenters trialCounter
        // Because of using links between trials.
        // and care of trials with multiple slides
        // don´t increase trial sequence counter on this.
        if (this.slideCounter == 0)
        {
          this.trialSequenceCounter++;
        }

        // Set current trial
        if (e.TrialID == -5)
        {
          this.currentTrial = null;
        }
        else
        {
          var trialIndex = this.trials.GetIndexOfTrialByID(e.TrialID);
          if (trialIndex < 0)
          {
            // The trial is not in the default trial list, so it might has been created during recording
            // or is a subtrial of a browsing trial
            trialIndex = PresenterModule.TrialsIncludingNavigatedWebpages.GetIndexOfTrialByID(e.TrialID);
            this.currentTrial = (Trial)PresenterModule.TrialsIncludingNavigatedWebpages[trialIndex].Clone();
          }
          else
          {
            this.currentTrial = this.trials[trialIndex];
          }
        }

        // Set current slide
        this.currentSlide = this.currentTrial != null ? this.currentTrial[this.slideCounter] : null;
      }
    }
コード例 #2
0
ファイル: PresenterModule.cs プロジェクト: DeSciL/Ogama
 /// <summary>
 /// This method raises the <see cref="CounterChanged"/>
 ///   event by invoking the delegates.
 ///   It should be called when the current slide ot trial index has changed.
 /// </summary>
 /// <param name="e">
 /// A <see cref="CounterChangedEventArgs"/> with the event data.
 /// </param>
 /// .
 private void OnCounterChanged(CounterChangedEventArgs e)
 {
   if (this.CounterChanged != null)
   {
     // This is the only place we should not use asynchrous calls.
     this.CounterChanged(this, e);
   }
 }