HypernovaDesktop Components · docs
Binarymission
WinForms › Project Management › TaskBoard

TaskBoard

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

A task board: a plan's work as cards in status columns, optionally split into lanes by assignee, category or phase, moved by dragging or entirely from the keyboard.

public partial class TaskBoard : Control

Inherits from / implements: Control

Remarks

A column is a value of Status, and a lane a value of the field LaneBy names. Moving a card changes those fields and the task's Rank, after offering the move as the cancelable CardMoving event. Summary tasks are structure, not work, and are not cards. Keyboard: the arrows move between cards; Space picks the current card up, the arrows then carry it (Shift with Up or Down between lanes), and Space or Enter drops it or Escape puts it back. Enter or a double-click raises TaskActivated.

Members at a glance

TaskBoardCreates an empty board. Give it Tasks, and Columns for a workflow of its own; without columns, the statuses the tasks use are the columns.
CardBackColorThe fill of a card. Empty follows BackColor.
CardBorderColorThe border of a card. Empty is a shade between BackColor and ForeColor.
CardHeightThe height of a card, in logical units. Never less than 48.
ColumnBackColorThe fill of a column behind its cards. Empty is a faint shade of ForeColor over BackColor.
ColumnWidthThe width of a column, in logical units (1/96 inch). Never less than 180.
ColumnsThe columns, in order. Empty uses the statuses the tasks have, in the order they first appear. A task whose status has no column is shown in the first column.
CriticalColorThe stripe down the side of a card whose task is on the critical path.
HolidaysDates that are not worked. Never null: setting null gives an empty collection. An observable collection is watched.
LaneByWhat the board is split into lanes by. None gives one lane: just columns.
LinksThe links between tasks, which decide each card's dates and whether it is critical. Never null: setting null gives an empty collection.
OverLimitColorThe count of a column holding more cards than its limit, and the mark over its heading.
ProgressColorThe thin bar along the bottom of a card that shows how far the task has got.
ProjectStartThe first day work can happen. Null uses the earliest planned start in the plan.
ReadOnlyWhether the reader is prevented from moving cards. Selection, navigation and TaskActivated still work, and so does MoveCard, which is the application's own call.
SelectedTaskThe task whose card is selected, or null when none is. Setting a task that has no card - a summary, or a task not in the plan - clears the selection.
ShowCriticalPathWhether a card on the critical path carries a stripe in CriticalColor.
StrictLimitsWhether a card is refused by a column already holding as many cards as its Limit. Off, a column may pass its limit and says so in red.
TasksThe tasks, as a flat list with parent references. Never null: setting null gives an empty collection. Summary tasks are not cards.
TodayThe date the charts treat as today; null for the computer's date.
WorkingWeekThe days of the week that are worked.
CreateAccessibilityInstanceCreates the accessible object that presents the columns and cards to assistive technology.
DisposeStops watching the plan and releases the fonts, the timer and the tooltip.
EnsureScheduleThe plan as last scheduled: every task's dates and float, the critical path, and anything in the input that could not be used. Scheduled again first when something has changed.
IsInputKeyMakes the arrows, Home, End and the page keys the board's own; Enter too when there is a card to act on, and Escape while a card is carried, so a dialog's default and cancel buttons keep them otherwise.
MoveCardMoves a card as though the reader had: the move is refused by a full column when StrictLimits is on, offered as CardMoving, applied to the task, and followed by CardMoved. It is made even when ReadOnly is set, which only stops the reader. Source is Application.
OnCardMovedRaises CardMoved.
OnCardMovingRaises CardMoving.
OnDpiChangedAfterParentRebuilds everything measured in device pixels when the board moves to a display with a different scale: the fonts, the scroll bars and the scroll range.
OnFontChangedRebuilds the fonts the cards are written in.
OnGotFocusRedraws the focus cue and says which card has the focus.
OnHandleCreatedFits the scroll bars once the window exists, when the display's scale is first known for certain.
OnHandleDestroyedForgets a refresh posted to a window that is going away; the next window posts again.
OnKeyDownThe keys: arrows move between cards (Navigate), Space picks the current card up, Enter activates it; while a card is carried, the arrows move it, Space or Enter drops it and Escape puts it back.
OnLostFocusPuts a carried card back - the keys that would drop it are going elsewhere - and removes the focus cue.
OnMouseCaptureChangedPuts a dragged card back if the mouse is taken away mid-drag, by a message box or a switch of window. After an ordinary drop there is nothing left to put back.
OnMouseDoubleClickA double-click on a card raises TaskActivated.
OnMouseDownA press selects a card and may begin a drag; a press while a card is carried from the keyboard puts it back.
OnMouseLeaveHides the tooltip when the pointer leaves.
OnMouseMoveMoves a dragged card, or keeps the tooltip on the card under the pointer.
OnMouseUpDrops a dragged card.
OnMouseWheelThe wheel scrolls the lanes, sideways with Shift; a dragged card follows.
OnPaintPaints the board. Never throws: a fault is reported and the paint abandoned.
OnResizeFits the scroll bars and the view to the new size.
OnRightToLeftChangedMirrors the board when the reading direction changes.
OnScheduleChangedRaises ScheduleChanged.
OnSelectedTaskChangedRaises SelectedTaskChanged.
OnTaskActivatedRaises TaskActivated.
RescheduleSchedules the plan and lays the board out again now, and raises ScheduleChanged. Needed after changing a plain list or a column in place.
ScrollToTaskScrolls the board until a task's card is in view. Does nothing for a task that has no card.
CardMovedRaised after a card has moved and its task has been changed.
CardMovingRaised before a card moves, by a drag, a keyboard drop or MoveCard. Set Cancel to refuse the move; nothing will have changed.
ScheduleChangedRaised after the plan has been scheduled again because something changed: a task, a link, a collection, a calendar setting, or a call to Reschedule.
SelectedTaskChangedRaised when the selected card changes, by the reader or by SelectedTask.
TaskActivatedRaised when the reader double-clicks a card or presses Enter on the selected one.

