private async void reg2Btn_Click(object sender, RoutedEventArgs e) { Usuario user = new Usuario(); user.nombre = nombreBox.Text; user.password = passBox.Password; user.username = userBox.Text; user.email = mailBox.Text; user.cel = celBox.Text; user.localidad = localidadBox.Text; try { dynamic res = await ConectorUsuario.Register(user); var dialog = new MessageDialog("Registrado con exito!"); await dialog.ShowAsync(); loginSP.Visibility = Visibility.Visible; regSP.Visibility = Visibility.Collapsed; this.limpiarCampos(); } catch (Exception e1) { var dialog = new MessageDialog(e1.Message); await dialog.ShowAsync(); } }
private async void clickRegister(object sender, EventArgs e) { //que hacer si el usuario da click al boton de registrar if (mailTxt.Text.Equals("") || passwordTxt.Text.Equals("")) { //que mensaje mostrar si el usuario no ingreso cuenta o password Toast missdata = Toast.MakeText(this, "es necesario completar todos los campos", ToastLength.Short); missdata.Show(); } else { Toast toast = Toast.MakeText(this, "Aguarde mientras procesamos el registro", ToastLength.Long); toast.Show(); //que hacer si el usuario ingreso todo correctamente user.nombre = nameTxt.Text; user.password = passwordTxt.Text; user.username = userTxt.Text; user.email = mailTxt.Text; user.cel = celTxt.Text; user.localidad = locTxt.Text; nameTxt.Enabled = false; passwordTxt.Enabled = false; password2Txt.Enabled = false; userTxt.Enabled = false; mailTxt.Enabled = false; celTxt.Enabled = false; locTxt.Enabled = false; registerBtn.Enabled = false; logInBtn.Enabled = false; reg2Btn.Enabled = false; cancelBtn.Enabled = false; try { dynamic res = await ConectorUsuario.Register(user); Toast register = Toast.MakeText(this, "Registrado con Exito!", ToastLength.Short); register.Show(); buttonsLyt.Visibility = ViewStates.Visible; singUpLyt.Visibility = ViewStates.Gone; this.limpiarCampos(); } catch (Exception e1) { Toast errorReg = Toast.MakeText(this, e1.Message, ToastLength.Short); errorReg.Show(); } nameTxt.Enabled = true; passwordTxt.Enabled = true; userTxt.Enabled = true; mailTxt.Enabled = true; password2Txt.Enabled = true; celTxt.Enabled = true; locTxt.Enabled = true; registerBtn.Enabled = true; logInBtn.Enabled = true; reg2Btn.Enabled = true; cancelBtn.Enabled = true; //informar al usuario si se pudo registrar } }