コード例 #1
0
        private void GenerateGanttChart()
        {
            GanttChartAreaCtrl.ClearGantt();
            GanttChartDto ganttChartDto = ViewModel.GanttChartDto;

            if (ganttChartDto != null)
            {
                IList <IDependentActivity <int> > dependentActivities = ganttChartDto.DependentActivities;
                IList <ResourceSeriesDto>         resourceSeriesSet   = ganttChartDto.ResourceSeriesSet;
                IList <IResourceSchedule <int> >  resourceSchedules   = ganttChartDto.ResourceSchedules;

                m_DateTimeCalculator.UseBusinessDays(ViewModel.UseBusinessDays);

                DateTime projectStart = ViewModel.ProjectStart;

                DateTime minDate = DatePicker.SelectedDate ?? projectStart;
                DateTime maxDate = minDate.AddDays(DaysSelect.Value.GetValueOrDefault());
                GanttChartAreaCtrl.Initialize(minDate, maxDate);

                // Create timelines and define how they should be presented.
                GanttChartAreaCtrl.CreateTimeLine(new PeriodYearSplitter(minDate, maxDate), FormatYear);
                GanttChartAreaCtrl.CreateTimeLine(new PeriodMonthSplitter(minDate, maxDate), FormatMonth);
                TimeLine gridLineTimeLine = GanttChartAreaCtrl.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDay);
                //GanttChartAreaCtrl.CreateTimeLine(new PeriodDaySplitter(minDate, maxDate), FormatDayName);

                // Attach gridlines.
                GanttChartAreaCtrl.SetGridLinesTimeline(gridLineTimeLine, DetermineBackground);

                // Prep formatting helpers.
                SlackColorFormatLookup colorFormatLookup     = null;
                ArrowGraphSettingsDto  arrowGraphSettingsDto = ViewModel.ArrowGraphSettingsDto;

                if (arrowGraphSettingsDto?.ActivitySeverities != null)
                {
                    colorFormatLookup = new SlackColorFormatLookup(arrowGraphSettingsDto.ActivitySeverities);
                }

                if (GroupByResource.IsChecked.GetValueOrDefault())
                {
                    BuildGanttChart(dependentActivities, resourceSeriesSet, resourceSchedules, projectStart, colorFormatLookup);
                }
                else
                {
                    BuildGanttChart(dependentActivities, projectStart, colorFormatLookup);
                }
            }
        }
コード例 #2
0
        private void GenerateGanttChartFromGraphCompilation()
        {
            lock (m_Lock)
            {
                GanttChartDto = null;
                IList <IDependentActivity <int> > dependentActivities =
                    GraphCompilation.DependentActivities
                    .Select(x => (IDependentActivity <int>)x.WorkingCopy())
                    .ToList();

                if (!HasCompilationErrors &&
                    dependentActivities.Any())
                {
                    IList <IDependentActivity <int> > orderedActivities =
                        dependentActivities.OrderBy(x => x.EarliestStartTime)
                        .ThenBy(x => x.Duration)
                        .ToList();

                    ArrowGraphSettingsDto            arrowGraphSettings = ArrowGraphSettingsDto;
                    IList <IResourceSchedule <int> > resourceSchedules  = GraphCompilation.ResourceSchedules;
                    IList <ResourceSeriesDto>        resourceSeriesSet  = ResourceSeriesSet;

                    if (arrowGraphSettings != null &&
                        resourceSchedules != null &&
                        resourceSeriesSet != null)
                    {
                        GanttChartDto = new GanttChartDto
                        {
                            DependentActivities = orderedActivities,
                            ResourceSchedules   = resourceSchedules,
                            ResourceSeriesSet   = resourceSeriesSet,
                            IsStale             = false,
                        };
                    }
                }
            }
            PublishGanttChartDataUpdatedPayload();
        }