コード例 #1
0
        public TimeLine CreateTimeLine(PeriodSplitter.PeriodSplitter splitter, PeriodNameFormatter PeriodNameFormatter,
                                       BackgroundFormatter backgroundFormatter, string timeLineName, Brush timeLineColor)
        {
            if (splitter.MaxDate != GanttData.MaxDate || splitter.MinDate != GanttData.MinDate)
            {
                throw new ArgumentException("The timeline must have the same max and min -date as the chart");
            }

            var timeLineParts = splitter.Split();

            TimeLine timeline = new TimeLine();

            timeline.Name            = timeLineName;
            timeline.BackgroundColor = timeLineColor;
            foreach (var p in timeLineParts)
            {
                TimeLineItem item = new TimeLineItem()
                {
                    Name = PeriodNameFormatter(p), Start = p.Start, End = p.End.AddSeconds(-1)
                };
                item.BackgroundColor = backgroundFormatter(item);
                timeline.Items.Add(item);
            }

            ganttChartData.TimeLines.Add(timeline);
            return(timeline);
        }
コード例 #2
0
        public void SetGridLinesTimeline(TimeLine timeline, BackgroundFormatter backgroundFormatter)
        {
            if (!ganttChartData.TimeLines.Contains(timeline))
            {
                throw new Exception("Invalid timeline");
            }

            foreach (var item in timeline.Items)
            {
                item.BackgroundColor = backgroundFormatter(item);
            }

            GridLineTimeLine.Clear();
            GridLineTimeLine.Add(timeline);
        }
コード例 #3
0
        public void SetGridLinesTimeline(TimeLine timeline, BackgroundFormatter backgroundFormatter)
        {
            if (!ganttChartData.TimeLines.Contains(timeline))
                throw new Exception("Invalid timeline");

            foreach (var item in timeline.Items)
                item.BackgroundColor = backgroundFormatter(item);

            gridLineTimeLines.Clear();
            gridLineTimeLines.Add(timeline);
            //gridLineTimeLine = timeline;
        }