Exemplo n.º 1
0
    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler                                                              //
    ///////////////////////////////////////////////////////////////////////////////
    #region EVENTS

    ///////////////////////////////////////////////////////////////////////////////
    // Eventhandler for Custom Defined Events                                    //
    ///////////////////////////////////////////////////////////////////////////////
    #region CUSTOMEVENTHANDLER

    /// <summary>
    /// The <see cref="TrialEventIDFound"/> event handler.
    /// Raised when trial event id was found in the raw data.
    /// </summary>
    /// <param name="e">
    /// A <see cref="TrialEventIDFoundEventArgs"/> with the new event id.
    /// </param>
    /// .
    private void OnTrialEventIDFound(TrialEventIDFoundEventArgs e)
    {
      if (this.TrialEventIDFound != null)
      {
        this.TrialEventIDFound(this, e);
      }
    }
Exemplo n.º 2
0
    /// <summary>
    /// The <see cref="ReplayPicture.TrialEventIDFound"/> event handler for
    /// the <see cref="VectorGraphics.Canvas.Picture"/> <see cref="replayPicture"/>.
    /// Updates the picture with the occured event if applicable.
    /// </summary>
    /// <param name="sender">Source of the event.</param>
    /// <param name="e">A <see cref="TrialEventIDFoundEventArgs"/> with the event data.</param>
    private void replayPicture_TrialEventIDFound(object sender, TrialEventIDFoundEventArgs e)
    {
      try
      {
        if (!this.TrialEvents.ContainsKey(e.EventID))
        {
          return;
        }

        TrialEvent occuredEvent = this.TrialEvents[e.EventID];
        string parameter = occuredEvent.Param;
        switch (occuredEvent.Type)
        {
          case EventType.Webpage:
            break;
          case EventType.Response:
            break;
          case EventType.Mouse:
            break;
          case EventType.Key:
            break;
          case EventType.Slide:
            int indexOfHash = parameter.IndexOf('#');
            int slideCounter = Convert.ToInt32(parameter.Substring(0, indexOfHash));
            Slide newSlide = this.CurrentTrial[slideCounter];

            if (!this.isUsingTrialVideo && this.replayPicture.BgSlide != newSlide)
            {
              this.LoadSlide(newSlide, ActiveXMode.Off);
            }

            break;
          case EventType.Flash:
            break;
          case EventType.Audio:
            break;
          case EventType.Video:
            break;
          case EventType.Usercam:
            break;

          case EventType.Scroll:
            // Update scroll position
            string[] scrollOffsets = occuredEvent.Param.Split(';');
            Point newScrollPosition = new Point(
              Convert.ToInt32(scrollOffsets[0]),
              Convert.ToInt32(scrollOffsets[1]));

            this.ThreadSafeSetAutoScrollPosition(newScrollPosition);

            break;
        }
      }
      catch (Exception ex)
      {
        ExceptionMethods.HandleExceptionSilent(ex);
      }
    }