Imports DevComponents.DotNetBar.Keyboard

Public Class FrmLogin
    Public Sub New()
        InitializeComponent()
        KeyboardControl1.Keyboard = CreateDefaultKeyboard()

    End Sub

    Public Overloads Function ShowDialog() As CredencialesBasicasModelo
        MyBase.ShowDialog()
        Return New CredencialesBasicasModelo With {.Usuario = TxtUsuario.Text, .Password = TxtContraseña.Text}
    End Function

    Private Sub BtnNuevo_Click(sender As Object, e As EventArgs) Handles BtnNuevo.Click
        Me.Close()
    End Sub

    Private Sub KeyPress(sender As Object, e As KeyPressEventArgs) Handles TxtUsuario.KeyPress, TxtContraseña.KeyPress
        If e.KeyChar = Chr(13) Then
            SendKeys.Send("{TAB}")
            e.Handled = True
            Exit Sub
        End If
    End Sub


    Public Shared Function CreateDefaultKeyboard() As Keyboard
        Dim keyboard As New Keyboard

        Dim kc As LinearKeyboardLayout
        kc = New LinearKeyboardLayout()
        keyboard.Layouts.Add(kc)
        kc.AddKey("7", style:=KeyStyle.Light)
        kc.AddKey("8", style:=KeyStyle.Light)
        kc.AddKey("9", style:=KeyStyle.Light)
        kc.AddSpace(1)
        kc.AddKey("Bcks", info:="{BACKSPACE}", style:=KeyStyle.Dark)
        kc.AddLine()

        kc.AddKey("4", style:=KeyStyle.Light)
        kc.AddKey("5", style:=KeyStyle.Light)
        kc.AddKey("6", style:=KeyStyle.Light)
        kc.AddSpace(1)
        kc.AddKey("Enter", info:="{ENTER}", style:=KeyStyle.Dark, width:=10, height:=31)

        kc.AddLine()
        kc.AddKey("1", style:=KeyStyle.Light)
        kc.AddKey("2", style:=KeyStyle.Light)
        kc.AddKey("3", style:=KeyStyle.Light)
        kc.AddSpace(1)
        kc.AddLine()

        kc.AddKey("0", style:=KeyStyle.Light, width:=32, height:=10)
        kc.AddSpace(1)

        Return keyboard
    End Function
End Class