HypernovaDesktop Components · docs
Binarymission
WinForms › Project Management › TaskLink

TaskLink

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WinForms.Controls.ProjectManagement

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
TaskLinkCreates an empty finish-to-start link with no lag. Give it at least FromId and ToId.
TaskLinkCreates a link from a predecessor to a successor.
Properties
FromIdGets or sets the ProjectTask.Id of the predecessor: the task that comes first.
IdGets or sets an identifier for the link, used in events and in ScheduleProblem.Id.
LagGets or sets the delay between the predecessor letting go and the successor being free to go.
ToIdGets or sets the ProjectTask.Id of the successor: the task that waits.
TypeGets or sets which end of the predecessor the link waits for and which end of the successor it holds.
Methods
CloneCreates a shallow copy of the link.
IsNullOrEmptyGets the id the link is known by in events and problems.
OnPropertyChangedRaises PropertyChanged. A derived link with properties of its own calls this from their setters so the charts see those changes too.
ToStringReturns the link as its ends, type and lag, for the debugger.
Events
PropertyChangedOccurs when any property of the link changes. The charts listen to it to schedule again.

Constructors

Properties

FromId

public string 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 as ScheduleProblemKind.UnknownTask.

Id

public string 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, as from->to (see EffectiveId).
Remarks

Optional: two links between the same tasks are told apart by their type, not their ids.

Lag

public int 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

public string 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 as ScheduleProblemKind.UnknownTask.

Type

public TaskLinkType 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 a TaskLinkType is scheduled as finish-to-start.

Methods

Clone

public TaskLink 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

public string EffectiveId

Gets the id the link is known by in events and problems.

Value
Id when it is set; otherwise FromId and ToId joined as from->to, such as wire->front.

OnPropertyChanged

protected virtual void OnPropertyChanged(string propertyName)

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

public override string 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.

Events

PropertyChanged

public event PropertyChangedEventHandler PropertyChanged

Occurs when any property of the link changes. The charts listen to it to schedule again.

Remarks

A change of FromId, ToId or Id is followed by a second notification for EffectiveId.