Constructors

TaskBoard

public TaskBoard()

Creates an empty board. Give it Tasks, and Columns for a workflow of its own; without columns, the statuses the tasks use are the columns.

Properties

CardBackColor

public Color CardBackColor

The fill of a card. Empty follows BackColor.

CardBorderColor

public Color CardBorderColor

The border of a card. Empty is a shade between BackColor and ForeColor.

CardHeight

public int CardHeight

The height of a card, in logical units. Never less than 48.

ColumnBackColor

public Color ColumnBackColor

The fill of a column behind its cards. Empty is a faint shade of ForeColor over BackColor.

ColumnWidth

public int ColumnWidth

The width of a column, in logical units (1/96 inch). Never less than 180.

Columns

public Collection<BoardColumn> Columns

The columns, in order. Empty uses the statuses the tasks have, in the order they first appear. A task whose status has no column is shown in the first column.

Adding, removing or replacing a column redraws the board. A column's properties are plain values; after changing one in place, call Reschedule. The columns are the application's workflow and are set in code, like the plan itself.

CriticalColor

public Color CriticalColor

The stripe down the side of a card whose task is on the critical path.

Holidays

public IList<DateTime> Holidays

Dates that are not worked. Never null: setting null gives an empty collection. An observable collection is watched.

LaneBy

public BoardLaneBy LaneBy

What the board is split into lanes by. None gives one lane: just columns.

OverLimitColor

public Color OverLimitColor

The count of a column holding more cards than its limit, and the mark over its heading.

ProgressColor

public Color ProgressColor

The thin bar along the bottom of a card that shows how far the task has got.

ProjectStart

public DateTime? ProjectStart

The first day work can happen. Null uses the earliest planned start in the plan.

ReadOnly

public bool ReadOnly

Whether the reader is prevented from moving cards. Selection, navigation and TaskActivated still work, and so does MoveCard, which is the application's own call.

SelectedTask

public ProjectTask SelectedTask

The task whose card is selected, or null when none is. Setting a task that has no card - a summary, or a task not in the plan - clears the selection.

ShowCriticalPath

public bool ShowCriticalPath

Whether a card on the critical path carries a stripe in CriticalColor.

StrictLimits

public bool StrictLimits

Whether a card is refused by a column already holding as many cards as its Limit. Off, a column may pass its limit and says so in red.

Tasks

public IList<ProjectTask> Tasks

The tasks, as a flat list with parent references. Never null: setting null gives an empty collection. Summary tasks are not cards.

An ObservableCollection{T} or a BindingList{T} is watched, and so is every task in it. A plain list is read when it is assigned; call Reschedule after changing one.

Today

public DateTime? Today

The date the charts treat as today; null for the computer's date.

The Gantt chart draws its today line from this. A board has no time axis, so it draws nothing from it; it is here so that one set of plan settings can be given to all three charts alike.

WorkingWeek

public WorkingWeek WorkingWeek

The days of the week that are worked.

Methods

CreateAccessibilityInstance

protected override AccessibleObject CreateAccessibilityInstance()

Creates the accessible object that presents the columns and cards to assistive technology.

Returns. The board's accessible object.

Dispose

protected override void Dispose(bool disposing)

Stops watching the plan and releases the fonts, the timer and the tooltip.

disposing
True when called from Dispose.

EnsureSchedule

public ProjectSchedule Schedule

The plan as last scheduled: every task's dates and float, the critical path, and anything in the input that could not be used. Scheduled again first when something has changed.

IsInputKey

protected override bool IsInputKey(Keys keyData)

Makes the arrows, Home, End and the page keys the board's own; Enter too when there is a card to act on, and Escape while a card is carried, so a dialog's default and cancel buttons keep them otherwise.

keyData
The key, with its modifiers.

Returns. True for a key the board handles.

MoveCard

public bool MoveCard(ProjectTask task, string status, string lane, int index)

Moves a card as though the reader had: the move is refused by a full column when StrictLimits is on, offered as CardMoving, applied to the task, and followed by CardMoved. It is made even when ReadOnly is set, which only stops the reader. Source is Application.

