Imports DPFP.Gui.Verification

Public Class FrmMenuSecundario
    Public Sub New(ByRef owner As Form)
        If TypeOf owner IsNot FrmMenuPrincipal Then Throw New Exception("El formulario clave administrador solo se puede abrir desde el menu principal.")
        InitializeComponent()
        Me.Owner = owner
    End Sub

    Private Sub FrmMenuSecundario_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub BtnRegistros_Click(sender As Object, e As EventArgs) Handles BtnRegistros.Click
        CType(Me.Owner, FrmMenuPrincipal).AbrirFrmRegistros()
        Me.Close()
    End Sub

    Private Sub BtnUsuarios_Click(sender As Object, e As EventArgs) Handles BtnUsuarios.Click
        Dim frm0 As New FrmIngresoContrato(Me)
        For Each frm1 As Form In Application.OpenForms
            If frm1.Name = frm0.Name Then
                frm1.ShowDialog()
                frm1.Activate()
                frm1.WindowState = FormWindowState.Maximized
                Exit Sub
            End If
        Next

        frm0.ShowDialog()
        frm0.Activate()
        frm0.WindowState = FormWindowState.Maximized

        CType(Me.Owner, FrmMenuPrincipal).AbrirFrmUsuarios()
        Me.Close()
    End Sub

    Private Sub BtnOpciones_Click(sender As Object, e As EventArgs) Handles BtnOpciones.Click
        CType(Me.Owner, FrmMenuPrincipal).AbrirFrmParametros()
        Me.Close()
    End Sub
End Class