Files
SanchoToro/GestionGrupoSanchoToro/VentanasEmergentes/dxwIdentificacion.xaml.vb
2026-01-23 12:45:41 +01:00

74 lines
3.0 KiB
VB.net

Imports DevExpress.Xpf.Editors
Imports DevExpress.Xpf.Core.Native
Imports System.Reflection
Imports bdGrupoSanchoToro.db
Public Class dxwIdentificacion
Private _Empresas As List(Of db.empresas)
Private _Version As String
Public Cancelar As Boolean
Public Sub New(Empresas As List(Of bdGrupoSanchoToro.db.empresas), Version As String)
_Version = Version
_Empresas = Empresas
' Esta llamada es exigida por el diseñador.
InitializeComponent()
If Empresas.Count > 1 Then
Me.Height = 290
liEmpresa.Visibility = Visibility.Visible
Else
Me.Height = 230
End If
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button1.Click
Cancelar = False
Me.Close()
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) Handles Button2.Click
Cancelar = True
Me.Close()
End Sub
Private Sub Window_PreviewKeyDown(sender As Object, e As KeyEventArgs) Handles gc.PreviewKeyDown
If e.Key = Key.Return Then
If teUsuario.Text <> "" And Me.pbeContrasenna.Text <> "" Then
Cancelar = False
Me.Close()
Else
Dim te As BaseEdit = LayoutHelper.FindParentObject(Of BaseEdit)(Keyboard.FocusedElement)
If te Is Nothing Then
FocusManager.SetFocusedElement(Me, teUsuario)
Else
If te.Name.ToUpper = "TEUSUARIO" Then
FocusManager.SetFocusedElement(Me, pbeContrasenna)
Else
FocusManager.SetFocusedElement(Me, teUsuario)
End If
End If
End If
End If
End Sub
Private Sub dxwIdentificacion_Activated(sender As Object, e As EventArgs) Handles Me.Activated
' Application.Current.Dispatcher.BeginInvoke(New Action(Function() Me.Focus()), System.Windows.Threading.DispatcherPriority.Send)
' Application.Current.Dispatcher.BeginInvoke(New Action(Function() teUsuario.Focus()), System.Windows.Threading.DispatcherPriority.Send)
End Sub
Private Sub dxwIdentificacion_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
'FocusManager.SetFocusedElement(Me, teUsuario)
cbEmpresa.ItemsSource = _Empresas
cbEmpresa.EditValue = _Empresas.First.idEmpresa
teUsuario.Focus()
' Application.Current.Dispatcher.BeginInvoke(New Action(Function() Me.Focus()), System.Windows.Threading.DispatcherPriority.Send)
' Application.Current.Dispatcher.BeginInvoke(New Action(Function() teUsuario.Focus()), System.Windows.Threading.DispatcherPriority.Send)
Cancelar = True
lVersion.Content = "Versión: " & _Version
End Sub
End Class