示例#1
0
 public void SetTopViewLive()
 {
     if (mFrames != null)
     {
         mTopFrameMarker = new TimeLineMarker(mFrames.Count - 1);
     }
 }
示例#2
0
        protected void OnFrameSelected(MouseButtons context)
        {
            if (mFrames == null)
            {
                return;
            }
            int nearestFrame = (int)((mMouseX * mRange / this.Width) + mXOffset);

            if ((mFrames.Count > nearestFrame) && (nearestFrame >= 0))
            {
                Frame f = (Frame)(mFrames[nearestFrame]);

                if (OldFrameSelected != null)
                {
                    OldFrameSelected(this, f, context);
                }

                if (context == MouseButtons.Left)
                {
                    mTopFrameMarker = new TimeLineMarker(nearestFrame);
                }
                else if (context == MouseButtons.Right)
                {
                    mBottomFrameMarker = new TimeLineMarker(nearestFrame);
                }
            }
            else
            {
                if ((NewestFrameSelected != null) && (mFrames.Count > 1))
                {
                    NewestFrameSelected(this, (Frame)(mFrames[mFrames.Count - 1]), context);
                }

                if (context == MouseButtons.Right)
                {
                    mBottomFrameMarker = new TimeLineMarker(mFrames.Count - 1);
                }
            }
        }
示例#3
0
        ///////////////////////////////////////////////////////////////////////////////
        // Eventhandler for Custom Defined Events                                    //
        ///////////////////////////////////////////////////////////////////////////////
        #region CUSTOMEVENTHANDLER
        #endregion //CUSTOMEVENTHANDLER

        #endregion //EVENTS

        ///////////////////////////////////////////////////////////////////////////////
        // Methods and Eventhandling for Background tasks                            //
        ///////////////////////////////////////////////////////////////////////////////
        #region BACKGROUNDWORKER
        #endregion //BACKGROUNDWORKER

        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region PRIVATEMETHODS

        /// <summary>
        /// Converts the given <see cref="SortedList{Int32,TrialEvent}"/> to
        /// <see cref="TimeLineEvent"/> that are displayed in the timeline.
        /// </summary>
        /// <param name="trialEvents">A <see cref="SortedList{Int32,TrialEvent}"/>
        /// with the trial events to be shown.</param>
        private void SubmitTrialEventsToTimeline(SortedList <int, TrialEvent> trialEvents)
        {
            this.TimeLineEvents.Clear();
            this.TimeLineMarkers.Clear();
            this.slideEvents.Clear();
            this.slideEvents.Add(new TimeLineEvent(0, "Slide", 2f, Color.Blue, TimeLinePosition.Above));

            if (trialEvents.Count > 30 && !this.EventFilterList.Contains("MouseUp"))
            {
                this.EventFilterList.Add("Scroll");
                this.EventFilterList.Add("MouseUp");
                this.EventFilterList.Add("MouseDown");
                this.EventFilterList.Add("KeyDown");
                this.EventFilterList.Add("KeyUp");
                string message = "To provide acceptable performance OGAMA now hides the mouse and scroll events in the time line " +
                                 " at the bottom of the module. You may reactivate them by right-clicking on this timeline.";
                ExceptionMethods.ProcessMessage("Lots of events in that trial ...", message);
            }

            foreach (TrialEvent trialEvent in trialEvents.Values)
            {
                TimeLineEvent newTimeLineEvent = new TimeLineEvent();
                newTimeLineEvent.Time = (int)trialEvent.Time;
                switch (trialEvent.Type)
                {
                case EventType.Mouse:
                    newTimeLineEvent.Position    = TimeLinePosition.Below;
                    newTimeLineEvent.StrokeWidth = 1f;
                    newTimeLineEvent.StrokeColor = Color.Yellow;
                    if (((InputEvent)trialEvent).Task == InputEventTask.Up)
                    {
                        newTimeLineEvent.ImageKey = "MouseUp";
                    }
                    else if (((InputEvent)trialEvent).Task == InputEventTask.Down)
                    {
                        newTimeLineEvent.ImageKey = "MouseDown";
                    }

                    this.TimeLineEvents.Add(newTimeLineEvent);
                    break;

                case EventType.Key:
                    newTimeLineEvent.Position    = TimeLinePosition.Below;
                    newTimeLineEvent.StrokeWidth = 1f;
                    newTimeLineEvent.StrokeColor = Color.YellowGreen;
                    newTimeLineEvent.ImageKey    = "Key";
                    this.TimeLineEvents.Add(newTimeLineEvent);
                    break;

                case EventType.Slide:
                    newTimeLineEvent.Position    = TimeLinePosition.Above;
                    newTimeLineEvent.StrokeWidth = 2f;
                    newTimeLineEvent.StrokeColor = Color.Blue;
                    newTimeLineEvent.ImageKey    = "Slide";
                    this.TimeLineEvents.Add(newTimeLineEvent);
                    this.slideEvents.Add(newTimeLineEvent);
                    break;

                case EventType.Flash:
                    newTimeLineEvent.Position    = TimeLinePosition.Above;
                    newTimeLineEvent.StrokeWidth = 2f;
                    newTimeLineEvent.StrokeColor = Color.Magenta;
                    newTimeLineEvent.ImageKey    = "Flash";
                    this.TimeLineEvents.Add(newTimeLineEvent);
                    break;

                case EventType.Audio:
                    newTimeLineEvent.Position    = TimeLinePosition.Below;
                    newTimeLineEvent.StrokeWidth = 1f;
                    newTimeLineEvent.StrokeColor = Color.Orange;
                    newTimeLineEvent.ImageKey    = "Sound";
                    this.TimeLineEvents.Add(newTimeLineEvent);
                    break;

                case EventType.Video:
                    break;

                case EventType.Webpage:
                    break;

                case EventType.Usercam:
                    break;

                case EventType.Response:
                    newTimeLineEvent.Position    = TimeLinePosition.Above;
                    newTimeLineEvent.StrokeWidth = 2f;
                    newTimeLineEvent.StrokeColor = Color.Blue;
                    newTimeLineEvent.ImageKey    = "Slide";
                    this.TimeLineEvents.Add(newTimeLineEvent);
                    break;

                case EventType.Marker:
                    TimeLineMarker newTimeLineMarker = new TimeLineMarker();
                    newTimeLineMarker.Time        = (int)trialEvent.Time;
                    newTimeLineMarker.EventID     = (int)trialEvent.EventID;
                    newTimeLineMarker.MarkerColor = Color.Yellow;
                    this.TimeLineMarkers.Add(newTimeLineMarker);
                    break;

                case EventType.Scroll:
                    newTimeLineEvent.Position    = TimeLinePosition.Above;
                    newTimeLineEvent.StrokeWidth = 0f;
                    newTimeLineEvent.StrokeColor = Color.Transparent;
                    newTimeLineEvent.ImageKey    = "Scroll";
                    this.TimeLineEvents.Add(newTimeLineEvent);
                    break;
                }
            }

            this.Invalidate();
        }