Public Class mainForm

    Public cnstr As String = loginForm.cnstr

    Private Sub ManualToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        mcSeqForm.Show()
    End Sub

    Private Sub mainForm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        loginForm.Close()
    End Sub

    Private Sub mainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.WindowState = FormWindowState.Maximized
        Me.Text = "Mounting Sequence v.1.0    Current User - " & loginForm.username

        Select Case loginForm.userType
            Case "Operator"
                MaintenanceToolStripMenuItem.Visible = False
                CheckRequestsToolStripMenuItem.Visible = False
                AdministrationToolStripMenuItem.Visible = False
            Case "Quality Control"
                AdministrationToolStripMenuItem.Visible = False
                CheckRequestsToolStripMenuItem.Visible = False
            Case "Engineer"
                CheckRequestsToolStripMenuItem.Visible = False
                AdministrationToolStripMenuItem.Visible = False
            Case "PPC"
                MountingToolStripMenuItem.Visible = False
                MaintenanceToolStripMenuItem.Visible = False
                AdministrationToolStripMenuItem.Visible = False
        End Select
    End Sub

    Private Sub tsClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsClose.Click
        Try
            Dim activeForm As String = ActiveMdiChild.Name
            Select Case activeForm
                Case "mcSeqForm"
                    mcSeqForm.Close()
                Case "uploadMcSeq"
                    uploadMcSeq.Close()
                Case "mountingForm"
                    mountingForm.Close()
                Case "machineForm"
                    machineForm.Close()
                Case "userForm"
                    userForm.Close()
                Case "requestForm"
                    requestForm.Close()
            End Select
        Catch ex As Exception
        End Try
    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub MountingToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MountingToolStripMenuItem.Click
        mountingForm.Show()
    End Sub

    Private Sub UsersToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsersToolStripMenuItem.Click
        userForm.Show()
    End Sub

    Private Sub tsFirst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsFirst.Click
        Try
            Dim activeForm As String = ActiveMdiChild.Name
            Select Case activeForm
                Case "machineForm"
                    machineForm.moveFirst()
                Case "userForm"
                    userForm.moveFirst()
            End Select
        Catch ex As Exception
        End Try
    End Sub

    Private Sub tsPrevious_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsPrevious.Click
        Try
            Dim activeForm As String = ActiveMdiChild.Name
            Select Case activeForm
                Case "machineForm"
                    machineForm.movePrevious()
                Case "userForm"
                    userForm.movePrevious()
            End Select
        Catch ex As Exception
        End Try
    End Sub

    Private Sub tsNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsNext.Click
        Try
            Dim activeForm As String = ActiveMdiChild.Name
            Select Case activeForm
                Case "machineForm"
                    machineForm.moveNext()
                Case "userForm"
                    userForm.moveNext()
            End Select
        Catch ex As Exception
        End Try
    End Sub

    Private Sub tsLast_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tsLast.Click
        Try
            Dim activeForm As String = ActiveMdiChild.Name
            Select Case activeForm
                Case "machineForm"
                    machineForm.moveLast()
                Case "userForm"
                    userForm.moveLast()
            End Select
        Catch ex As Exception
        End Try
    End Sub

    Private Sub MachineToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MachineToolStripMenuItem.Click
        machineForm.Show()
    End Sub

    Private Sub FileUploadToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileUploadToolStripMenuItem.Click
        mcSeqForm.Show()
    End Sub

    Private Sub CheckRequestsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckRequestsToolStripMenuItem.Click
        requestForm.Show()
    End Sub
End Class
