private void Usuario_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == Convert.ToChar(Keys.Enter)) { if (Usuario.Text != "") { Contrasena.Focus(); } } if (e.KeyChar == Convert.ToChar(Keys.Escape)) { Application.Exit(); } }
private async void BtnIngresar_Clicked(object sender, EventArgs e) { var cedulaingresar = Cedula.Text; var contraseñaingresar = Contrasena.Text; if (string.IsNullOrEmpty(cedulaingresar)) { await DisplayAlert("Validación", "Ingrese la cedula", "Aceptar"); Cedula.Focus(); return; } if (string.IsNullOrEmpty(contraseñaingresar)) { await DisplayAlert("Validación", "Ingrese la contraseña", "Aceptar"); Contrasena.Focus(); return; } var content = await _Client.GetStringAsync(url + "Cadete?cedula=" + cedulaingresar + "&contrasena=" + contraseñaingresar); var cadete = JsonConvert.DeserializeObject <Cadete>(content); if (cadete == null) { await DisplayAlert("Error", "El cadete ingresado no existe", "Aceptar"); return; } if (cadete != null) { Application.Current.Properties["Cadetee"] = cadete; Application.Current.Properties["Cadete"] = cadete.CedulaUsu; await Navigation.PushModalAsync(new ListarEnvios(), true); } }