예제 #1
0
        private async Task CadastrarCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }

            try
            {
                IsBusy = true;
                var userService = new FirebaseService();
                Result = await userService.RegistrarUser(Username, Password, Telefone, Email);

                if (Result)
                {
                    await Application.Current.MainPage.DisplayAlert("Sucesso", "Usuário Registrado", "Ok");

                    await Application.Current.MainPage.Navigation.PopToRootAsync();
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Erro", "Falha ao registrar usuário", "Ok");
                }
            }
            catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Erro", ex.Message, "Ok");
            }
            finally
            {
                IsBusy = false;
            }
        }