Index: ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsLoader.vb
===================================================================
diff -u -r1698 -r1700
--- ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsLoader.vb (.../ConfigsLoader.vb) (revision 1698)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/configs/ConfigsLoader.vb (.../ConfigsLoader.vb) (revision 1700)
@@ -265,6 +265,7 @@
Return New Dictionary(Of ActivityStateEnum, Color)(_colorsActivityReadOnly)
End Get
End Property
+ Public ReadOnly Property AllFinishedActivitiesColor As color
Private ReadOnly _colorsUsers As New List(Of Color)
Public ReadOnly Property ColorsUsers As List(Of Color)
Get
@@ -319,6 +320,8 @@
AddColorActivity(identifier, value, True)
ElseIf identifier.Contains("AgColorActivity") Then
AddColorActivity(identifier, value, False)
+ ElseIf identifier.Equals("ColorActivityAllFinished") Then
+ _AllFinishedActivitiesColor = GetColorFromHexStringValue(value)
ElseIf identifier.Contains("ColorUser") Then
_colorsUsers.Add(GetColorFromHexStringValue(value))
Else
@@ -346,7 +349,7 @@
If Not m.Success Then
'No results.
- Throw New ConfigurationException($"Could not get the state for assigning a color for DueOut. Identifier is '{identifier}'.")
+ Throw New ConfigurationException($"Could not get the state for assigning a color for an activity. Identifier is '{identifier}'.")
End If
'If successful, extract the state name.
@@ -410,17 +413,17 @@
End If
'Before activity status image.
- If _ActivityBeforeStatusImage is Nothing Then
+ If _ActivityBeforeStatusImage Is Nothing Then
Throw New ConfigurationException("The activity before status image is not correctly defined.")
End If
'Almost activity status image.
- If _ActivityAlmostStatusImage is Nothing Then
+ If _ActivityAlmostStatusImage Is Nothing Then
Throw New ConfigurationException("The activity almost status image is not correctly defined.")
End If
'Late activity status image.
- If _ActivityLateStatusImage is Nothing Then
+ If _ActivityLateStatusImage Is Nothing Then
Throw New ConfigurationException("The activity late status image is not correctly defined.")
End If
@@ -432,12 +435,17 @@
End If
'Colors activities readonly.
- If _colorsActivityReadOnly.Keys.Count <> ([Enum].GetValues(GetType(ActivityStateEnum)).Length - 2) Then
+ If _colorsActivityReadOnly.Keys.Count <> ([Enum].GetValues(GetType(ActivityStateEnum)).Length) Then
'Amount of enum values and entries in the dictionary differ. ReadOnly doesn't have a color value for the 2 special activities.
Throw New ConfigurationException($"The amount of colors defined for the different states of readonly activities differs from the amount of states.
There are {[Enum].GetValues(GetType(ActivityStateEnum)).Length} total states and {_colorsActivityReadOnly.Keys.Count} colors are defined.")
End If
+ 'All finished activity color.
+ If AllFinishedActivitiesColor = Color.Empty Then
+ Throw New ConfigurationException("The color for all finished activities is not defined.")
+ End If
+
'Colors users.
If _colorsUsers.Count < NumberOfUsers Then
Throw New ConfigurationException($"The colors for the users are not defined or are fewer than the amount of users {NumberOfUsers}.")
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/IWorkItem.vb
===================================================================
diff -u -r1688 -r1700
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/IWorkItem.vb (.../IWorkItem.vb) (revision 1688)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/IWorkItem.vb (.../IWorkItem.vb) (revision 1700)
@@ -7,4 +7,10 @@
Property Remark As String
Property EndTimeStamp As DateTime
Property Activities As List(Of IActivity)
+
+ '''
+ ''' Get whether or not all non-read only activities have status finished.
+ '''
+ '''
+ Function AreAllActivatableActivitiesFinished As boolean
End Interface
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/enums/ActivityStateEnum.vb
===================================================================
diff -u -r1693 -r1700
--- ActiviteitenOpvolging/ActiviteitenOpvolging/enums/ActivityStateEnum.vb (.../ActivityStateEnum.vb) (revision 1693)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/enums/ActivityStateEnum.vb (.../ActivityStateEnum.vb) (revision 1700)
@@ -3,7 +3,6 @@
Pauzed
Started
Finished
- AllFinished
Zero
End Enum
@@ -23,8 +22,6 @@
Return ActivityStateEnum.Started
Case "finished"
Return ActivityStateEnum.Finished
- Case "allfinished"
- Return ActivityStateEnum.AllFinished
Case "zero"
Return ActivityStateEnum.Zero
Case Else
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/grids/DataGridViewUserControl.vb
===================================================================
diff -u -r1699 -r1700
--- ActiviteitenOpvolging/ActiviteitenOpvolging/grids/DataGridViewUserControl.vb (.../DataGridViewUserControl.vb) (revision 1699)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/grids/DataGridViewUserControl.vb (.../DataGridViewUserControl.vb) (revision 1700)
@@ -191,8 +191,9 @@
workItem.DeliverToResource,
workItem.Remark
}
- 'Add data from activities to end of list.
- data.AddRange(workItem.Activities.Select(Function(activity) activity.QuantityToProduce.ToString()))
+ 'Add data from activities to end of list. 0 gets replaced by empty string.
+ data.AddRange(workItem.Activities.Select(
+ Function(activity) If(activity.QuantityToProduce = 0, String.Empty, activity.QuantityToProduce.ToString())))
'Add as a row to the data grid view.
WorkItemsDataGridView.Rows.Add(data.ToArray())
Next
@@ -229,8 +230,8 @@
'Update time related warning image.
UpdateActivityCellTimeStatusIndication(activity, cell)
'Update background color.
-
- 'Update
+ UpdateActivityCellBackground(workItem, activity, cell)
+ 'todo Update border based on user
Next
End Sub
@@ -269,6 +270,28 @@
End Sub
'''
+ '''
+ '''
+ '''
+ '''
+ Private Sub UpdateActivityCellBackground(workItem As IWorkItem, activity As IActivity, dataGridViewCell As DataGridViewCell)
+ 'Check if readonly.
+ If activity.IsReadOnly Then
+ 'It's read only.
+ dataGridViewCell.Style.BackColor = ConfigsLoader.ColorsActivitiesReadOnly(activity.Status)
+ Else
+ 'It's not read only, check if not all activities have status finished.
+ If Not workItem.AreAllActivatableActivitiesFinished() Then
+ 'Not all activities are finished.
+ dataGridViewCell.Style.BackColor = ConfigsLoader.ColorsActivities(activity.Status)
+ Else
+ 'All activities are finished.
+ dataGridViewCell.Style.BackColor = ConfigsLoader.AllFinishedActivitiesColor
+ End If
+ End If
+ End Sub
+
+ '''
''' Disable the selection changed event, useful for ignoring triggers by adding new rows.
'''
Private _skipSelectionChanged = False
@@ -296,8 +319,7 @@
'Check if activity is finished, zero or read only.
If activity.Status = ActivityStateEnum.Finished Or
- activity.Status = ActivityStateEnum.AllFinished Or
- activity.Status = ActivityStateEnum.Zero Or
+ activity.Status = ActivityStateEnum.Zero Or
activity.IsReadOnly Then
'If equal to one of those, remove selection.
WorkItemsDataGridView.ClearSelection()
Index: ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/WorkItem.vb
===================================================================
diff -u -r1688 -r1700
--- ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/WorkItem.vb (.../WorkItem.vb) (revision 1688)
+++ ActiviteitenOpvolging/ActiviteitenOpvolging/domain/classes/implementations/WorkItem.vb (.../WorkItem.vb) (revision 1700)
@@ -7,4 +7,9 @@
Public Property Remark As String Implements IWorkItem.Remark
Public Property EndTimeStamp As DateTime Implements IWorkItem.EndTimeStamp
Public Property Activities As List(Of IActivity) Implements IWorkItem.Activities
+
+ '''
+ Public Function AreAllActivatableActivitiesFinished() As Boolean Implements IWorkItem.AreAllActivatableActivitiesFinished
+ Return Activities.All(Function(activity) Not activity.IsReadOnly And activity.Status = ActivityStateEnum.Finished)
+ End Function
End Class