using Infragistics.Controls.Schedules;
public class ProjectDataHelper
{
public static Project GenerateProjectData()
{
// Create a Project instance
Project project = new Project();
// Create a project root ProjectTask
ProjectTask rootTask = new ProjectTask
{
TaskName = "Project Summary Task",
IsManual = false
};
// Add the root task to the project
project.RootTask.Tasks.Add(rootTask);
// Dates in xamGantt are stored in UTC
DateTime startTime = DateTime.Today.ToUniversalTime();
// Add ProjectTask subtasks to the root project task
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Planning",
IsManual = false,
Start = startTime,
Duration = TimeSpan.FromHours(8),
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Documenting",
IsManual = false,
Start = startTime,
// Configure task duration
ManualDuration = ProjectDuration.FromFormatUnits(2, ProjectDurationFormat.Days),
// Set a task constraint
ConstraintDate = DateTime.Today.AddDays(3).ToUniversalTime(),
ConstraintType = ProjectTaskConstraintType.FinishNoLaterThan,
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Creating Demo Application",
IsManual = false,
Start = startTime,
ManualDuration = ProjectDuration.FromFormatUnits(3, ProjectDurationFormat.Days),
ConstraintType = ProjectTaskConstraintType.MustStartOn,
ConstraintDate = DateTime.Today.AddDays(2).ToUniversalTime(),
IsEstimated = true,
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Collecting Feedback",
IsManual = false,
Start = startTime,
ManualDuration = ProjectDuration.FromFormatUnits(1, ProjectDurationFormat.Days),
IsEstimated = true,
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Designing",
IsManual = false,
Start = startTime,
ManualDuration = ProjectDuration.FromFormatUnits(5, ProjectDurationFormat.Days),
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Development",
IsManual = true,
// Manual tasks may have free text for Start and Finish date
ManualStart = new ManualDateTime("Still In Discussion"),
ManualDuration = ProjectDuration.FromFormatUnits(10, ProjectDurationFormat.Days),
ManualFinish = new ManualDateTime("Not Defined Yet"),
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Testing",
IsManual = true,
Start = startTime,
ManualDuration = ProjectDuration.FromFormatUnits(7, ProjectDurationFormat.Days),
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Bug Fixing",
IsManual = true,
Start = startTime,
ManualDuration = ProjectDuration.FromFormatUnits(4, ProjectDurationFormat.Days),
});
rootTask.Tasks.Add(new ProjectTask
{
TaskName = "Project Complete",
IsManual = false,
Start = startTime,
// Set a milestone
IsMilestone = true
});
return project;
}
}