Пример #1
0
        void InitNode(EventNode node, double frameStartMS, int level)
        {
            double height = FrameHeightConverter.Convert(node.Entry.Duration);

            if (height < 6.0 && level != 0)
            {
                return;
            }

            Rectangle rect = new Rectangle();

            rect.Width  = double.NaN;
            rect.Height = height;
            rect.Fill   = new SolidColorBrush(node.Entry.Description.Color);

            double startTime = (node.Entry.StartMS - frameStartMS);

            rect.Margin            = new Thickness(0, FrameHeightConverter.Convert(startTime), 0, 0);
            rect.VerticalAlignment = VerticalAlignment.Top;

            LayoutRoot.Children.Add(rect);

            foreach (EventNode child in node.Children)
            {
                InitNode(child, frameStartMS, level + 1);
            }
        }
Пример #2
0
        void InitNode(EventNode node, double frameStartMS, int level)
        {
            double height = FrameHeightConverter.Convert(node.Entry.Duration);

            if (height < 6.0 && level != 0)
            {
                return;
            }

            if (brushes.ContainsKey(node.Entry.Description.Color) == false)
            {
                UInt32 color    = node.Entry.Description.Color;
                var    sysColor = Color.FromArgb((byte)(color >> 24),
                                                 (byte)(color >> 16),
                                                 (byte)(color >> 8),
                                                 (byte)(color));
                var brush = new SolidColorBrush(sysColor);
                brushes.Add(color, brush);
            }

            Rectangle rect = new Rectangle();

            rect.Width  = double.NaN;
            rect.Height = height;
            rect.Fill   = brushes[node.Entry.Description.Color];

            double startTime = (node.Entry.StartMS - frameStartMS);

            rect.Margin            = new Thickness(0, FrameHeightConverter.Convert(startTime), 0, 0);
            rect.VerticalAlignment = VerticalAlignment.Top;

            LayoutRoot.Children.Add(rect);

            foreach (EventNode child in node.Children)
            {
                InitNode(child, frameStartMS, level + 1);
            }
        }