Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb =================================================================== diff -u -r1716 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb (.../ActiviteitenOpvolgingForm.vb) (revision 1716) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolgingForm.vb (.../ActiviteitenOpvolgingForm.vb) (revision 1717) @@ -127,5 +127,13 @@ throw New Exception($"Could not load the employee user controls.{vbNewLine}{ex.Message}") End Try End Sub + + Public Function GetAllEmployees() As ICollection(Of IEmployee) Implements IEmployeePickerParentUserControl.GetAllEmployees + Return _domainController.GetAvailableEmployees() + End Function + + Public Sub SelectEmployee(employee As IEmployee) Implements IEmployeePickerParentUserControl.SelectEmployee + _domainController.SelectEmployee(employee) + End Sub #End Region End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/IEmployeePickerUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/IEmployeePickerUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/IEmployeePickerUserControl.vb (revision 1717) @@ -0,0 +1,3 @@ +Public Interface IEmployeePickerUserControl + +End Interface Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj.DotSettings =================================================================== diff -u -r1715 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj.DotSettings (.../ActiviteitenOpvolging.vbproj.DotSettings) (revision 1715) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj.DotSettings (.../ActiviteitenOpvolging.vbproj.DotSettings) (revision 1717) @@ -11,4 +11,7 @@ True True True + True + True + True True \ No newline at end of file Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/IEmployeeDetailParentUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/IEmployeeDetailParentUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/IEmployeeDetailParentUserControl.vb (revision 1717) @@ -0,0 +1,11 @@ +Public Interface IEmployeeDetailParentUserControl + ''' + ''' Get the employee. + ''' + ''' + Function FetchEmployee() As IEmployee + + Sub StartActivity() + Sub PauzeActivity() + Sub StopActivity() +End Interface Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.resx =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.resx (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.resx (revision 1717) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/IEmployeesMainForm.vb =================================================================== diff -u -r1716 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/IEmployeesMainForm.vb (.../IEmployeesMainForm.vb) (revision 1716) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/IEmployeesMainForm.vb (.../IEmployeesMainForm.vb) (revision 1717) @@ -1,3 +1,4 @@ Public Interface IEmployeesMainForm + inherits IEmployeePickerParentUserControl End Interface Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeUserControl.Designer.vb =================================================================== diff -u -r1716 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeUserControl.Designer.vb (.../EmployeeUserControl.Designer.vb) (revision 1716) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeUserControl.Designer.vb (.../EmployeeUserControl.Designer.vb) (revision 1717) @@ -22,16 +22,29 @@ 'Do not modify it using the code editor. _ Private Sub InitializeComponent() + Me.UserControlPanel = New System.Windows.Forms.Panel() Me.SuspendLayout ' + 'UserControlPanel + ' + Me.UserControlPanel.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) + Me.UserControlPanel.Location = New System.Drawing.Point(3, 3) + Me.UserControlPanel.Name = "UserControlPanel" + Me.UserControlPanel.Size = New System.Drawing.Size(494, 594) + Me.UserControlPanel.TabIndex = 0 + ' 'EmployeeUserControl ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.UserControlPanel) Me.Name = "EmployeeUserControl" Me.Size = New System.Drawing.Size(500, 600) Me.ResumeLayout(false) End Sub + Friend WithEvents UserControlPanel As Panel End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.vb (revision 1717) @@ -0,0 +1,72 @@ +Imports ActiviteitenOpvolging.configs + +Public Class EmployeeDetailUserControl + Implements IEmployeeDetailUserControl + + Private ReadOnly _parentUserControl As IEmployeeDetailParentUserControl + + Private Sub New() + ' This call is required by the designer. + InitializeComponent() + End Sub + + ''' + ''' Initialises the user form. + ''' + ''' The form containing this user control + Sub New(parentForm As IEmployeeUserControl) + 'Call base constructor. + Me.New() + 'Set parameters. + + 'Parent form. + 'Value can't be Nothing. + If parentForm Is Nothing Then Throw New InternalException($"The parent user control can't be 'Nothing' in a {Me.Name}.") + _parentUserControl = parentForm + End Sub + + ''' + Public Sub UpdateInformation(employee As IEmployee) Implements IEmployeeDetailUserControl.UpdateInformation + 'todo update information + End Sub + + Private Sub EmployeeUserControl_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + 'Set back color corresponding to the employee index. + BackColor = Color.White + ForeColor = Color.Black + + 'Set border colors of the buttons. + StartButton.BackColor = ConfigsLoader.ColorsActivities(ActivityStateEnum.Started) + PauzeButton.BackColor = ConfigsLoader.ColorsActivities(ActivityStateEnum.Pauzed) + StopButton.BackColor = ConfigsLoader.ColorsActivities(ActivityStateEnum.Finished) + + Catch ex As Exception + MessageBox.Show($"Could not load {Me.Name}.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + + Private Sub StartButton_Click(sender As Object, e As EventArgs) Handles StartButton.Click + Try + _parentUserControl.StartActivity() + Catch ex As Exception + MessageBox.Show($"Could not start activity.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + + Private Sub PauzeButton_Click(sender As Object, e As EventArgs) Handles PauzeButton.Click + Try + _parentUserControl.PauzeActivity() + Catch ex As Exception + MessageBox.Show($"Could not pauze activity.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + + Private Sub StopButton_Click(sender As Object, e As EventArgs) Handles StopButton.Click + Try + _parentUserControl.StopActivity() + Catch ex As Exception + MessageBox.Show($"Could not stop activity.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub +End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/IEmployeeDetailUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/IEmployeeDetailUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/IEmployeeDetailUserControl.vb (revision 1717) @@ -0,0 +1,8 @@ +Public Interface IEmployeeDetailUserControl + + ''' + ''' Update the information with the given employee. + ''' + ''' + sub UpdateInformation(employee As IEmployee) +End Interface FishEye: Tag 1717 refers to a dead (removed) revision in file `ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeePickerUserControl.Designer.vb'. FishEye: No comparison available. Pass `N' to diff? FishEye: Tag 1717 refers to a dead (removed) revision in file `ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeDetailUserControl.vb'. FishEye: No comparison available. Pass `N' to diff? FishEye: Tag 1717 refers to a dead (removed) revision in file `ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeDetailUserControl.resx'. FishEye: No comparison available. Pass `N' to diff? FishEye: Tag 1717 refers to a dead (removed) revision in file `ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeDetailUserControl.Designer.vb'. FishEye: No comparison available. Pass `N' to diff? Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.vb (revision 1717) @@ -0,0 +1,71 @@ +Public Class EmployeePickerUserControl + Implements IRefreshableUserControl + + Private ReadOnly _parentUserControl As IEmployeePickerParentUserControl + Private _employees As List(Of IEmployee) + + Private Sub New() + ' This call is required by the designer. + InitializeComponent() + End Sub + + ''' + ''' Initialises the user form. + ''' + ''' The form containing this user control + Sub New(parentForm As IEmployeePickerParentUserControl) + 'Call base constructor. + Me.New() + 'Set parameters. + + 'Parent form. + 'Value can't be Nothing. + If parentForm Is Nothing Then Throw New InternalException($"The parent user control can't be 'Nothing' in a {Me.Name}.") + _parentUserControl = parentForm + End Sub + + ''' + Public Function RefreshData() As Boolean Implements IRefreshableUserControl.RefreshData + Try + LoadData() + 'Refresh succeeded. + Return True + Catch ex As Exception + 'Refresh failed. + Return False + End Try + End Function + + Private Sub EmployeePickerUserControl_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + LoadData() + Catch ex As Exception + MessageBox.Show($"Could not load {Me.Name}.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + + ''' + ''' Load the employees into the combo box. + ''' + Private Sub LoadData() + 'Fetch the employees. + _employees = _parentUserControl.GetAllEmployees().ToList() + 'Check if data is correct. + If _employees Is Nothing OrElse _employees.Count = 0 Then + 'No items in collection + _employees = Nothing + End If + 'Fill the combobox with names. + EmployeesComboBox.DataSource = _employees.Select(Function(employee) $"{employee.FirstName} {employee.LastName}").ToArray() + End Sub + + Private Sub EmployeesComboBox_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles EmployeesComboBox.SelectionChangeCommitted + 'Skip if no employees were loaded. + If _employees Is Nothing Then Return + + 'Fetch the right employee. + Dim employee = _employees.Item(EmployeesComboBox.SelectedIndex) + 'Send message to parent. + _parentUserControl.SelectEmployee(employee) + End Sub +End Class FishEye: Tag 1717 refers to a dead (removed) revision in file `ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeePickerUserControl.resx'. FishEye: No comparison available. Pass `N' to diff? Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.resx =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.resx (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.resx (revision 1717) @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.Designer.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.Designer.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/EmployeePickerUserControl.Designer.vb (revision 1717) @@ -0,0 +1,93 @@ + _ +Partial Class EmployeePickerUserControl + Inherits System.Windows.Forms.UserControl + + 'UserControl overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.EmployeesComboBox = New System.Windows.Forms.ComboBox() + Me.PictureBox1 = New System.Windows.Forms.PictureBox() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).BeginInit + Me.TableLayoutPanel1.SuspendLayout + Me.SuspendLayout + ' + 'EmployeesComboBox + ' + Me.TableLayoutPanel1.SetColumnSpan(Me.EmployeesComboBox, 3) + Me.EmployeesComboBox.Dock = System.Windows.Forms.DockStyle.Top + Me.EmployeesComboBox.FormattingEnabled = true + Me.EmployeesComboBox.Location = New System.Drawing.Point(53, 303) + Me.EmployeesComboBox.Name = "EmployeesComboBox" + Me.EmployeesComboBox.Size = New System.Drawing.Size(394, 21) + Me.EmployeesComboBox.TabIndex = 0 + ' + 'PictureBox1 + ' + Me.PictureBox1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) + Me.PictureBox1.Image = Global.ActiviteitenOpvolging.My.Resources.Resources.user + Me.PictureBox1.Location = New System.Drawing.Point(128, 3) + Me.PictureBox1.Name = "PictureBox1" + Me.PictureBox1.Size = New System.Drawing.Size(244, 294) + Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom + Me.PictureBox1.TabIndex = 1 + Me.PictureBox1.TabStop = false + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) + Me.TableLayoutPanel1.ColumnCount = 5 + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 10!)) + Me.TableLayoutPanel1.Controls.Add(Me.EmployeesComboBox, 1, 1) + Me.TableLayoutPanel1.Controls.Add(Me.PictureBox1, 2, 0) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(0, 0) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 2 + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20!)) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(500, 600) + Me.TableLayoutPanel1.TabIndex = 2 + ' + 'EmployeePickerUserControl + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.TableLayoutPanel1) + Me.Name = "EmployeePickerUserControl" + Me.Size = New System.Drawing.Size(500, 600) + CType(Me.PictureBox1,System.ComponentModel.ISupportInitialize).EndInit + Me.TableLayoutPanel1.ResumeLayout(false) + Me.ResumeLayout(false) + +End Sub + + Friend WithEvents EmployeesComboBox As ComboBox + Friend WithEvents PictureBox1 As PictureBox + Friend WithEvents TableLayoutPanel1 As TableLayoutPanel +End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj =================================================================== diff -u -r1716 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj (.../ActiviteitenOpvolging.vbproj) (revision 1716) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/ActiviteitenOpvolging.vbproj (.../ActiviteitenOpvolging.vbproj) (revision 1717) @@ -48,16 +48,20 @@ On + + + + @@ -99,14 +103,31 @@ - + + EmployeePickerUserControl.vb + + + UserControl + + EmployeeUserControl.vb - + UserControl + + EmployeeDetailUserControl.vb + + + UserControl + + + + + + - + @@ -146,9 +167,15 @@ DataGridViewUserControl.vb - + + EmployeePickerUserControl.vb + + EmployeeUserControl.vb + + EmployeeDetailUserControl.vb + Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/IEmployeePickerParentUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/IEmployeePickerParentUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/picker/IEmployeePickerParentUserControl.vb (revision 1717) @@ -0,0 +1,13 @@ +Public Interface IEmployeePickerParentUserControl + ''' + ''' Gets all the employees. + ''' + ''' + Function GetAllEmployees() As ICollection(Of IEmployee) + + ''' + ''' Selects an employee. + ''' + ''' + Sub SelectEmployee(employee As IEmployee) +End Interface Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/IRefreshableUserControl.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/IRefreshableUserControl.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/IRefreshableUserControl.vb (revision 1717) @@ -0,0 +1,7 @@ +Public Interface IRefreshableUserControl + ''' + ''' Refresh the data of the user control. + ''' + ''' Whether or not the refresh succeeded. + Function RefreshData() As Boolean +End Interface FishEye: Tag 1717 refers to a dead (removed) revision in file `ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeePickerUserControl.vb'. FishEye: No comparison available. Pass `N' to diff? Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeUserControl.vb =================================================================== diff -u -r1716 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeUserControl.vb (.../EmployeeUserControl.vb) (revision 1716) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/EmployeeUserControl.vb (.../EmployeeUserControl.vb) (revision 1717) @@ -1,9 +1,123 @@ -Public Class EmployeeUserControl - Implements IEmployeeUserControl +Imports ActiviteitenOpvolging.configs - Public ReadOnly Property EmployeeIndex As Integer Implements IEmployeeUserControl.EmployeeIndex +Public Class EmployeeUserControl + Implements IEmployeeUserControl, IEmployeeDetailParentUserControl, IEmployeePickerParentUserControl + Private ReadOnly _parentForm As IEmployeesMainForm + Private ReadOnly Property EmployeeIndex As Integer + Private _employee As IEmployee + + Private Sub New() + ' This call is required by the designer. + InitializeComponent() + End Sub + + ''' + ''' Initialises the user form. + ''' + ''' The form containing this user control + ''' The index of the employee, 0 based + Sub New(parentForm As IEmployeesMainForm, employeeIndex As Integer) + 'Call base constructor. + Me.New() + 'Set parameters. + + 'Parent form. + 'Value can't be Nothing. + If parentForm Is Nothing Then Throw New InternalException($"The parent form can't be 'Nothing' in a {Me.Name}.") + _parentForm = parentForm + + 'Grid number. + Me.EmployeeIndex = employeeIndex + End Sub + + Private Sub EmployeeUserControl_Load(sender As Object, e As EventArgs) Handles MyBase.Load + Try + 'Set back color corresponding to the employee index. + BackColor = Color.White + ForeColor = Color.Black + 'Set border style. + BorderStyle = BorderStyle.FixedSingle + + 'Show the Employee picker user control. + dim employeePickerUserControl = new EmployeePickerUserControl(Me) + With employeePickerUserControl + 'Make it exactly as big as the panel it will go into. + .Size = UserControlPanel.Size + End With + + UserControlPanel.Controls.Add(employeePickerUserControl) + Catch ex As Exception + MessageBox.Show($"Could not load {Me.Name}.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub + + ''' + ''' Update border of the user control. + ''' + Private Sub EmployeeUserControl_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint + 'Border color. + Dim borderColor = ConfigsLoader.ColorsUsers(EmployeeIndex) + 'Border thickness. + Dim borderThickness = 5I + 'Border rectangle. + Dim borderRectangle = Me.ClientRectangle + 'Draw the border. + e.Graphics.DrawRectangle(New Pen(borderColor, borderThickness), borderRectangle) + End Sub + + ''' Public Function RefreshData() As Boolean Implements IEmployeeUserControl.RefreshData - Throw New NotImplementedException + Try + 'todo Call helper method. + + 'Refresh succesfull. + Return True + Catch ex As Exception + 'Failed to retrieve update with data. + Return False + End Try End Function + +#Region "Employee picking" + ''' + Public Function GetAllEmployees() As ICollection(Of IEmployee) Implements IEmployeePickerParentUserControl.GetAllEmployees + Return _parentForm.GetAllEmployees() + End Function + + ''' + Public Sub SelectEmployee(employee As IEmployee) Implements IEmployeePickerParentUserControl.SelectEmployee + Try + 'Call parent to select employee. + _parentForm.SelectEmployee(employee) + 'If successful, store the selected employee. + _employee = employee + Catch ex As Exception + MessageBox.Show($"Could not select employee.{vbNewLine}{ex.Message}", "An error occured...", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + End Sub +#End Region + +#Region "Employee details" + ''' + Public Function FetchEmployee() As IEmployee Implements IEmployeeDetailParentUserControl.FetchEmployee + Return _employee + End Function + + ''' + Public Sub StartActivity() Implements IEmployeeDetailParentUserControl.StartActivity + Throw New NotImplementedException + End Sub + + ''' + Public Sub PauzeActivity() Implements IEmployeeDetailParentUserControl.PauzeActivity + Throw New NotImplementedException + End Sub + + ''' + Public Sub StopActivity() Implements IEmployeeDetailParentUserControl.StopActivity + Throw New NotImplementedException + End Sub +#End Region + End Class Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/IEmployeeUserControl.vb =================================================================== diff -u -r1716 -r1717 --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/IEmployeeUserControl.vb (.../IEmployeeUserControl.vb) (revision 1716) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/IEmployeeUserControl.vb (.../IEmployeeUserControl.vb) (revision 1717) @@ -1,6 +1,4 @@ Public Interface IEmployeeUserControl - ReadOnly Property EmployeeIndex As Integer - ''' ''' Refresh the data of the employee. ''' Index: ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.Designer.vb =================================================================== diff -u --- ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.Designer.vb (revision 0) +++ ActiviteitenOpvolging/ActiviteitenOpvolging/screens/employee/details/EmployeeDetailUserControl.Designer.vb (revision 1717) @@ -0,0 +1,224 @@ + _ +Partial Class EmployeeDetailUserControl + Inherits System.Windows.Forms.UserControl + + 'UserControl overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.TableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel() + Me.ActivityLabel = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.ImagePictureBox = New System.Windows.Forms.PictureBox() + Me.StartButton = New System.Windows.Forms.Button() + Me.PauzeButton = New System.Windows.Forms.Button() + Me.StopButton = New System.Windows.Forms.Button() + Me.NameLabel = New System.Windows.Forms.Label() + Me.StatusLabel = New System.Windows.Forms.Label() + Me.Label1 = New System.Windows.Forms.Label() + Me.BatchLabel = New System.Windows.Forms.Label() + Me.TableLayoutPanel1.SuspendLayout + CType(Me.ImagePictureBox,System.ComponentModel.ISupportInitialize).BeginInit + Me.SuspendLayout + ' + 'TableLayoutPanel1 + ' + Me.TableLayoutPanel1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ + Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles) + Me.TableLayoutPanel1.ColumnCount = 3 + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33332!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334!)) + Me.TableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334!)) + Me.TableLayoutPanel1.Controls.Add(Me.ActivityLabel, 1, 5) + Me.TableLayoutPanel1.Controls.Add(Me.Label2, 0, 5) + Me.TableLayoutPanel1.Controls.Add(Me.ImagePictureBox, 2, 0) + Me.TableLayoutPanel1.Controls.Add(Me.StartButton, 1, 7) + Me.TableLayoutPanel1.Controls.Add(Me.PauzeButton, 1, 9) + Me.TableLayoutPanel1.Controls.Add(Me.StopButton, 1, 11) + Me.TableLayoutPanel1.Controls.Add(Me.NameLabel, 0, 0) + Me.TableLayoutPanel1.Controls.Add(Me.StatusLabel, 0, 3) + Me.TableLayoutPanel1.Controls.Add(Me.Label1, 0, 4) + Me.TableLayoutPanel1.Controls.Add(Me.BatchLabel, 1, 4) + Me.TableLayoutPanel1.Location = New System.Drawing.Point(3, 3) + Me.TableLayoutPanel1.Name = "TableLayoutPanel1" + Me.TableLayoutPanel1.RowCount = 13 + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.810695!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.810695!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.810695!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.810695!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.810695!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 9.810695!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 2.026642!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.6677!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 3.039962!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.6677!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 3.039962!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 10.6677!)) + Me.TableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 1.026197!)) + Me.TableLayoutPanel1.Size = New System.Drawing.Size(494, 594) + Me.TableLayoutPanel1.TabIndex = 0 + ' + 'ActivityLabel + ' + Me.ActivityLabel.AutoSize = true + Me.ActivityLabel.Dock = System.Windows.Forms.DockStyle.Fill + Me.ActivityLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.ActivityLabel.Location = New System.Drawing.Point(167, 290) + Me.ActivityLabel.Name = "ActivityLabel" + Me.ActivityLabel.Size = New System.Drawing.Size(158, 58) + Me.ActivityLabel.TabIndex = 11 + Me.ActivityLabel.Text = "activity" + Me.ActivityLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'Label2 + ' + Me.Label2.AutoSize = true + Me.Label2.Dock = System.Windows.Forms.DockStyle.Right + Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.Label2.Location = New System.Drawing.Point(104, 290) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(57, 58) + Me.Label2.TabIndex = 9 + Me.Label2.Text = "Activiteit" + Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'ImagePictureBox + ' + Me.ImagePictureBox.Dock = System.Windows.Forms.DockStyle.Fill + Me.ImagePictureBox.Image = Global.ActiviteitenOpvolging.My.Resources.Resources.user + Me.ImagePictureBox.InitialImage = Nothing + Me.ImagePictureBox.Location = New System.Drawing.Point(331, 3) + Me.ImagePictureBox.Name = "ImagePictureBox" + Me.TableLayoutPanel1.SetRowSpan(Me.ImagePictureBox, 4) + Me.ImagePictureBox.Size = New System.Drawing.Size(160, 226) + Me.ImagePictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom + Me.ImagePictureBox.TabIndex = 0 + Me.ImagePictureBox.TabStop = false + ' + 'StartButton + ' + Me.StartButton.Dock = System.Windows.Forms.DockStyle.Fill + Me.StartButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.StartButton.Location = New System.Drawing.Point(167, 363) + Me.StartButton.Name = "StartButton" + Me.StartButton.Size = New System.Drawing.Size(158, 57) + Me.StartButton.TabIndex = 2 + Me.StartButton.Text = "START" + Me.StartButton.UseVisualStyleBackColor = true + ' + 'PauzeButton + ' + Me.PauzeButton.Dock = System.Windows.Forms.DockStyle.Fill + Me.PauzeButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.PauzeButton.Location = New System.Drawing.Point(167, 444) + Me.PauzeButton.Name = "PauzeButton" + Me.PauzeButton.Size = New System.Drawing.Size(158, 57) + Me.PauzeButton.TabIndex = 5 + Me.PauzeButton.TabStop = false + Me.PauzeButton.Text = "| |" + Me.PauzeButton.UseVisualStyleBackColor = true + ' + 'StopButton + ' + Me.StopButton.Dock = System.Windows.Forms.DockStyle.Fill + Me.StopButton.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.StopButton.Location = New System.Drawing.Point(167, 525) + Me.StopButton.Name = "StopButton" + Me.StopButton.Size = New System.Drawing.Size(158, 57) + Me.StopButton.TabIndex = 4 + Me.StopButton.Text = "X" + Me.StopButton.UseVisualStyleBackColor = true + ' + 'NameLabel + ' + Me.NameLabel.AutoSize = true + Me.NameLabel.Dock = System.Windows.Forms.DockStyle.Left + Me.NameLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.NameLabel.Location = New System.Drawing.Point(3, 0) + Me.NameLabel.Name = "NameLabel" + Me.NameLabel.Size = New System.Drawing.Size(45, 58) + Me.NameLabel.TabIndex = 6 + Me.NameLabel.Text = "Name" + Me.NameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + ' + 'StatusLabel + ' + Me.StatusLabel.AutoSize = true + Me.TableLayoutPanel1.SetColumnSpan(Me.StatusLabel, 2) + Me.StatusLabel.Dock = System.Windows.Forms.DockStyle.Left + Me.StatusLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.StatusLabel.Location = New System.Drawing.Point(3, 174) + Me.StatusLabel.Name = "StatusLabel" + Me.StatusLabel.Size = New System.Drawing.Size(45, 58) + Me.StatusLabel.TabIndex = 7 + Me.StatusLabel.Text = "Status" + Me.StatusLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft + ' + 'Label1 + ' + Me.Label1.AutoSize = true + Me.Label1.Dock = System.Windows.Forms.DockStyle.Right + Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.Label1.Location = New System.Drawing.Point(119, 232) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(42, 58) + Me.Label1.TabIndex = 8 + Me.Label1.Text = "Batch" + Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight + ' + 'BatchLabel + ' + Me.BatchLabel.AutoSize = true + Me.BatchLabel.Dock = System.Windows.Forms.DockStyle.Fill + Me.BatchLabel.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0,Byte)) + Me.BatchLabel.Location = New System.Drawing.Point(167, 232) + Me.BatchLabel.Name = "BatchLabel" + Me.BatchLabel.Size = New System.Drawing.Size(158, 58) + Me.BatchLabel.TabIndex = 10 + Me.BatchLabel.Text = "batch" + Me.BatchLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + ' + 'EmployeeDetailUserControl + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle + Me.Controls.Add(Me.TableLayoutPanel1) + Me.Name = "EmployeeDetailUserControl" + Me.Size = New System.Drawing.Size(500, 600) + Me.TableLayoutPanel1.ResumeLayout(false) + Me.TableLayoutPanel1.PerformLayout + CType(Me.ImagePictureBox,System.ComponentModel.ISupportInitialize).EndInit + Me.ResumeLayout(false) + +End Sub + + Friend WithEvents TableLayoutPanel1 As TableLayoutPanel + Friend WithEvents ImagePictureBox As PictureBox + Friend WithEvents StartButton As Button + Friend WithEvents StopButton As Button + Friend WithEvents PauzeButton As Button + Friend WithEvents NameLabel As Label + Friend WithEvents StatusLabel As Label + Friend WithEvents Label1 As Label + Friend WithEvents Label2 As Label + Friend WithEvents BatchLabel As Label + Friend WithEvents ActivityLabel As Label +End Class