Imports DevExpress.Xpf.Editors Imports DevExpress.Xpf.Core.Native Imports System.Reflection Public Class dxwIdentificacion Private _Version As String Public Cancelar As Boolean Public Sub New(Optional Version As String = "") _Version = Version ' Esta llamada es exigida por el diseñador. InitializeComponent() ' 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) 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 = _Version End Sub End Class