Esempio n. 1
0
        private async void BtnSalvar_Clicked(object sender, EventArgs e)
        {
            if (!ValidaDados())
            {
                return;
            }

            try
            {
                ToastProgress.Show();
                Registro.NOME     = txtNome.Text.Trim();
                Registro.TELEFONE = txtTelefone.Value.ToString();
                Registro.CNH      = txtCNH.Text.ToString().Trim();
                Settings.UserName = Registro.NOME;

                await firebaseHelper.UpdatePerson(Registro);

                await Navigation.PopAsync();

                ToastProgress.Hide();
                UserDialogs.Instance.Toast("Cadastro atualizado com sucesso!", TimeSpan.FromSeconds(3));
            }
            catch (Exception ex)
            {
                ToastProgress.Hide();
                string error = Validations.ErrorValidator.ValidaErrosAuth(ex.Message);
                await DisplayAlert("Ooopss...", error + "\n\nTente novamente!", "OK");
            }
        }