Working Times
It's important to provide the GanttControl the correct "working times" of resources in your project so that the time span of the tasks can be appropriately determined based on the required duration of the task.
WorkTimeSchedule
This type lets you define a set of working days and times. You can create a custom schedule and assign it to the GanttControl.WorkTimeSchedule property.
If you are going to set this property, make sure to do so before assigning the ItemsSource on the GanttControl. If you have to dynamically change this setting during runtime, then everytime you do so, you will have to reset the ItemsSource property to null and then back to your source for the new schedule to take effect. (This is not handled internally for performance reasons).
Built-in Schedules
a) The default schedule used is a "Monday to Friday, 8AM to 4PM" schedule defined by the WorkTimeSchedule.Schedule8X5 instance.
b) There is also a "Monday to Friday, 24 hours a day" schedule defined by the WorkTimeSchedule.Schedule24X5 instance.
c) If you want a continuous "24 X 7" schedule simply set GanttControl.WorkTimeSchedule property to null.
Custom Schedules
When you look at the examples below, you will see that creating custom schedules are a snap.
a) For example, if you want to create a "Monday to Thursday, 10 hours a day" schedule, you can do so as follows:
public static WorkTimeSchedule Create4Days10HoursSchedule()
{
return new WorkTimeSchedule("Monday - Thursday, 10 Hours",
// This delegate defines your schedule
delegate(DateTime date)
{
if (date.DayOfWeek >= DayOfWeek.Monday && date.DayOfWeek <= DayOfWeek.Thursday)
{
return new TimePeriodCollection()
{
new TimePeriod(date.AddHours(8.0), TimeSpan.FromHours(10))
};
}
return null;
});
}
b) For a "Monday to Thursday, 24 hours a day" schedule, you can do as follows:
public static WorkTimeSchedule Create4Days24HrsSchedule()
{
return new WorkTimeSchedule("Monday - Thursday, 24Hours",
// This delegate defines your schedule
delegate(DateTime date)
{
if (date.DayOfWeek >= DayOfWeek.Monday && date.DayOfWeek <= DayOfWeek.Thursday)
{
return new TimePeriodCollection()
{
new TimePeriod(date.Date, TimeSpan.FromDays(1))
};
}
return null;
});
}
Take a look at the sample GanttControlCustomSchedule for an illustration of this feature.
� RadiantQ 2009 - 2019. All Rights Reserved.