TaskLink
A dependency between two tasks: the successor (ToId) waits for the predecessor
(FromId) in the way Type says, give or take Lag working
days.
public class TaskLink : INotifyPropertyChanged
Inherits from / implements: INotifyPropertyChanged
Remarks
What it is for
Links are what turn a list of tasks into a schedule: the charts put each task as early as its
links, its planned start and the project's start allow, and the chain of links with no room to
spare is the critical path. Keep them in a collection beside the tasks and give it to each chart's
Links property. A link the reader draws on the Gantt chart, or types into its Predecessors
cell, is added to that collection; one the reader deletes is removed from it.
Links and summaries
A link into a summary task holds back every subtask in it, and a link out of one waits for all
of them. Because a summary's dates belong to its subtasks, only
TaskLinkType.FinishToStart and TaskLinkType.StartToStart can lead
into a summary, and only TaskLinkType.FinishToStart and
TaskLinkType.FinishToFinish can lead out of one.
Links that cannot be used
Nothing about a link ever stops a chart drawing. A link that names a missing task, joins a
task to itself, repeats another link of the same type between the same tasks, joins a summary to
one of its own subtasks, uses a type a summary cannot honour, or closes a loop of tasks waiting for
each other is left out of the schedule and reported in ProjectSchedule.Problems.
Examples
using System.Collections.ObjectModel;
ObservableCollection<TaskLink> links = new ObservableCollection<TaskLink>
{
new TaskLink("brief", "wire"), // wireframes after the brief
new TaskLink("wire", "front"), // front end after the wireframes
new TaskLink("wire", "api", TaskLinkType.StartToStart, 2), // the API two working days into the wireframes
new TaskLink("build", "test"), // testing after the whole Build phase
new TaskLink("test", "live") // go live once testing is done
};See also
Members at a glance
| Constructors | |
|---|---|
TaskLink | Creates an empty finish-to-start link with no lag. Give it at least FromId and
ToId. |
TaskLink | Creates a link from a predecessor to a successor. |
| Properties | |
FromId | Gets or sets the ProjectTask.Id of the predecessor: the task that comes first. |
Id | Gets or sets an identifier for the link, used in events and in
ScheduleProblem.Id. |
Lag | Gets or sets the delay between the predecessor letting go and the successor being free to go. |
ToId | Gets or sets the ProjectTask.Id of the successor: the task that waits. |
Type | Gets or sets which end of the predecessor the link waits for and which end of the successor it holds. |
| Methods | |
Clone | Creates a shallow copy of the link. |
IsNullOrEmpty | Gets the id the link is known by in events and problems. |
OnPropertyChanged | Raises PropertyChanged. A derived link with properties of its own calls this
from their setters so the charts see those changes too. |
ToString | Returns the link as its ends, type and lag, for the debugger. |
| Events | |
PropertyChanged | Occurs when any property of the link changes. The charts listen to it to schedule again. |
Constructors
TaskLink
TaskLink
Creates a link from a predecessor to a successor.
Parameters
fromId- The
ProjectTask.Idof the task that comes first. toId- The
ProjectTask.Idof the task that waits. type- Which ends of the two tasks the link joins. The default is
TaskLinkType.FinishToStart. lag- Working days of delay after the predecessor lets go; negative for a lead (an overlap). The default is 0.
Properties
FromId
Gets or sets the ProjectTask.Id of the predecessor: the task that comes first.
- Value
- The default is
null. An id that is not in the plan leaves the link out of the schedule, reported asScheduleProblemKind.UnknownTask.
Id
Gets or sets an identifier for the link, used in events and in
ScheduleProblem.Id.
- Value
- Any string. The default is
null; a link without one is known by its ends, asfrom->to(seeEffectiveId).
Remarks
Optional: two links between the same tasks are told apart by their type, not their ids.
Lag
Gets or sets the delay between the predecessor letting go and the successor being free to go.
- Value
- Working days; positive for a wait, negative for a lead (an overlap). The default is 0.
Remarks
Lags count working days on the plan's calendar, so a lag of 2 after a task that finishes on a Friday lets the successor start on the Wednesday after.
Example
// Plaster has to dry for three working days before painting starts.
links.Add(new TaskLink("plaster", "paint") { Lag = 3 });
// Proofreading can begin two days before the writing is finished.
links.Add(new TaskLink("write", "proof") { Lag = -2 });ToId
Gets or sets the ProjectTask.Id of the successor: the task that waits.
- Value
- The default is
null. An id that is not in the plan leaves the link out of the schedule, reported asScheduleProblemKind.UnknownTask.
Type
Gets or sets which end of the predecessor the link waits for and which end of the successor it holds.
- Value
- The default is
TaskLinkType.FinishToStart. A value that is not aTaskLinkTypeis scheduled as finish-to-start.
Methods
Clone
Creates a shallow copy of the link.
Returns
A new link with the same ends, type, lag and id.
Remarks
Handlers attached to the original's PropertyChanged event are not carried over:
the copy starts with none.
IsNullOrEmpty
Gets the id the link is known by in events and problems.
OnPropertyChanged
Raises PropertyChanged. A derived link with properties of its own calls this
from their setters so the charts see those changes too.
Parameters
propertyName- The name of the property that changed.
ToString
Returns the link as its ends, type and lag, for the debugger.
Returns
Text such as wire -> api (StartToStart, +2); the lag is left out when it is
zero.