Index: ActiviteitenOpvolging/ActiviteitenOpvolging/grids/DataGridViewUserControl.vb =================================================================== diff -u -r1698 -r1699 --- ActiviteitenOpvolging/ActiviteitenOpvolging/grids/DataGridViewUserControl.vb (.../DataGridViewUserControl.vb) (revision 1698) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/grids/DataGridViewUserControl.vb (.../DataGridViewUserControl.vb) (revision 1699) @@ -66,38 +66,46 @@ 'Set label. GridLabel.Text = ConfigsLoader.GridLabelNames(_gridNumber) - 'Changes to data grid can trigger selectio changed event, ignore for now. - _skipSelectionChanged = True + 'Load the data. + LoadData() + Catch ex As Exception + MessageBox.Show($"Could not load {Me.Name}.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + Finally + _skipSelectionChanged = False + End Try + End Sub - 'Update headers and visibility of static columns. - UpdateStaticColumns() + ''' + ''' Fetch the data and fill the data grid view with it. + ''' + Private Sub LoadData() + 'Changes to data grid can trigger selectio changed event, ignores it for now. + _skipSelectionChanged = True - 'Load all work items. - LoadWorkItems() + 'Update headers and visibility of static columns. + UpdateStaticColumns() - 'Generate grid columns for the activities of the work items. - GenerateActivityColumns(_workItems) + 'Load all work items. + LoadWorkItems() - 'Show the work items. - ShowWorkItems(_workItems) + 'Generate grid columns for the activities of the work items. + GenerateActivityColumns(_workItems) - 'Color the work items. - ColorWorkItems(_workItems) + 'Show the work items. + ShowWorkItems(_workItems) - 'Done here because extra columns got generated. - For Each column In WorkItemsDataGridView.Columns - 'Disable sort mode for every header. - column.SortMode = DataGridViewColumnSortMode.NotSortable - 'Make every cell not editable. - column.ReadOnly = True - Next + 'Color the work items. + ColorWorkItems(_workItems) - WorkItemsDataGridView.Refresh() - Catch ex As Exception - MessageBox.Show($"Could not load {Me.Name}.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) - Finally - _skipSelectionChanged = False - End Try + 'Done here because extra columns got generated. + For Each column In WorkItemsDataGridView.Columns + 'Disable sort mode for every header. + column.SortMode = DataGridViewColumnSortMode.NotSortable + 'Make every cell not editable. + column.ReadOnly = True + Next + + WorkItemsDataGridView.Refresh() End Sub ''' @@ -218,16 +226,20 @@ Dim activity = workItem.Activities.Item(activityIndex) 'Fetch the right cell. Based on the activity, the offset is the index of the first activity. Dim cell = row.Cells.Item(activityIndex + firstActivityCellIndex) - UpdateActivityCell(activity, cell) + 'Update time related warning image. + UpdateActivityCellTimeStatusIndication(activity, cell) + 'Update background color. + + 'Update Next End Sub ''' - ''' Update the color and border of the cell of an activity. + ''' Update the image of the cell of an activity. ''' ''' ''' - Private Sub UpdateActivityCell(activity As IActivity, dataGridViewCell As DataGridViewCell) + Private Sub UpdateActivityCellTimeStatusIndication(activity As IActivity, dataGridViewCell As DataGridViewCell) 'Only this type of cell is supported. If Not TypeOf dataGridViewCell Is BorderedTextFigureCell Then Throw New InternalException($"Only cells of type {TypeName(New BorderedTextFigureCell)} are supported when updating the cell for an activity.")