Пример #1
0
        public FrameInfo Duplicate()
        {
            FrameInfo duplicate = new FrameInfo();

            duplicate.FrameNumber = FrameNumber;
            duplicate.BeginTime = BeginTime;
            duplicate.EndTime = EndTime;
            ThreadItems.ForEach(item => duplicate.ThreadItems.Add(item.Duplicate()));

            return duplicate;
        }
Пример #2
0
 private void RaiseLastFrameRenderEvent(ProcessInfo processData, FrameInfo frameData)
 {
     RaiseEvent(new FrameRenderRoutedEventArgs { ProcessData = processData, FrameData = frameData });
 }
Пример #3
0
        /// <summary>
        /// Creates the render elements of all threads over one frame.
        /// </summary>
        /// <param name="frame">Instance that stores all thread data.</param>
        /// <returns>Returns a <c>Panel</c> (<c>Canvas</c>) containing rendered thread elements for the given frame.</returns>
        private FrameworkElement CreateFrameElement(FrameInfo frame)
        {
            if (frame == null)
                throw new ArgumentNullException("frame");

            if (frame.ThreadItems.Count == 0)
                return null;

            if (frame.ThreadItems.Count > maxThreadCount)
            {
                maxThreadCount = frame.ThreadItems.Count;
                InvalidateVisual();
            }

            Canvas canvas = new Canvas();

            int threadIndex = 0;
            foreach (ThreadInfo thread in frame.ThreadItems)
            {
                UIElement frameThread = CreateFrameThreadElement(frame.BeginTime, thread);

                if (frameThread != null)
                {
                    frameThread.SetValue(Canvas.TopProperty, threadIndex * ThreadLineHeight);
                    canvas.Children.Add(frameThread);
                }

                threadIndex++;
            }

            VisualElement frameDelimiter = new VisualElement(CreateLine(maxThreadCount * ThreadLineHeight));
            frameDelimiter.SetValue(Canvas.LeftProperty, -(delimiterPen.Thickness / 2.0));
            canvas.Children.Add(frameDelimiter);

            double w = (frame.EndTime - frame.BeginTime) * PixelsPerSecond;
            canvas.Children.Add(new VisualElement(CreateText(frame.FrameNumber.ToString(), w, ThreadLineHeight)));

            return canvas;
        }