コード例 #1
0
        private async void Deletar_Clicked()
        {
            try
            {
                var answer = await DisplayAlert("Deletar? ", "Deseja realmente deletar este item?", "Sim", "Não");

                ToastProgress.Show();

                if (answer)
                {
                    await FreteHelper.DeleteFrete(Item.ID);

                    UserDialogs.Instance.Toast("Frete deletado com sucesso!", TimeSpan.FromSeconds(3));
                    await Navigation.PopAsync();
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            finally
            {
                ToastProgress.Hide();
            }
        }
コード例 #2
0
        private async void OnDelete(object sender, EventArgs e)
        {
            try
            {
                var        mi       = ((MenuItem)sender);
                FreteModel itemGrid = mi.CommandParameter as FreteModel;

                var answer = await DisplayAlert("Deletar? ", "Deseja realmente deletar: " + itemGrid.TIPO, "Sim", "Não");

                ToastProgress.Show();

                if (answer)
                {
                    await FreteHelper.DeleteFrete(itemGrid.ID);

                    viewModel.LoadItemsCommand.Execute(null);
                    UserDialogs.Instance.Toast("Frete deletado com sucesso!", TimeSpan.FromSeconds(3));
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
            finally
            {
                ToastProgress.Hide();
            }
        }