コード例 #1
0
        private async Task RegistrarCommandAsync()
        {
            if (IsBusy)
            {
                return;
            }
            try
            {
                IsBusy = true;
                var firebaseService = new FirebaseService();
                Result = await firebaseService.AdicionarCatastrofe(this.Registrar);

                if (Result)
                {
                    await Application.Current.MainPage.DisplayAlert("Sucesso", "Desastre registrada com sucesso", "Ok");

                    MessagingCenter.Send(this.Registrar, "Registrar");
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Erro", "Falha ao registrar catástrofe", "Ok");
                }
            }
            catch (Exception ex)
            {
                await Application.Current.MainPage.DisplayAlert("Erro", ex.Message, "Ok");
            }
            finally
            {
                IsBusy = false;
            }
        }