예제 #1
0
        /// <summary>
        /// Creates the render element for a thread over one frame.
        /// </summary>
        /// <param name="frameBeginTime">Time offset (in second) to align all micro threads render on the frame time.</param>
        /// <param name="thread">Instance that stores all micro thread events.</param>
        /// <returns>Returns a <c>UIElement</c> (<c>VisualContainerElement</c>) containing rendered micro thread elements for the given thread.</returns>
        private UIElement CreateFrameThreadElement(double frameBeginTime, ThreadInfo thread)
        {
            if (thread == null)
            {
                throw new ArgumentNullException("thread");
            }

            if (thread.MicroThreadItems.Count == 0)
            {
                return(null);
            }

            double y = ThreadLineHeightMargin;
            double h = ThreadLineHeight - ThreadLineHeightMargin * 2.0;

            VisualContainerElement container = new VisualContainerElement();

            foreach (MicroThreadInfo microThread in thread.MicroThreadItems)
            {
                double x = (microThread.BeginTime - frameBeginTime) * PixelsPerSecond;
                double w = (microThread.EndTime - microThread.BeginTime) * PixelsPerSecond;

                if (w <= 0.0)
                {
                    continue;
                }

                container.AddVisual(CreateRectangle(x, y, w, h));
            }

            return(container);
        }
예제 #2
0
        /// <summary>
        /// Creates the render element for a thread over one frame.
        /// </summary>
        /// <param name="frameBeginTime">Time offset (in second) to align all micro threads render on the frame time.</param>
        /// <param name="thread">Instance that stores all micro thread events.</param>
        /// <returns>Returns a <c>UIElement</c> (<c>VisualContainerElement</c>) containing rendered micro thread elements for the given thread.</returns>
        private UIElement CreateFrameThreadElement(double frameBeginTime, ThreadInfo thread)
        {
            if (thread == null)
                throw new ArgumentNullException("thread");

            if (thread.MicroThreadItems.Count == 0)
                return null;

            double y = ThreadLineHeightMargin;
            double h = ThreadLineHeight - ThreadLineHeightMargin * 2.0;

            VisualContainerElement container = new VisualContainerElement();

            foreach (MicroThreadInfo microThread in thread.MicroThreadItems)
            {
                double x = (microThread.BeginTime - frameBeginTime) * PixelsPerSecond;
                double w = (microThread.EndTime - microThread.BeginTime) * PixelsPerSecond;

                if (w <= 0.0)
                    continue;

                container.AddVisual(CreateRectangle(x, y, w, h));
            }

            return container;
        }