Ejemplo n.º 1
0
        public void DrawActivities(LJD.Graphics g, ViewMetrics viewMetrics, IViewModel eventsHandler)
        {
            PushGraphicsStateForDrawingActivites(g, viewMetrics, HitTestResult.AreaCode.ActivitiesPanel);
            var darkMode = eventsHandler.ColorTheme == Presenters.ColorThemeMode.Dark;

            foreach (var a in viewMetrics.GetActivitiesMetrics(eventsHandler))
            {
                if (a.Activity.Type == ActivityDrawType.Group)
                {
                    continue;
                }

                float round = 2;
                g.FillRoundRectangle(GetActivityBrush(a.Activity.Type), a.ActivityBarRect, round);

                foreach (var ph in a.Phases)
                {
                    var phaseMargin = a.ActivityBarRect.Height / 3;
                    g.FillRectangle(ph.Brush, ph.X1, a.ActivityBarRect.Top + phaseMargin,
                                    Math.Max(ph.X2 - ph.X1, 2), a.ActivityBarRect.Height - phaseMargin - 2);
                }

                foreach (var ms in a.Milestones)
                {
                    g.DrawLine(res.MilestonePen, ms.X, a.ActivityBarRect.Top, ms.X, a.ActivityBarRect.Bottom);
                }

                g.DrawRoundRectangle(res.ActivityBarBoundsPen, a.ActivityBarRect, round);

                if (a.PairedActivityConnectorBounds != null)
                {
                    var r = a.PairedActivityConnectorBounds.Value;
                    g.DrawLine(res.ActivitiesConnectorPen, r.Left, r.Top, r.Left, r.Bottom);
                    g.DrawLine(res.ActivitiesConnectorPen, r.Right, r.Top, r.Right, r.Bottom);
                }
            }

            g.PopState();
        }
Ejemplo n.º 2
0
        public void DrawActivitiesBackground(
            LJD.Graphics g,
            ViewMetrics viewMetrics,
            IViewModel eventsHandler
            )
        {
            PushGraphicsStateForDrawingActivites(g, viewMetrics, HitTestResult.AreaCode.ActivitiesPanel);
            var darkMode = eventsHandler.ColorTheme == Presenters.ColorThemeMode.Dark;

            foreach (var a in viewMetrics.GetActivitiesMetrics(eventsHandler))
            {
                if (a.Activity.IsSelected)
                {
                    g.FillRectangle(res.SelectedActivityBackgroundBrush, a.ActivityLineRect);
                }
                else if (!darkMode && a.Activity.Color.HasValue)
                {
                    using (var bgBrush = MakeBrush(a.Activity.Color.Value))
                        g.FillRectangle(bgBrush, a.ActivityLineRect);
                }
            }
            g.PopState();
        }