task
The task whose card moves.
status
The column to move it to: a Status on the board.
lane
The lane: an assignee or a category, or a top-level summary task's id when LaneBy is Parent; empty for the lane of tasks without one; null to keep the card's lane. Ignored when the board has no lanes.
index
Its position in the cell, from 0; clamped to the cell.

Returns. True when the card moved; false when the move was refused, cancelled, changed nothing, or named a card or column that is not on the board.

OnCardMoved

protected virtual void OnCardMoved(TaskEventArgs e)

Raises CardMoved.

e
The task whose card moved.

OnCardMoving

protected virtual void OnCardMoving(CardMovingEventArgs e)

Raises CardMoving.

e
The proposed move.

OnDpiChangedAfterParent

protected override void OnDpiChangedAfterParent(EventArgs e)

Rebuilds everything measured in device pixels when the board moves to a display with a different scale: the fonts, the scroll bars and the scroll range.

e
The event data.

OnFontChanged

protected override void OnFontChanged(EventArgs e)

Rebuilds the fonts the cards are written in.

e
The event data.

OnGotFocus

protected override void OnGotFocus(EventArgs e)

Redraws the focus cue and says which card has the focus.

e
The event data.

OnHandleCreated

protected override void OnHandleCreated(EventArgs e)

Fits the scroll bars once the window exists, when the display's scale is first known for certain.

e
The event data.

OnHandleDestroyed

protected override void OnHandleDestroyed(EventArgs e)

Forgets a refresh posted to a window that is going away; the next window posts again.

e
The event data.

OnKeyDown

protected override void OnKeyDown(KeyEventArgs e)

The keys: arrows move between cards (Navigate), Space picks the current card up, Enter activates it; while a card is carried, the arrows move it, Space or Enter drops it and Escape puts it back.

e
The key data.

OnLostFocus

protected override void OnLostFocus(EventArgs e)

Puts a carried card back - the keys that would drop it are going elsewhere - and removes the focus cue.

e
The event data.

OnMouseCaptureChanged

protected override void OnMouseCaptureChanged(EventArgs e)

Puts a dragged card back if the mouse is taken away mid-drag, by a message box or a switch of window. After an ordinary drop there is nothing left to put back.

e
The event data.

OnMouseDoubleClick

protected override void OnMouseDoubleClick(MouseEventArgs e)

A double-click on a card raises TaskActivated.

e
The mouse data.

OnMouseDown

protected override void OnMouseDown(MouseEventArgs e)

A press selects a card and may begin a drag; a press while a card is carried from the keyboard puts it back.

e
The mouse data.

OnMouseLeave

protected override void OnMouseLeave(EventArgs e)

Hides the tooltip when the pointer leaves.

e
The event data.

OnMouseMove

protected override void OnMouseMove(MouseEventArgs e)

Moves a dragged card, or keeps the tooltip on the card under the pointer.

e
The mouse data.

OnMouseUp

protected override void OnMouseUp(MouseEventArgs e)

Drops a dragged card.

e
The mouse data.

OnMouseWheel

protected override void OnMouseWheel(MouseEventArgs e)

The wheel scrolls the lanes, sideways with Shift; a dragged card follows.

e
The mouse data.

OnPaint

protected override void OnPaint(PaintEventArgs e)

Paints the board. Never throws: a fault is reported and the paint abandoned.

e
The paint data.

OnResize

protected override void OnResize(EventArgs e)

Fits the scroll bars and the view to the new size.

e
The event data.

OnRightToLeftChanged

protected override void OnRightToLeftChanged(EventArgs e)

Mirrors the board when the reading direction changes.

e
The event data.

OnScheduleChanged

protected virtual void OnScheduleChanged(EventArgs e)

Raises ScheduleChanged.

e
The event data.

OnSelectedTaskChanged

protected virtual void OnSelectedTaskChanged(EventArgs e)

Raises SelectedTaskChanged.

e
The event data.

OnTaskActivated

protected virtual void OnTaskActivated(TaskEventArgs e)

Raises TaskActivated.

e
The task that was activated.

Reschedule

public void Reschedule()

Schedules the plan and lays the board out again now, and raises ScheduleChanged. Needed after changing a plain list or a column in place.

ScrollToTask

public void ScrollToTask(ProjectTask task)

Scrolls the board until a task's card is in view. Does nothing for a task that has no card.

task
The task to show.

Events

CardMoved

public event EventHandler<TaskEventArgs> CardMoved

Raised after a card has moved and its task has been changed.

CardMoving

public event EventHandler<CardMovingEventArgs> CardMoving

Raised before a card moves, by a drag, a keyboard drop or MoveCard. Set Cancel to refuse the move; nothing will have changed.

ScheduleChanged

public event EventHandler ScheduleChanged

Raised after the plan has been scheduled again because something changed: a task, a link, a collection, a calendar setting, or a call to Reschedule.

SelectedTaskChanged

public event EventHandler SelectedTaskChanged

Raised when the selected card changes, by the reader or by SelectedTask.

TaskActivated

public event EventHandler<TaskEventArgs> TaskActivated

Raised when the reader double-clicks a card or presses Enter on the selected one.