Пример #1
0
    /// <summary>
    /// Main animation method. Loops current samples and updates
    /// drawing elements referring to time left since last call.
    /// </summary>
    /// <remarks>Switches drawing modes and calls referring special drawing methods.</remarks>
    private void DisplayUpdating()
    {
      // Initialize progress variables
      var isFinished = false;
      var percentComplete = 0;

      if (this.currentLoopState.RowCounter < this.replayTable.Rows.Count)
      {
        var processEndingTime = DateTime.Now.Ticks - this.pauseTime.Ticks;
        var differenceInTicks = processEndingTime - this.currentLoopState.ProcessBeginningTime.Ticks;
        var differenceInMS = differenceInTicks / 10000f * this.speed;

        this.RenderTimeRange(this.currentLoopState.RowCounter, (long)differenceInMS);
      }

      // Report progress as a percentage of the total task.
      percentComplete = Convert.ToInt32(Convert.ToSingle(this.currentLoopState.RowCounter) /
        this.replayTable.Rows.Count * 100);

      var rowTimeInMS = 0;

      if (this.currentLoopState.RowCounter >= this.replayTable.Rows.Count)
      {
        // Stop Updating
        isFinished = true;
      }
      else
      {
        // Get current DataRow
        var row = this.replayTable.Rows[this.currentLoopState.RowCounter];

        // Catch actual TrialTime
        rowTimeInMS = (int)(Convert.ToInt64(row[3]) - this.currentLoopState.TrialStartTimeInMS);
      }

      var pea = new ProgressEventArgs(isFinished, percentComplete, rowTimeInMS);
      this.OnProgress(pea);
    }
Пример #2
0
 /// <summary>
 /// The <see cref="VectorGraphics.Canvas.Picture.Progress"/> event handler for
 /// the <see cref="ReplayPicture"/>.
 /// This method updates time slider caret and stops
 /// the animation if the trial has finished.
 /// </summary>
 /// <param name="sender">Source of the event.</param>
 /// <param name="e">A <see cref="ProgressEventArgs"/>with time and status</param>
 private void replayPicture_Progress(object sender, ProgressEventArgs e)
 {
   // Check for end of trial.
   if (e.Finished || e.Millisecond >= this.trialTimeLine.SectionEndTime)
   {
     this.StopPlaying();
     this.trialTimeLine.CurrentTime = this.trialTimeLine.SectionEndTime;
   }
   else if (e.Millisecond != 0)
   {
     this.trialTimeLine.CurrentTime = e.Millisecond;
     this.currentTrialTime = e.Millisecond;
   }
 }
Пример #3
0
    /// <summary>
    /// Overridden. Calls picture update method. Invoked from Picture Animation timer tick method.
    /// </summary>
    /// <param name="sender">sending frame, normally base picture class timer</param>
    /// <param name="e">An empty <see cref="EventArgs"/></param>
    /// <remarks>Starts updating the readed samples for the timespan that
    /// is over since the last update.</remarks>
    protected override void ForegroundTimerTick(object sender, EventArgs e)
    {
      TimeSpan timeLeft = new TimeSpan(DateTime.Now.Ticks - this.animationStartTime);
      this.playTime = (int)timeLeft.TotalMilliseconds;
      this.DrawFixations(false);

      bool isFinished = false;

      if (this.playTime > this.SectionEndTime)
      {
        isFinished = true;
      }

      int percentComplete = (int)(this.playTime / (float)this.SectionEndTime * 100);
      ProgressEventArgs pea = new ProgressEventArgs(isFinished, percentComplete, (int)this.playTime);
      this.OnProgress(pea);
      this.lastPlayTime = this.playTime;
    }
Пример #4
0
 /// <summary>
 /// The event handler for the Progress event of the image handler.
 /// Notifies the splash with the current progress percentage.
 /// </summary>
 /// <param name="sender">Source of the event</param>
 /// <param name="e">A <see cref="ProgressEventArgs"/> with the progress percentage.</param>
 private void imageHandler_Progress(object sender, ProgressEventArgs e)
 {
   this.newSplash.ProgressPercentage = e.ProgressInPercent;
 }
Пример #5
0
 /// <summary>
 /// The protected OnProgress method raises the progress event by invoking
 ///   the delegates
 /// </summary>
 /// <param name="e">
 /// A <see cref="ProgressEventArgs"/> with the
 ///   progress event arguments
 /// </param>
 protected virtual void OnProgress(ProgressEventArgs e)
 {
   if (this.Progress != null)
   {
     // Invokes the delegates. 
     this.Progress(this, e);
   }
 }